Repository navigation
Conversation
fhagemann
left a comment
There was a problem hiding this comment.
Looks good to me.
My biggest comment would be about code duplication: if the HDF parser and the L0 loader essentially call the same function to load the detector IDs from the geometry, would it make sense to define this method for the general MModuleMeasurements instead of separately in every class derived from it?
| void MModuleLoaderMeasurementsL0::LoadDetectorIDsFromGeometry() | ||
| { | ||
| // Collect the detector IDs of all GeDs in the geometry (same way as MModuleLoaderMeasurementsHDF) | ||
|
|
||
| m_DetectorIDsInGeometry.clear(); | ||
|
|
||
| if (m_Geometry == nullptr) return; | ||
|
|
||
| for (MDDetector* Detector : m_Geometry->GetDetectorList()) { | ||
| MString Name = Detector->GetName(); | ||
| if (Detector->GetTypeName() == "Strip3D" && Name.BeginsWith("GeD_") == true) { | ||
| Name.RemoveAllInPlace("GeD_"); | ||
| m_DetectorIDsInGeometry.insert(Name.ToUnsignedInt()); | ||
| } | ||
| } | ||
|
|
||
| // Keep all strip hits if the detector names don't follow the convention | ||
| if (m_DetectorIDsInGeometry.empty() == true && g_Verbosity >= c_Warning) { | ||
| cout<<m_XmlTag<<": No GeD_X detectors found in the geometry - keeping strip hits from all detectors"<<endl; | ||
| } | ||
|
|
||
| if (g_Verbosity >= c_Info) { | ||
| cout<<m_XmlTag<<": Detector IDs in the geometry:"; | ||
| for (unsigned int DetID : m_DetectorIDsInGeometry) cout<<" "<<DetID; | ||
| cout<<endl; | ||
| } | ||
| } |
There was a problem hiding this comment.
This seems like an exact copy of the HDF parser.
Maybe, it would make more sense to have m_DetectorIDsInGeometry as part of the general MModuleLoaderMeasurements and define this function there for all the loaders at once (?)
There was a problem hiding this comment.
It is the same. I copied it from the HDF loader. I agree we should move it to a central place instead of writing it twice.
There was a problem hiding this comment.
Should we do this in this PR or in a separate PR?
There was a problem hiding this comment.
Hmm, I guess we can do it in this pr. Then should I implement it?
There was a problem hiding this comment.
I don't have a strong opinion, but I would have a slight preference for yes, if you have the bandwidth to do this.
Co-authored-by: Felix Hagemann <hagemann@berkeley.edu>
Fixes part of #249: The L0 reader now skips hits on detectors that are not in the geometry, the same way #248 does for the HDF reader.