Skip to content

FIX: Skip L0 hits on detectors that are not in the geometry - #304

Open
mwy-wing wants to merge 5 commits into
cositools:develop/emfrom
mwy-wing:fix/l0-unknown-detectors
Open

mwy-wing wants to merge 5 commits into
cositools:develop/emfrom
mwy-wing:fix/l0-unknown-detectors

Conversation

@mwy-wing

Copy link
Copy Markdown

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.

@mwy-wing
mwy-wing requested a review from fhagemann November 14, 2026 08:38

@fhagemann fhagemann 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.

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?

Comment thread include/MModuleLoaderMeasurementsL0.h Resolved
Comment on lines +227 to +253
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;
}
}

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 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 (?)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

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 we do this in this PR or in a separate PR?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hmm, I guess we can do it in this pr. Then should I implement it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't have a strong opinion, but I would have a slight preference for yes, if you have the bandwidth to do this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure

Comment thread src/MModuleLoaderMeasurementsL0.cxx Resolved
Comment thread src/MModuleLoaderMeasurementsL0.cxx Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants