18#include "BDSHitEnergyDepositionGlobal.hh"
19#include "BDSSDEnergyDepositionGlobal.hh"
21#include "BDSGlobalConstants.hh"
22#include "BDSUtilities.hh"
26#include "G4LogicalVolume.hh"
27#include "G4ParticleDefinition.hh"
28#include "G4SDManager.hh"
30#include "G4ThreeVector.hh"
32#include "Randomize.hh"
34BDSSDEnergyDepositionGlobal::BDSSDEnergyDepositionGlobal(
const G4String& name,
35 G4bool killedParticleMassAddedToElossIn):
37 killedParticleMassAddedToEloss(killedParticleMassAddedToElossIn),
42 preStepKineticEnergy(0),
43 postStepKineticEnergy(0),
55 collectionName.insert(colName);
58BDSSDEnergyDepositionGlobal::~BDSSDEnergyDepositionGlobal()
61void BDSSDEnergyDepositionGlobal::Initialize(G4HCofThisEvent* HCE)
65 {HCIDe = G4SDManager::GetSDMpointer()->GetCollectionID(hits);}
66 HCE->AddHitsCollection(HCIDe, hits);
69 G4cout << __METHOD_NAME__ <<
"Hits Collection ID: " << HCIDe << G4endl;
77 energy = aStep->GetTotalEnergyDeposit();
84 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
85 G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
87 G4Track* track = aStep->GetTrack();
91 weight = track->GetWeight();
95 G4double randDist = G4UniformRand();
98 G4ThreeVector posbefore = preStepPoint->GetPosition();
99 G4ThreeVector posafter = postStepPoint->GetPosition();
100 G4ThreeVector eDepPos = posbefore + randDist*(posafter - posbefore);
111 G4double preGlobalTime = preStepPoint->GetGlobalTime();
112 G4double postGlobalTime = postStepPoint->GetGlobalTime();
113 globalTime = preGlobalTime + randDist * (postGlobalTime - preGlobalTime);
115 pdgID = track->GetDefinition()->GetPDGEncoding();
140 G4TouchableHistory* )
142 energy = killedParticleMassAddedToEloss ? track->GetTotalEnergy() : track->GetKineticEnergy();
151 const G4ThreeVector& posGlobal = track->GetPosition();
157 pdgID = track->GetDefinition()->GetPDGEncoding();
160 weight = track->GetWeight();
181 auto hitsVector = hits->GetVector();
182 if (hitsVector->empty())
187 return static_cast<G4VHit*
>(lastHit);
static BDSGlobalConstants * Instance()
Access method.
Information recorded for a step leaving a volume.
G4int trackID
Per hit variable.
G4int pdgID
Per hit variable.
G4int parentID
Per hit variable.
G4double globalTime
Per hit variable.
G4double stepLength
Per hit variable.
G4double postStepKineticEnergy
Per hit variable.
G4double weight
Per hit variable.
virtual G4VHit * last() const
Provide access to last hit.
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *th)
G4int turnsTaken
Per hit variable.
virtual G4bool ProcessHitsTrack(const G4Track *track, G4TouchableHistory *th)
G4double energy
Per hit variable.
G4double Z
Per hit variable.
G4double preStepKineticEnergy
Per hit variable.
G4double X
Per hit variable.
G4double Y
Per hit variable.
G4String colName
Collection name.
Virtual class to define interface for ordered multi-sensitive detector.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())
const char * GetName(int)
Name of element.