Skip to content

Feature/acastill lightpropagation update - #946

Open
asanchezcastillo wants to merge 5 commits into
developfrom
feature/acastill_lightpropagation_update
Open

Feature/acastill lightpropagation update#946
asanchezcastillo wants to merge 5 commits into
developfrom
feature/acastill_lightpropagation_update

Conversation

@asanchezcastillo

@asanchezcastillo asanchezcastillo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

This PR does:

  • Modify the standard MC workflow to add lightpropagationcorrection module to the default chain.
  • Clean up and factorization of the lightpropagationcorrection module.
  • Include the particle propagation time calculation. This is saved as an attribute of the CorrectedOpFlashTiming object. This is required for downstream correction (more information here)

$${\color{blue}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}$$

$${\color{blue}\bf{\textrm{IMPORTANT UPDATE Feb 2nd 2026:}}}$$ If you are making a PR which is intended as a patch for the CURRENT production for gen 2 SBND analyses, you must make two PRs: one for develop and one for the production/sbnd-gen2 branch.

$${\color{blue}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}$$

Checklist

  • Added at least 1 label from available labels.
  • Assigned at least 1 reviewer under Reviewers,
  • Assigned all contributers including yourself under Assignees
  • Linked any relevant issues under Developement
  • Does this PR affect CAF data format? If so, please assign a CAF maintainer (PetrilloAtWork or JosiePaton) as additional reviewer.
  • Does this affect the standard workflow?
  • Is this PR a patch for the ongoing production? If so, separate PR must also be made for production/v10_06_00 branch!

Relevant PR links (optional)

Does this PR require merging another PR in a different repository (such as sbnanobj/sbnobj etc.)?
This PRs should be merged with
SBNSoftware/sbnobj#175
SBNSoftware/sbncode#666
SBNSoftware/sbnanaobj#195

Link(s) to docdb describing changes (optional)

Is there a docdb describing the issue this solves or the feature added?

@tjones79 tjones79 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great thanks @asanchezcastillo

Few minor changes before approval :)

}
double average_prop_time = n ? sum / n : 0;
return average_prop_time;
return n ? sum / n : 0.0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return is unreachable and looks like a copy-and-paste error. Please remove!

}
double average_prop_time = n ? sum / n : 0;
return average_prop_time;
return n ? sum / n : 0.0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment

Comment on lines -433 to -434
else
throw std::runtime_error("LightPropagationCorrection: unexpected pdType '" + pdType + "' for opdet " + std::to_string(opdet));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should restore the throw std::runtime_error to force the code to fail loudly if it sees something unexpected!

Comment on lines -428 to +393
const std::string pdType = fPDSMap.pdType(opdet);
if(pdType=="pmt_coated" || pdType=="xarapuca_vuv")
if(fPDSMap.pdType(opdet)=="pmt_coated" || fPDSMap.pdType(opdet)=="xarapuca_vuv")
lightPropTime = std::min(lightPropTimeVIS, lightPropTimeVUV);
else if(pdType=="pmt_uncoated" || pdType=="xarapuca_vis")
else if(fPDSMap.pdType(opdet)=="pmt_uncoated" || fPDSMap.pdType(opdet)=="xarapuca_vis")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor point, I think, but it looks like the local variable assignment const std::string pdType = fPDSMap.pdType(opdet); was dropped here, resulting in calling the function multiple times in the if/else if.

If restore the local variable then that can be avoided by simply doing: if(pdType=="pmt_coated" || pdType=="xarapuca_vuv") as in the original code

//OpFlash to OpHit
art::FindManyP<recob::OpHit> flashToOpHitAssns_tpc0(opflashListHandle_tpc0, e, fOpFlashLabel_tpc0);
art::FindManyP<recob::OpHit> flashToOpHitAssns_tpc1(opflashListHandle_tpc1, e, fOpFlashLabel_tpc1);
flashToOpHitAssns_tpc0 = std::make_unique<art::FindManyP<recob::OpHit>>( opflashListHandle_tpc0, e, fOpFlashLabel_tpc0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason these have to be declared as such?

I naively think these should be kept consistent with the above associations in how they are declared.

Could you move these back to local variables? You can pass them by const & into your new CorrectOpFlash() method. (Note: This is already done for slice_opt0finder_assns, slice_hit_assns etc... just above this line).

You would need to remove the corresponding declerations in the header file here

Comment on lines +152 to +154
// Flash ophit associations
std::unique_ptr<art::FindManyP<recob::OpHit>> flashToOpHitAssns_tpc0;
std::unique_ptr<art::FindManyP<recob::OpHit>> flashToOpHitAssns_tpc1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fLightPropCorrectionLabel = p.get<std::string>("LightPropCorrectionLabel");
}

void LightPropagationCorrectionAna::analyze(art::Event const& e)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add fParticlePropagationTime = -99999.; and fPhotonPropagationTime = -99999.; to this block just to keep the event-by-event initialisation consistent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants