22 #include "G4VProcess.hh" 23 #include "G4EventManager.hh" 24 #include "G4SystemOfUnits.hh" 26 #include "G4StepPoint.hh" 42 theTrackID(0), theManager(manager)
52 LogDebug(
"MuonSimDebug") <<
"create MuonSubDetector "<<
name;
57 G4String sdet =
"unknown";
82 <<
" of type " << sdet <<
" <" << GetName()
83 <<
"> EnergyThresholdForPersistency(GeV) " << ePersistentCutGeV/
CLHEP::GeV 108 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::clearHits";
114 LogDebug(
"MuonSimDebug") <<
" MuonSensitiveDetector::ProcessHits " 117 if (aStep->GetTotalEnergyDeposit()>0.){
123 if( aStep->GetTrack()->GetDynamicParticle()->GetCharge() != 0 ){
132 thePV = aStep->GetPreStepPoint()->GetPhysicalVolume();
146 MuonBaseNumber <<
"MuonNumbering :: number of levels = "<<num.
getLevels()<<std::endl;
147 MuonBaseNumber <<
"Level \t SuperNo \t BaseNo"<<std::endl;
154 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::setDetUnitId :: "<<MuonBaseNumbr;
155 LogDebug(
"MuonSimDebug") <<
"MuonSensitiveDetector::setDetUnitId :: MuonDetUnitId = " 164 || (aStep->GetPreStepPoint()->GetPhysicalVolume() !=
thePV)
181 float zentry = theEntryPoint.
z();
182 float zexit = theExitPoint.
z();
194 const G4Track* theTrack = aStep->GetTrack();
195 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
197 float thePabs = preStepPoint->GetMomentum().
mag()/
CLHEP::GeV;
198 float theTof = preStepPoint->GetGlobalTime()/CLHEP::nanosecond;
199 float theEnergyLoss = aStep->GetTotalEnergyDeposit()/
CLHEP::GeV;
203 thePV = preStepPoint->GetPhysicalVolume();
207 const G4ThreeVector& gmd = preStepPoint->GetMomentumDirection();
208 G4ThreeVector lmd = ((G4TouchableHistory *)(preStepPoint->GetTouchable()))->GetHistory()
209 ->GetTopTransform().TransformAxis(gmd);
212 float theThetaAtEntry = lnmd.
theta();
213 float thePhiAtEntry = lnmd.
phi();
221 int thePID =
std::abs(theTrack->GetDefinition()->GetPDGEncoding());
230 <<
" Edep(GeV)= " << theEnergyLoss
231 <<
" " <<
thePV->GetLogicalVolume()->GetName();
232 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
233 const G4VProcess*
p2 = preStepPoint->GetProcessDefinedStep();
235 if (p) sss +=
" POST PROCESS: " + p->GetProcessName();
236 if (p2)sss +=
"; PRE PROCESS: " + p2->GetProcessName();
239 <<
" phi= " << thePhiAtEntry
240 <<
" Pabs(GeV/c) " << thePabs
241 <<
" Eloss(GeV)= " << theEnergyLoss
242 <<
" Tof(ns)= " << theTof
245 <<
"\n Local: entry " << theEntryPoint
246 <<
" exit " << theExitPoint
247 <<
" delta " << (theExitPoint-theEntryPoint)
248 <<
"\n Global: entry " << preStepPoint->GetPosition()
249 <<
" exit " << aStep->GetPostStepPoint()->GetPosition();
262 float zexit = theExitPoint.
z();
269 float theEnergyLoss = aStep->GetTotalEnergyDeposit()/
CLHEP::GeV;
275 edm::LogVerbatim(
"MuonSimDebug") <<
"=== NEW Update muon hit for "<< GetName()
276 <<
" Edep(GeV)= " << theEnergyLoss
277 <<
" " <<
thePV->GetLogicalVolume()->GetName();
278 const G4VProcess*
p = aStep->GetPostStepPoint()->GetProcessDefinedStep();
279 const G4VProcess*
p2 = preStepPoint->GetProcessDefinedStep();
281 if (p) sss +=
" POST PROCESS: " + p->GetProcessName();
282 if (p2)sss +=
"; PRE PROCESS: " + p2->GetProcessName();
285 <<
" Tof(ns)= " << theTof
288 <<
" exit " << theExitPoint;
317 const G4StepPoint * preStepPoint = currentStep->GetPreStepPoint();
318 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
320 const G4TouchableHistory * theTouchable=(
const G4TouchableHistory *)
321 (preStepPoint->GetTouchable());
323 G4int
depth = theTouchable->GetHistory()->GetDepth();
324 G4ThreeVector localCoordinates = theTouchable->GetHistory()
325 ->GetTransform(depth-levelsUp).TransformPoint(globalCoordinates);
332 const G4StepPoint * postStepPoint = currentStep->GetPostStepPoint();
333 const G4StepPoint * preStepPoint = currentStep->GetPreStepPoint();
334 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
336 const G4TouchableHistory * theTouchable = (
const G4TouchableHistory *)
337 (preStepPoint->GetTouchable());
339 G4int
depth = theTouchable->GetHistory()->GetDepth();
340 G4ThreeVector localCoordinates = theTouchable->GetHistory()
341 ->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