4 #include "G4VPhysicalVolume.hh"
5 #include "G4PVPlacement.hh"
6 #include "G4HCofThisEvent.hh"
7 #include "G4TouchableHistory.hh"
10 #include "G4VSolid.hh"
11 #include "G4DynamicParticle.hh"
12 #include "G4ParticleDefinition.hh"
13 #include "G4SDManager.hh"
16 #include "G4PhysicalConstants.hh"
17 #include "G4SystemOfUnits.hh"
31 edm::LogVerbatim(
"FiberSim") <<
"HFChamberSD : Initialize called for " << GetName() <<
" in collection " << HCE;
42 double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
43 int trackID = aStep->GetTrack()->GetTrackID();
44 if (
charge == 0. || trackID != 1 || aStep->GetTrack()->GetParentID() != 0 ||
45 aStep->GetTrack()->GetCreatorProcess() !=
nullptr)
50 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
51 const G4VTouchable* touch = preStepPoint->GetTouchable();
54 double edep = aStep->GetTotalEnergyDeposit();
55 double time = (preStepPoint->GetGlobalTime()) / ns;
57 const G4ThreeVector& globalPos = preStepPoint->GetPosition();
58 G4ThreeVector localPos = touch->GetHistory()->GetTopTransform().TransformPoint(globalPos);
59 const G4DynamicParticle* particle = aStep->GetTrack()->GetDynamicParticle();
60 const G4ThreeVector& momDir = particle->GetMomentumDirection();
67 edm::LogVerbatim(
"FiberSim") <<
"HFChamberSD: Hit created in (" << touch->GetVolume(0)->GetLogicalVolume()->GetName()
68 <<
") ID " << detID <<
" Track " << trackID <<
" Edep: " << edep /
CLHEP::MeV
69 <<
" MeV; Time: " <<
time <<
" ns; Position (local) " << localPos <<
" (global ) "
70 << globalPos <<
" direction " << momDir;
90 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
91 return (touch->GetReplicaNumber(0));