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"
29 LogDebug(
"FiberSim") <<
"HFChamberSD : Initialize called for " << GetName();
38 double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
39 int trackID = aStep->GetTrack()->GetTrackID();
40 if (
charge == 0. || trackID != 1 || aStep->GetTrack()->GetParentID() != 0 ||
41 aStep->GetTrack()->GetCreatorProcess() !=
nullptr)
46 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
47 const G4VTouchable* touch = preStepPoint->GetTouchable();
50 double edep = aStep->GetTotalEnergyDeposit();
51 double time = (preStepPoint->GetGlobalTime()) / ns;
53 const G4ThreeVector& globalPos = preStepPoint->GetPosition();
54 G4ThreeVector localPos = touch->GetHistory()->GetTopTransform().TransformPoint(globalPos);
55 const G4DynamicParticle* particle = aStep->GetTrack()->GetDynamicParticle();
56 const G4ThreeVector& momDir = particle->GetMomentumDirection();
63 LogDebug(
"FiberSim") <<
"HFChamberSD: Hit created in (" << touch->GetVolume(0)->GetLogicalVolume()->GetName() <<
") "
64 <<
" ID " << detID <<
" Track " << trackID <<
" Edep: " << edep /
MeV <<
" MeV; Time: " <<
time
65 <<
" ns; Position (local) " << localPos <<
" (global ) " << globalPos <<
" direction " << momDir;
72 LogDebug(
"FiberSim") <<
"HFChamberSD: Sees" <<
theHC->entries() <<
" hits";
85 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
86 return (touch->GetReplicaNumber(0));