22 #include "G4VProcess.hh"
23 #include "G4EventManager.hh"
24 #include "G4SystemOfUnits.hh"
26 #include "G4StepPoint.hh"
39 double aEPersistentCutGeV,
40 bool aAllMuonsPersistent,
50 printHits(aPrintHits),
52 ePersistentCutGeV(aEPersistentCutGeV),
53 allMuonsPersistent(aAllMuonsPersistent),
62 G4String sdet =
"unknown";
88 edm::LogVerbatim(
"MuonSim") <<
" of type " << sdet <<
" <" << GetName() <<
"> EnergyThresholdForPersistency(GeV) "
123 if (aStep->GetTotalEnergyDeposit() > 0.) {
132 thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
144 MuonBaseNumber <<
"MuonNumbering :: number of levels = " <<
num.getLevels() << std::endl;
151 edm::LogVerbatim(
"MuonSim") <<
"MuonSensitiveDetector::setDetUnitId :: " << MuonBaseNumbr;
152 edm::LogVerbatim(
"MuonSim") <<
"MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = "
175 float zentry = theEntryPoint.
z();
176 float zexit = theExitPoint.
z();
188 const G4Track* theTrack = aStep->GetTrack();
189 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
191 float thePabs = preStepPoint->GetMomentum().
mag() /
CLHEP::GeV;
192 float theTof = preStepPoint->GetGlobalTime() / CLHEP::nanosecond;
193 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
197 thePV = preStepPoint->GetPhysicalVolume();
201 const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
202 G4ThreeVector lmd = static_cast<const G4TouchableHistory*>(preStepPoint->GetTouchable())
208 float theThetaAtEntry = lnmd.
theta();
209 float thePhiAtEntry = lnmd.
phi();
224 int thePID =
std::abs(theTrack->GetDefinition()->GetPDGEncoding());
228 info->storeTrack(
true);
232 edm::LogVerbatim(
"MuonSim") <<
"=== NEW Muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" "
233 <<
thePV->GetLogicalVolume()->GetName();
234 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
235 const G4VProcess*
p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
238 sss +=
" POST PROCESS: " +
p->GetProcessName();
240 sss +=
"; PRE PROCESS: " +
p2->GetProcessName();
243 edm::LogVerbatim(
"MuonSim") <<
" theta= " << theThetaAtEntry <<
" phi= " << thePhiAtEntry <<
" Pabs(GeV/c) "
244 << thePabs <<
" Eloss(GeV)= " << theEnergyLoss <<
" Tof(ns)= " << theTof
246 << theEntryPoint <<
" exit " << theExitPoint <<
" delta "
247 << (theExitPoint - theEntryPoint) <<
"\n Global: entry "
248 << aStep->GetPreStepPoint()->GetPosition() <<
" exit "
249 << aStep->GetPostStepPoint()->GetPosition();
261 float zexit = theExitPoint.
z();
268 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
274 edm::LogVerbatim(
"MuonSim") <<
"=== NEW Update muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" "
275 <<
thePV->GetLogicalVolume()->GetName();
276 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
277 const G4VProcess*
p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
280 sss +=
" POST PROCESS: " +
p->GetProcessName();
282 sss +=
"; PRE PROCESS: " +
p2->GetProcessName();
286 <<
" Tof(ns)= " << aStep->GetPreStepPoint()->GetGlobalTime() / CLHEP::nanosecond
314 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
315 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
317 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
319 G4int
depth = theTouchable->GetHistory()->GetDepth();
320 G4ThreeVector localCoordinates =
321 theTouchable->GetHistory()->GetTransform(
depth - levelsUp).TransformPoint(globalCoordinates);
327 const G4StepPoint* postStepPoint = currentStep->GetPostStepPoint();
328 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
329 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
331 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
333 G4int
depth = theTouchable->GetHistory()->GetDepth();
334 G4ThreeVector localCoordinates =
335 theTouchable->GetHistory()->GetTransform(
depth - levelsUp).TransformPoint(globalCoordinates);