-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PandoraLArRecoNDBranchFiller #76
base: main
Are you sure you want to change the base?
Conversation
Updated ndcaf_setup.sh and build.sh to use a consistent environment.
I think that the truth part of it could be an issue, as the truth branches are shared by all reconstructions. The particles are uniquely identified with two ids, one that identifies the interaction inside a given spill: |
I think this is ready for review now. We have added the unix_ts variable to set the trigger time, and we are using the same MC Id variables as the other reco methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks fine. Just a couple of small grumbles.
ndcaf_setup.sh
Outdated
@@ -14,6 +14,7 @@ setup duneanaobj v03_06_01b -q e20:prof | |||
setup hdf5 v1_10_5a -q e20 | |||
setup fhiclcpp v4_15_03 -q debug:e20 | |||
setup edepsim v3_2_0c -q debug:e20 | |||
setup root v6_26_06b -q e20:p3913:prof |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A ROOT setup already comes implicitly from the duneanaobj
and edepsim
requirements (which each depend on ROOT). In the abstract I would prefer to have it explicit, as here, but in practice, if this line conflicts with dependencies inherited from the other products, the resulting environment will have subtle and difficult-to-diagnose inconsistencies. (I've personally wasted hours chasing this sort of thing down in the past.) So unless there's a strong reason to include, I'd like to not add this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, removed.
if (m_LArRecoNDFile && m_LArRecoNDFile->IsOpen()) | ||
{ | ||
delete m_LArRecoNDTree; m_LArRecoNDTree = nullptr; | ||
} | ||
delete m_LArRecoNDFile; m_LArRecoNDFile = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any chance we could use unique_ptr
s here, instead of manual memory management in 2024? suggestions for the knock-on changes for this suggestion below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to unique pointers.
m_LastTriggerReqd(m_Triggers.end()) | ||
{ | ||
// Open Pandora LArRecoND hierarchy analysis ROOT file | ||
m_LArRecoNDFile = TFile::Open(pandoraLArRecoNDFilename.c_str(), "read"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to use a unique_ptr, this line would look something like
m_LArRecoNDFile = TFile::Open(pandoraLArRecoNDFilename.c_str(), "read"); | |
m_LArRecoNDFile.reset(TFile::Open(pandoraLArRecoNDFilename.c_str(), "read")); |
LOG.VERBOSE() << " Using PandoraLArRecoND file " << pandoraLArRecoNDFilename << "\n"; | ||
|
||
// Input tree | ||
m_LArRecoNDTree = dynamic_cast<TTree*>(m_LArRecoNDFile->Get("LArRecoND")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly, here, you'd have
m_LArRecoNDTree = dynamic_cast<TTree*>(m_LArRecoNDFile->Get("LArRecoND")); | |
m_LArRecoNDTree.reset(dynamic_cast<TTree*>(m_LArRecoNDFile->Get("LArRecoND"))); |
std::vector<int> *m_isPrimaryVect = nullptr; | ||
std::vector<float> *m_completenessVect = nullptr; | ||
|
||
float m_LArRho{1.3973f}; // LAr density (g/cm3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be better as a parameter, rather than hard-coded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the LAr density as an optional config parameter with a default value.
Unique pointers for the ROOT file/tree & LAr density pararmeter
Created the
PandoraLArRecoNDBranchFiller
class to store the reconstruction information from Pandora's LArRecoND package (used for the DUNE ND). It requires a ROOT file created by the HierarchyAnalysisAlgorithm, which uses Pandora's Hierarchy Tools.The filled reco branches are
rec.nd.lar.pandora.tracks
and.rec.nd.lar.pandora.showers
. No distinction is made (yet) between tracks and showers, and so the same 3D-cluster Particle Flow Objects (PFOs) are used for both. Here is the list of reco variables used:Any changes needed here can be done mostly in the LArRecoND package, since the CAF just retrieves the output stored by Pandora's hierarchy algorithm.
The MC truth matching uses Pandora's Hierarchy Tools and not TruthMatcher. Pandora requires all MC particles to have a unique ID (even if they originate from different neutrinos), and so the following offsets are applied to the original (ndlar-flow) MC Ids:
where nuIndex = 0 to N-1 for an event with N neutrinos, and the orig_mcId number range restarts from zero for each neutrino. This ensures all IDs are unique, for up to 100 neutrino interactions per event, each containing up to 10^6 hits.
These ID offsets are reversed when the Pandora CAF truth information is filled using the best reco-MC match achieved with Hierarchy Tools, and so the mcId's should then have values consistent with the equivalent input ndlar-flow files. The filled truth information corresponds to:
truth.ixn
= orig_nuIdtruth.part
= orig_mcId (best match)truth.type
= primary, secondary or othertruthOverlap
= completeness (best match)H5 input files are first converted to ROOT using h5_to_root_ndlarflow.py before they are used by LArRecoND & Pandora, which in turn creates the hierarchy analysis output file that can be used to make the equivalent CAFs.
For the trigger, the event run numbers are propagated using those originally from the input ndar_flow ROOT files. Also, the start time is currently set using the ts_start variable, but this needs to be updated (in LArRecoND) to use the correct time and units.
Also updated
ndcaf_setup.sh
andbuild.sh
to use a consistent environment.