26 #include "G4VProcess.hh"
27 #include "G4EventManager.hh"
28 #include "G4SystemOfUnits.hh"
30 #include "G4StepPoint.hh"
55 bool dd4hep =
p.getParameter<
bool>(
"g4GeometryDD4hepSource");
72 throw cms::Exception(
"MuonSensitiveDetector") <<
"Cannot find MuonGeometryConstants\n";
74 G4String sdet =
"unknown";
98 edm::LogVerbatim(
"MuonSim") <<
" of type " << sdet <<
" <" << GetName() <<
"> EnergyThresholdForPersistency(GeV) "
133 if (aStep->GetTotalEnergyDeposit() > 0.) {
142 thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
154 MuonBaseNumber <<
"MuonNumbering :: number of levels = " <<
num.getLevels() << std::endl;
161 edm::LogVerbatim(
"MuonSim") <<
"MuonSensitiveDetector::setDetUnitId :: " << MuonBaseNumbr;
162 edm::LogVerbatim(
"MuonSim") <<
"MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = "
185 float zentry = theEntryPoint.
z();
186 float zexit = theExitPoint.
z();
198 const G4Track* theTrack = aStep->GetTrack();
199 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
201 float thePabs = preStepPoint->GetMomentum().
mag() /
CLHEP::GeV;
202 float theTof = preStepPoint->GetGlobalTime() / CLHEP::nanosecond;
203 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
207 thePV = preStepPoint->GetPhysicalVolume();
211 const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
212 G4ThreeVector lmd = static_cast<const G4TouchableHistory*>(preStepPoint->GetTouchable())
218 float theThetaAtEntry = lnmd.
theta();
219 float thePhiAtEntry = lnmd.
phi();
234 int thePID =
std::abs(theTrack->GetDefinition()->GetPDGEncoding());
238 info->storeTrack(
true);
242 edm::LogVerbatim(
"MuonSim") <<
"=== NEW Muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" "
243 <<
thePV->GetLogicalVolume()->GetName();
244 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
245 const G4VProcess*
p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
248 sss +=
" POST PROCESS: " +
p->GetProcessName();
250 sss +=
"; PRE PROCESS: " +
p2->GetProcessName();
253 edm::LogVerbatim(
"MuonSim") <<
" theta= " << theThetaAtEntry <<
" phi= " << thePhiAtEntry <<
" Pabs(GeV/c) "
254 << thePabs <<
" Eloss(GeV)= " << theEnergyLoss <<
" Tof(ns)= " << theTof
256 << theEntryPoint <<
" exit " << theExitPoint <<
" delta "
257 << (theExitPoint - theEntryPoint) <<
"\n Global: entry "
258 << aStep->GetPreStepPoint()->GetPosition() <<
" exit "
259 << aStep->GetPostStepPoint()->GetPosition();
271 float zexit = theExitPoint.
z();
278 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
284 edm::LogVerbatim(
"MuonSim") <<
"=== NEW Update muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" "
285 <<
thePV->GetLogicalVolume()->GetName();
286 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
287 const G4VProcess*
p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
290 sss +=
" POST PROCESS: " +
p->GetProcessName();
292 sss +=
"; PRE PROCESS: " +
p2->GetProcessName();
296 <<
" Tof(ns)= " << aStep->GetPreStepPoint()->GetGlobalTime() / CLHEP::nanosecond
324 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
325 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
327 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
329 G4int
depth = theTouchable->GetHistory()->GetDepth();
330 G4ThreeVector localCoordinates =
331 theTouchable->GetHistory()->GetTransform(
depth - levelsUp).TransformPoint(globalCoordinates);
337 const G4StepPoint* postStepPoint = currentStep->GetPostStepPoint();
338 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
339 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
341 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
343 G4int
depth = theTouchable->GetHistory()->GetDepth();
344 G4ThreeVector localCoordinates =
345 theTouchable->GetHistory()->GetTransform(
depth - levelsUp).TransformPoint(globalCoordinates);