22 #include "G4VProcess.hh" 23 #include "G4EventManager.hh" 24 #include "G4SystemOfUnits.hh" 26 #include "G4StepPoint.hh" 55 LogDebug(
"MuonSimDebug") <<
"create MuonSubDetector " <<
name;
60 G4String sdet =
"unknown";
85 <<
" of type " << sdet <<
" <" << GetName() <<
"> EnergyThresholdForPersistency(GeV) " 109 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::clearHits";
116 if (aStep->GetTotalEnergyDeposit() > 0.) {
122 if (aStep->GetTrack()->GetDynamicParticle()->GetCharge() != 0) {
130 thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
143 MuonBaseNumber <<
"MuonNumbering :: number of levels = " << num.
getLevels() << std::endl;
144 MuonBaseNumber <<
"Level \t SuperNo \t BaseNo" << std::endl;
150 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::setDetUnitId :: " << MuonBaseNumbr;
151 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = " 174 float zentry = theEntryPoint.
z();
175 float zexit = theExitPoint.
z();
187 const G4Track* theTrack = aStep->GetTrack();
188 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
190 float thePabs = preStepPoint->GetMomentum().
mag() /
CLHEP::GeV;
191 float theTof = preStepPoint->GetGlobalTime() / CLHEP::nanosecond;
192 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
196 thePV = preStepPoint->GetPhysicalVolume();
200 const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
201 G4ThreeVector lmd =
static_cast<const G4TouchableHistory*
>(preStepPoint->GetTouchable())
207 float theThetaAtEntry = lnmd.
theta();
208 float thePhiAtEntry = lnmd.
phi();
223 int thePID =
std::abs(theTrack->GetDefinition()->GetPDGEncoding());
231 edm::LogVerbatim(
"MuonSimDebug") <<
"=== NEW Muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" " 232 <<
thePV->GetLogicalVolume()->GetName();
233 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
234 const G4VProcess*
p2 = preStepPoint->GetProcessDefinedStep();
237 sss +=
" POST PROCESS: " + p->GetProcessName();
239 sss +=
"; PRE PROCESS: " + p2->GetProcessName();
242 edm::LogVerbatim(
"MuonSimDebug") <<
" theta= " << theThetaAtEntry <<
" phi= " << thePhiAtEntry <<
" Pabs(GeV/c) " 243 << thePabs <<
" Eloss(GeV)= " << theEnergyLoss <<
" Tof(ns)= " << theTof
245 << theEntryPoint <<
" exit " << theExitPoint <<
" delta " 246 << (theExitPoint - theEntryPoint) <<
"\n Global: entry " 247 << preStepPoint->GetPosition() <<
" exit " 248 << aStep->GetPostStepPoint()->GetPosition();
260 float zexit = theExitPoint.
z();
267 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
273 edm::LogVerbatim(
"MuonSimDebug") <<
"=== NEW Update muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss
274 <<
" " <<
thePV->GetLogicalVolume()->GetName();
275 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
276 const G4VProcess*
p2 = preStepPoint->GetProcessDefinedStep();
279 sss +=
" POST PROCESS: " + p->GetProcessName();
281 sss +=
"; PRE PROCESS: " + p2->GetProcessName();
284 edm::LogVerbatim(
"MuonSimDebug") <<
" delEloss(GeV)= " << theEnergyLoss <<
" Tof(ns)= " << theTof
313 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
314 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
316 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
318 G4int
depth = theTouchable->GetHistory()->GetDepth();
319 G4ThreeVector localCoordinates =
320 theTouchable->GetHistory()->GetTransform(depth - levelsUp).TransformPoint(globalCoordinates);
326 const G4StepPoint* postStepPoint = currentStep->GetPostStepPoint();
327 const G4StepPoint* preStepPoint = currentStep->GetPreStepPoint();
328 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
330 const G4TouchableHistory* theTouchable = (
const G4TouchableHistory*)(preStepPoint->GetTouchable());
332 G4int
depth = theTouchable->GetHistory()->GetDepth();
333 G4ThreeVector localCoordinates =
334 theTouchable->GetHistory()->GetTransform(depth - levelsUp).TransformPoint(globalCoordinates);
T getParameter(std::string const &) const
const G4VPhysicalVolume * thePV
Local3DPoint FinalStepPositionVsParent(const G4Step *currentStep, G4int levelsUp)
G4bool ProcessHits(G4Step *, G4TouchableHistory *) override
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
void updateHit(const G4Step *)
void printLocal(LocalPoint, LocalPoint) const
int getBaseNo(int level) const
Geom::Phi< T > phi() const
Compact representation of the geometrical detector hierarchy.
MuonSubDetector * detector
void fillHits(edm::PSimHitContainer &, const std::string &) override
Geom::Theta< T > theta() const
Local3DPoint cmsUnits(const Local3DPoint &v)
std::vector< PSimHit > & hits()
unsigned int processId(const G4VProcess *p) const
Local3DPoint exitPoint() const
Exit point in the local Det frame.
void createHit(const G4Step *)
void clearHits() override
void updateExitPoint(const Local3DPoint &exit)
virtual void Initialize()
G4ProcessTypeEnumerator * theG4ProcessTypeEnumerator
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
bool newHit(const G4Step *)
Abs< T >::type abs(const T &t)
virtual Local3DPoint transformPoint(const Local3DPoint &, const G4Step *) const
~MuonSensitiveDetector() override
const SimTrackManager * theManager
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
static int particleID(const G4Track *)
MuonFrameRotation * theRotation
MuonSensitiveDetector(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
uint32_t setDetUnitId(const G4Step *) override
Point3DBase< float, LocalTag > Local3DPoint
void addEnergyLoss(float eloss)
void startNewSimHit(std::string)
void EndOfEvent(G4HCofThisEvent *) override
MuonSimHitNumberingScheme * numbering
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
int getSuperNo(int level) const
virtual bool processHits(const PSimHit &)
std::vector< PSimHit > PSimHitContainer
int baseNumberToUnitNumber(const MuonBaseNumber &) override
Local3DPoint entryPoint() const
Entry point in the local Det frame.
unsigned int detUnitId() const
Local3DPoint InitialStepPositionVsParent(const G4Step *currentStep, G4int levelsUp)
UpdatablePSimHit * theHit
MuonG4Numbering * g4numbering
SimHitPrinter * thePrinter
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const