19#include "BDSHitEnergyDepositionGlobal.hh"
20#include "BDSSDEnergyDepositionGlobal.hh"
22#include "BDSGlobalConstants.hh"
23#include "BDSUtilities.hh"
27#include "G4LogicalVolume.hh"
28#include "G4ParticleDefinition.hh"
29#include "G4SDManager.hh"
31#include "G4ThreeVector.hh"
33#include "Randomize.hh"
35BDSSDEnergyDepositionGlobal::BDSSDEnergyDepositionGlobal(
const G4String& name,
36 G4bool killedParticleMassAddedToElossIn):
38 killedParticleMassAddedToEloss(killedParticleMassAddedToElossIn),
43 preStepKineticEnergy(0),
44 postStepKineticEnergy(0),
56 collectionName.insert(colName);
59BDSSDEnergyDepositionGlobal::~BDSSDEnergyDepositionGlobal()
62void BDSSDEnergyDepositionGlobal::Initialize(G4HCofThisEvent* HCE)
66 {HCIDe = G4SDManager::GetSDMpointer()->GetCollectionID(hits);}
67 HCE->AddHitsCollection(HCIDe, hits);
70 G4cout << __METHOD_NAME__ <<
"Hits Collection ID: " << HCIDe << G4endl;
78 energy = aStep->GetTotalEnergyDeposit();
85 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
86 G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
88 G4Track* track = aStep->GetTrack();
92 weight = track->GetWeight();
96 G4double randDist = G4UniformRand();
99 G4ThreeVector posbefore = preStepPoint->GetPosition();
100 G4ThreeVector posafter = postStepPoint->GetPosition();
101 G4ThreeVector eDepPos = posbefore + randDist*(posafter - posbefore);
112 G4double preGlobalTime = preStepPoint->GetGlobalTime();
113 G4double postGlobalTime = postStepPoint->GetGlobalTime();
114 globalTime = preGlobalTime + randDist * (postGlobalTime - preGlobalTime);
116 pdgID = track->GetDefinition()->GetPDGEncoding();
141 G4TouchableHistory* )
143 energy = killedParticleMassAddedToEloss ? track->GetTotalEnergy() : track->GetKineticEnergy();
152 const G4ThreeVector& posGlobal = track->GetPosition();
158 pdgID = track->GetDefinition()->GetPDGEncoding();
161 weight = track->GetWeight();
182 auto hitsVector = hits->GetVector();
183 if (hitsVector->empty())
188 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.