Skip to content

Commit

Permalink
Persist the actual simulated position of the ECAL hit rather than the…
Browse files Browse the repository at this point in the history
… cell center (#1485)

* Persist the actual simulated position of the ECAL hit rather than the cell center
* Add Ecal simhit rechit position checks in DQM
* Zoom in for Z axis
  • Loading branch information
tvami authored Jan 19, 2025
1 parent 0a96b6a commit 86ccf4c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
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

0 comments on commit 86ccf4c

Please sign in to comment.