27 #include "G4StepPoint.hh"
28 #include "G4VProcess.hh"
30 #include "G4SystemOfUnits.hh"
53 rTracker(1200. *
CLHEP::mm),
54 zTracker(3000. *
CLHEP::mm),
77 theRotation = std::make_unique<TrackerFrameRotation>();
78 rotType =
"TrackerFrameRotation";
80 #ifdef FAKEFRAMEROTATION
82 rotType =
"FakeFrameRotation";
86 <<
" Criteria for Saving Tracker SimTracks: \n"
89 <<
"\n FrameRotation type " << rotType <<
" rTracker(cm)= " <<
rTracker / CLHEP::cm
90 <<
" zTracker(cm)= " <<
zTracker / CLHEP::cm
97 std::vector<std::string>
temp;
109 LogDebug(
"TrackerSimDebug") <<
" Entering a new Step " << aStep->GetTotalEnergyDeposit() <<
" "
110 << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
131 const G4Track* gTrack = (*bot)();
134 if (gTrack->GetCreatorProcess()) {
135 edm::LogVerbatim(
"TrackerSim") <<
" -> PROCESS CREATOR : " << gTrack->GetCreatorProcess()->GetProcessName();
144 const G4ThreeVector&
pos = gTrack->GetPosition();
145 LogDebug(
"TrackerSimDebug") <<
" update(..) of " << gTrack->GetDefinition()->GetParticleName()
146 <<
" trackID= " << gTrack->GetTrackID() <<
" E(MeV)= " << gTrack->GetKineticEnergy()
147 <<
" Ecut= " <<
energyCut <<
" R(mm)= " <<
pos.perp() <<
" Z(mm)= " <<
pos.z();
157 if (gTrack->GetKineticEnergy() >
energyCut) {
159 info->storeTrack(
true);
168 info->putInHistory();
169 LogDebug(
"TrackerSimDebug") <<
" Track inside the tracker selected for HISTORY"
170 <<
" Track ID= " << gTrack->GetTrackID();
181 oldVolume->GetLogicalVolume()->GetName(),
213 const G4Track* theTrack = aStep->GetTrack();
220 if (0.0 == theTrack->GetDefinition()->GetPDGCharge()) {
221 theEntryPoint = theExitPoint;
229 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
230 float thePabs = preStepPoint->GetMomentum().mag() /
GeV;
231 float theTof = preStepPoint->GetGlobalTime() / nanosecond;
232 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
GeV;
235 int theTrackID = theTrack->GetTrackID();
236 if (theDetUnitId == 0) {
237 edm::LogWarning(
"TkAccumulatingSensitiveDetector::createHit") <<
" theDetUnitId is not valid for " << GetName();
238 throw cms::Exception(
"TkAccumulatingSensitiveDetector::createHit")
239 <<
"cannot get theDetUnitId for G4Track " << theTrackID;
245 unsigned int theTrackIDInsideTheSimHit = theTrackID;
248 if (!
temp->storeTrack()) {
250 theTrackIDInsideTheSimHit = theTrack->GetParentID();
251 LogDebug(
"TrackerSimDebug") <<
" TkAccumulatingSensitiveDetector::createHit(): setting the TrackID from "
252 << theTrackIDInsideTheSimHit <<
" to the mother one " << theTrackIDInsideTheSimHit
253 <<
" " << theEnergyLoss;
255 LogDebug(
"TrackerSimDebug") <<
" TkAccumulatingSensitiveDetector:createHit(): leaving the current TrackID "
256 << theTrackIDInsideTheSimHit;
259 const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
262 ((G4TouchableHistory*)(preStepPoint->GetTouchable()))->GetHistory()->GetTopTransform().TransformAxis(gmd);
264 float theThetaAtEntry = lnmd.
theta();
265 float thePhiAtEntry = lnmd.
phi();
274 theTrackIDInsideTheSimHit,
290 oldVolume = preStepPoint->GetPhysicalVolume();
291 pname = theTrack->GetDefinition()->GetParticleName();
294 <<
" p= " << aStep->GetPreStepPoint()->GetMomentum().mag() <<
" "
305 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
GeV;
310 LogDebug(
"TrackerSimDebug") <<
" updateHit: for " << aStep->GetTrack()->GetDefinition()->GetParticleName()
311 <<
" trackID= " << aStep->GetTrack()->GetTrackID() <<
" deltaEloss= " << theEnergyLoss
319 const G4Track* theTrack = aStep->GetTrack();
322 if (0.0 == theTrack->GetDefinition()->GetPDGCharge())
326 int theTrackID = theTrack->GetTrackID();
329 << theDetUnitId <<
"," << theTrackID <<
") Step length(mm)= " << aStep->GetStepLength()
330 <<
" Edep= " << aStep->GetTotalEnergyDeposit()
331 <<
" p= " << aStep->GetPreStepPoint()->GetMomentum().mag();
336 const float tolerance2 = 0.0025f;
344 LogDebug(
"TrackerSimDebug") <<
" Saving the last hit in a ROU " << GetName();
351 eventno = (*i)()->GetEventID();