26 #include "G4VProcess.hh" 27 #include "G4EventManager.hh" 28 #include "G4SystemOfUnits.hh" 30 #include "G4StepPoint.hh" 59 LogDebug(
"MuonSimDebug") <<
"create MuonSubDetector " <<
name;
67 G4String sdet =
"unknown";
92 <<
" of type " << sdet <<
" <" << GetName() <<
"> EnergyThresholdForPersistency(GeV) " 116 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::clearHits";
123 if (aStep->GetTotalEnergyDeposit() > 0.) {
132 thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
144 MuonBaseNumber <<
"MuonNumbering :: number of levels = " << num.
getLevels() << std::endl;
145 MuonBaseNumber <<
"Level \t SuperNo \t BaseNo" << std::endl;
151 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::setDetUnitId :: " << MuonBaseNumbr;
152 LogDebug(
"MuonSimDebug") <<
"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());
232 edm::LogVerbatim(
"MuonSimDebug") <<
"=== NEW Muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss <<
" " 233 <<
thePV->GetLogicalVolume()->GetName();
234 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
235 const G4VProcess*
p2 = preStepPoint->GetProcessDefinedStep();
238 sss +=
" POST PROCESS: " + p->GetProcessName();
240 sss +=
"; PRE PROCESS: " + p2->GetProcessName();
243 edm::LogVerbatim(
"MuonSimDebug") <<
" 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 << preStepPoint->GetPosition() <<
" exit " 249 << aStep->GetPostStepPoint()->GetPosition();
261 float zexit = theExitPoint.
z();
268 float theEnergyLoss = aStep->GetTotalEnergyDeposit() /
CLHEP::GeV;
274 edm::LogVerbatim(
"MuonSimDebug") <<
"=== NEW Update muon hit for " << GetName() <<
" Edep(GeV)= " << theEnergyLoss
275 <<
" " <<
thePV->GetLogicalVolume()->GetName();
276 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
277 const G4VProcess*
p2 = preStepPoint->GetProcessDefinedStep();
280 sss +=
" POST PROCESS: " + p->GetProcessName();
282 sss +=
"; PRE PROCESS: " + p2->GetProcessName();
285 edm::LogVerbatim(
"MuonSimDebug") <<
" delEloss(GeV)= " << theEnergyLoss <<
" Tof(ns)= " << theTof
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);
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
MuonSubDetector * detector
MuonSensitiveDetector(const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
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
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
uint32_t setDetUnitId(const G4Step *) override
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
Point3DBase< float, LocalTag > Local3DPoint