Skip to content
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

Persist the actual simulated position of the ECAL hit rather than the cell center #1485

Merged
merged 3 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions DQM/python/dqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ def __init__(self,name="EcalDigiVerify") :
self.ecalRecHitColl = "EcalRecHits"
self.ecalRecHitPass = "" #use whatever pass is available

self.build1DHistogram( "rec_sim_hit_residual_x" ,
"RecHit X - SimHit X [mm]" , 30 , -15.0 , 15.0 )

self.build1DHistogram( "rec_sim_hit_residual_y" ,
"RecHit Y - SimHit Y [mm]" , 30 , -15.0 , 15.0 )

self.build1DHistogram( "rec_sim_hit_residual_z" ,
"RecHit Z - SimHit Z [mm]" , 200 , -5.0 , 5.0 )

self.build1DHistogram( "num_sim_hits_per_cell" ,
"Number of SimHits per ECal Cell (excluding empty rec cells)" , 20 , -0.5 , 19.5 )

Expand Down
6 changes: 6 additions & 0 deletions DQM/src/DQM/EcalDigiVerifier.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ void EcalDigiVerifier::analyze(const framework::Event &event) {
if (rawID == simHit.getID()) {
numSimHits += simHit.getNumberOfContribs();
totalSimEDep += simHit.getEdep();
auto residualX = recHit.getXPos() - simHit.getPosition()[0];
auto residualY = recHit.getYPos() - simHit.getPosition()[1];
auto residualZ = recHit.getZPos() - simHit.getPosition()[2];
histograms_.fill("rec_sim_hit_residual_x", residualX);
histograms_.fill("rec_sim_hit_residual_y", residualY);
histograms_.fill("rec_sim_hit_residual_z", residualZ);
} else if (rawID < simHit.getID()) {
// later sim hits - all done
break;
Expand Down
14 changes: 2 additions & 12 deletions SimCore/src/SimCore/SDs/EcalSD.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ G4bool EcalSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
// fastest, but need to trust module number between GDML and EcalGeometry
// match
ldmx::EcalID id =
geometry.getID(position[0], position[1], layerNumber, module_position);
geometry.getID(position.x(), position.y(), layerNumber, module_position);

// medium, only need to trust z-layer positions in GDML and EcalGeometry match
// helpful for debugging any issues where transverse position is not
Expand All @@ -96,17 +96,7 @@ G4bool EcalSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
// hit in empty cell
auto& hit = hits_[id];
hit.setID(id.raw());
/**
* convert position to center of cell position
*
* This is the behavior that has been done in the past,
* although it is completely redundant with the ID information
* already deduced. It would probably help us more if we
* persisted the actual simulated position of the hit rather
* than the cell center; however, that is up for more discussion.
*/
auto [x, y, z] = geometry.getPosition(id);
hit.setPosition(x, y, z);
hit.setPosition(position.x(), position.y(), position.z());
}

auto& hit = hits_[id];
Expand Down
Loading