22 #include "G4StepPoint.hh"
23 #include "G4VProcess.hh"
25 #include "G4SystemOfUnits.hh"
49 rTracker(1200. *
CLHEP::mm),
50 zTracker(3000. *
CLHEP::mm),
73 theRotation = std::make_unique<TrackerFrameRotation>();
74 rotType =
"TrackerFrameRotation";
76 #ifdef FAKEFRAMEROTATION
78 rotType =
"FakeFrameRotation";
82 <<
" Criteria for Saving Tracker SimTracks: \n"
85 <<
"\n FrameRotation type " << rotType <<
" rTracker(cm)= " <<
rTracker / CLHEP::cm
86 <<
" zTracker(cm)= " <<
zTracker / CLHEP::cm
93 std::vector<std::string>
temp;
105 LogDebug(
"TrackerSimDebug") <<
" Entering a new Step " << aStep->GetTotalEnergyDeposit() <<
" "
106 << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
127 const G4Track* gTrack = (*bot)();
130 if (gTrack->GetCreatorProcess()) {
131 edm::LogVerbatim(
"TrackerSim") <<
" -> PROCESS CREATOR : " << gTrack->GetCreatorProcess()->GetProcessName();
140 const G4ThreeVector&
pos = gTrack->GetPosition();
141 LogDebug(
"TrackerSimDebug") <<
" update(..) of " << gTrack->GetDefinition()->GetParticleName()
142 <<
" trackID= " << gTrack->GetTrackID() <<
" E(MeV)= " << gTrack->GetKineticEnergy()
143 <<
" Ecut= " <<
energyCut <<
" R(mm)= " <<
pos.perp() <<
" Z(mm)= " <<
pos.z();
153 if (gTrack->GetKineticEnergy() >
energyCut) {
155 info->storeTrack(
true);
164 info->putInHistory();
165 LogDebug(
"TrackerSimDebug") <<
" Track inside the tracker selected for HISTORY"
166 <<
" Track ID= " << gTrack->GetTrackID();
177 oldVolume->GetLogicalVolume()->GetName(),
209 const G4Track* theTrack = aStep->GetTrack();
216 if (0.0 == theTrack->GetDefinition()->GetPDGCharge()) {
217 theEntryPoint = theExitPoint;
225 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
226 float thePabs = preStepPoint->GetMomentum().mag() /
GeV;
227 float theTof = preStepPoint->GetGlobalTime() / nanosecond;
228 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
GeV;
231 int theTrackID = theTrack->GetTrackID();
232 if (theDetUnitId == 0) {
233 edm::LogWarning(
"TkAccumulatingSensitiveDetector::createHit") <<
" theDetUnitId is not valid for " << GetName();
234 throw cms::Exception(
"TkAccumulatingSensitiveDetector::createHit")
235 <<
"cannot get theDetUnitId for G4Track " << theTrackID;
241 unsigned int theTrackIDInsideTheSimHit = theTrackID;
244 if (!
temp->storeTrack()) {
246 theTrackIDInsideTheSimHit = theTrack->GetParentID();
247 LogDebug(
"TrackerSimDebug") <<
" TkAccumulatingSensitiveDetector::createHit(): setting the TrackID from "
248 << theTrackIDInsideTheSimHit <<
" to the mother one " << theTrackIDInsideTheSimHit
249 <<
" " << theEnergyLoss;
251 LogDebug(
"TrackerSimDebug") <<
" TkAccumulatingSensitiveDetector:createHit(): leaving the current TrackID "
252 << theTrackIDInsideTheSimHit;
255 const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
258 ((G4TouchableHistory*)(preStepPoint->GetTouchable()))->GetHistory()->GetTopTransform().TransformAxis(gmd);
260 float theThetaAtEntry = lnmd.
theta();
261 float thePhiAtEntry = lnmd.
phi();
270 theTrackIDInsideTheSimHit,
286 oldVolume = preStepPoint->GetPhysicalVolume();
287 pname = theTrack->GetDefinition()->GetParticleName();
290 <<
" p= " << aStep->GetPreStepPoint()->GetMomentum().mag() <<
" "
301 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
GeV;
306 LogDebug(
"TrackerSimDebug") <<
" updateHit: for " << aStep->GetTrack()->GetDefinition()->GetParticleName()
307 <<
" trackID= " << aStep->GetTrack()->GetTrackID() <<
" deltaEloss= " << theEnergyLoss
315 const G4Track* theTrack = aStep->GetTrack();
318 if (0.0 == theTrack->GetDefinition()->GetPDGCharge())
322 int theTrackID = theTrack->GetTrackID();
325 << theDetUnitId <<
"," << theTrackID <<
") Step length(mm)= " << aStep->GetStepLength()
326 <<
" Edep= " << aStep->GetTotalEnergyDeposit()
327 <<
" p= " << aStep->GetPreStepPoint()->GetMomentum().mag();
332 const float tolerance2 = 0.0025f;
340 LogDebug(
"TrackerSimDebug") <<
" Saving the last hit in a ROU " << GetName();
347 eventno = (*i)()->GetEventID();