12 #include <klm/eklm/simulation/EKLMSensitiveDetector.h>
15 #include <klm/dbobjects/eklm/EKLMSimulationParameters.h>
18 #include <framework/database/DBObjPtr.h>
19 #include <framework/gearbox/Unit.h>
20 #include <framework/logging/Logger.h>
26 #include <CLHEP/Geometry/Point3D.h>
31 Simulation::SensitiveDetectorBase(name,
Const::KLM),
36 B2FATAL(
"EKLM simulation parameters are not available.");
51 const int stripLevel = 1;
52 int section, layer, sector, plane, strip, stripGlobal;
54 G4TouchableHandle hist = aStep->GetPreStepPoint()->GetTouchableHandle();
55 section = hist->GetVolume(stripLevel + 6)->GetCopyNo();
56 layer = hist->GetVolume(stripLevel + 5)->GetCopyNo();
57 sector = hist->GetVolume(stripLevel + 4)->GetCopyNo();
58 plane = hist->GetVolume(stripLevel + 3)->GetCopyNo();
59 strip = hist->GetVolume(stripLevel)->GetCopyNo();
60 stripGlobal = m_ElementNumbers->stripNumber(
61 section, layer, sector, plane, strip);
62 const G4double eDep = aStep->GetTotalEnergyDeposit();
66 const G4Track& track = * aStep->GetTrack();
67 const G4double hitTime = track.GetGlobalTime();
69 if (hitTime > m_ThresholdHitTime) {
70 B2INFO(
"EKLMSensitiveDetector: "
71 " ALL HITS WITH TIME > hitTimeThreshold ARE DROPPED!!");
75 gpos = 0.5 * (aStep->GetPostStepPoint()->GetPosition() +
76 aStep->GetPreStepPoint()->GetPosition());
77 lpos = hist->GetHistory()->GetTopTransform().TransformPoint(gpos);
80 CLHEP::Hep3Vector trackMomentum = track.GetMomentum();
81 hit->setMomentum(TLorentzVector(trackMomentum.x(), trackMomentum.y(),
82 trackMomentum.z(), track.GetTotalEnergy()));
83 hit->setTrackID(track.GetTrackID());
84 hit->setParentTrackID(track.GetParentID());
85 hit->setLocalPosition(lpos.x() / CLHEP::mm *
Unit::mm,
88 hit->setPosition(gpos.x() / CLHEP::mm *
Unit::mm,
91 hit->setEnergyDeposit(eDep);
92 hit->setPDG(track.GetDefinition()->GetPDGEncoding());
93 hit->setTime(hitTime);
96 hit->setSector(sector);
98 hit->setSection(section);
99 hit->setVolumeID(stripGlobal);
103 particleToSimHits.
add(track.GetTrackID(), m_SimHits.getEntries() - 1);