27 #include "G4VProcess.hh"
28 #include "G4EventManager.hh"
29 #include "G4SystemOfUnits.hh"
31 #include "G4StepPoint.hh"
69 throw cms::Exception(
"MuonSensitiveDetector") <<
"Cannot find MuonGeometryConstants\n";
71 G4String sdet =
"unknown";
96 <<
" of type " << sdet <<
" <" << GetName() <<
"> EnergyThresholdForPersistency(GeV) "
131 if (aStep->GetTotalEnergyDeposit() > 0.) {
140 thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
152 MuonBaseNumber <<
"MuonNumbering :: number of levels = " <<
num.getLevels() << std::endl;
159 edm::LogVerbatim(
"MuonSim") <<
"MuonSensitiveDetector::setDetUnitId :: " << MuonBaseNumbr;
160 edm::LogVerbatim(
"MuonSim") <<
"MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = "
183 float zentry = theEntryPoint.
z();
184 float zexit = theExitPoint.
z();
196 const G4Track* theTrack = aStep->GetTrack();
197 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
199 float thePabs = preStepPoint->GetMomentum().
mag() /
CLHEP::GeV;
200 float theTof = preStepPoint->GetGlobalTime() / CLHEP::nanosecond;
201 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
205 thePV = preStepPoint->GetPhysicalVolume();
209 const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
210 G4ThreeVector lmd = static_cast<const G4TouchableHistory*>(preStepPoint->GetTouchable())
216 float theThetaAtEntry = lnmd.
theta();
217 float thePhiAtEntry = lnmd.
phi();
232 int thePID =
std::abs(theTrack->GetDefinition()->GetPDGEncoding());
236 info->storeTrack(
true);
240 edm::LogVerbatim(
"MuonSim") <<
"=== NEW Muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" "
241 <<
thePV->GetLogicalVolume()->GetName();
242 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
243 const G4VProcess*
p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
246 sss +=
" POST PROCESS: " +
p->GetProcessName();
248 sss +=
"; PRE PROCESS: " +
p2->GetProcessName();
251 edm::LogVerbatim(
"MuonSim") <<
" theta= " << theThetaAtEntry <<
" phi= " << thePhiAtEntry <<
" Pabs(GeV/c) "
252 << thePabs <<
" Eloss(GeV)= " << theEnergyLoss <<
" Tof(ns)= " << theTof
254 << theEntryPoint <<
" exit " << theExitPoint <<
" delta "
255 << (theExitPoint - theEntryPoint) <<
"\n Global: entry "
256 << aStep->GetPreStepPoint()->GetPosition() <<
" exit "
257 << aStep->GetPostStepPoint()->GetPosition();
269 float zexit = theExitPoint.
z();
276 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
282 edm::LogVerbatim(
"MuonSim") <<
"=== NEW Update muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" "
283 <<
thePV->GetLogicalVolume()->GetName();
284 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
285 const G4VProcess*
p2 = aStep->GetPreStepPoint()->GetProcessDefinedStep();
288 sss +=
" POST PROCESS: " +
p->GetProcessName();
290 sss +=
"; PRE PROCESS: " +
p2->GetProcessName();
294 <<
" Tof(ns)= " << aStep->GetPreStepPoint()->GetGlobalTime() / CLHEP::nanosecond
322 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
323 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
325 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
327 G4int
depth = theTouchable->GetHistory()->GetDepth();
328 G4ThreeVector localCoordinates =
329 theTouchable->GetHistory()->GetTransform(
depth - levelsUp).TransformPoint(globalCoordinates);
335 const G4StepPoint* postStepPoint = currentStep->GetPostStepPoint();
336 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
337 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
339 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
341 G4int
depth = theTouchable->GetHistory()->GetDepth();
342 G4ThreeVector localCoordinates =
343 theTouchable->GetHistory()->GetTransform(
depth - levelsUp).TransformPoint(globalCoordinates);