27 static const int layer_depth = 2;
29 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
32 G4double edep = aStep->GetTotalEnergyDeposit();
36 if (verboseLevel > 2) {
37 G4cout <<
"CalorimeterSD skipping step with zero edep." << G4endl
44 G4StepPoint* prePoint = aStep->GetPreStepPoint();
45 G4StepPoint* postPoint = aStep->GetPostStepPoint();
46 G4ThreeVector position =
47 0.5 * (prePoint->GetPosition() + postPoint->GetPosition());
52 auto preStepPoint = aStep->GetPreStepPoint();
54 const auto& touchableHandle = preStepPoint->GetTouchableHandle();
55 if (touchableHandle) {
56 auto history = touchableHandle->GetHistory();
58 auto volume = history->GetVolume(layer_depth);
60 cpynum = volume->GetCopyNo();
66 layerNumber = cpynum / 7;
67 int module_position = cpynum % 7;
82 geometry.getID(position.x(), position.y(), layerNumber, module_position);
97 auto& hit =
hits_[id];
99 hit.setPosition(position.x(), position.y(), position.z());
102 auto& hit =
hits_[id];
105 auto track = aStep->GetTrack();
106 auto time = track->GetGlobalTime();
107 auto track_id = track->GetTrackID();
108 auto pdg = track->GetParticleDefinition()->GetPDGEncoding();
111 int contrib_i = hit.findContribIndex(track_id, pdg);
113 hit.updateContrib(contrib_i, edep, time);
115 hit.addContrib(
getTrackMap().findIncident(track_id), track_id, pdg, edep,
120 hit.setEdep(hit.getEdep() + edep);
121 if (time < hit.getTime() or hit.getTime() == 0) {