9 #include "G4DecayProducts.hh"
10 #include "G4VProcess.hh"
11 #include "G4SystemOfUnits.hh"
14 #include "EVENT/MCParticle.h"
16 using EVENT::MCParticle;
17 using EVENT::MCParticleVec;
26 _parent(NULL), _toBeSaved(toBeSaved), _backScattering(backScattering), _mcparticle(NULL), _hasTrackerHit(false), _mcParticleIsUpToDate(false), _trackLength(0), _hepEvtStatus(0) {
29 _charge = track->GetDefinition()->GetPDGCharge();
30 _mass = track->GetDynamicParticle()->GetMass();
31 _PDG = track->GetDefinition()->GetPDGEncoding();
37 _energy = track->GetTotalEnergy();
60 _vertex = track->GetVertexPosition();
71 const G4DecayProducts* preAssignedDecayProducts = track->GetDynamicParticle()->GetPreAssignedDecayProducts();
72 if (preAssignedDecayProducts && preAssignedDecayProducts->entries() > 0)
87 const G4Step* lastStep = track->GetStep();
88 G4StepPoint* lastPostStepPoint = NULL;
90 lastPostStepPoint = lastStep->GetPostStepPoint();
99 G4bool leftDetector =
false;
100 if (lastPostStepPoint) {
102 if ((leftDetector = (lastPostStepPoint->GetStepStatus() == fWorldBoundary))) {
108 if (track->GetKineticEnergy() <= 0.)
113 if (insideTrackerRegion)
114 _simstatus[MCParticle::BITDecayedInTracker] = 1;
118 if (!insideTrackerRegion && !leftDetector)
119 _simstatus[MCParticle::BITDecayedInCalorimeter] = 1;
126 _simstatus[MCParticle::BITVertexIsNotEndpointOfParent] = 1;
157 const MCParticleVec& parents =
_mcparticle->getParents();
160 if (std::find(parents.begin(), parents.end(), theParentMCParticle) == parents.end()) {
170 G4cout <<
"WARNING: no parent track ID " << this->
getParentID() <<
" found for " << this->
getTrackID() << G4endl;
189 _simstatus[MCParticle::BITCreatedInSimulation] = 1;
213 p[0] = momentum(0) / GeV;
214 p[1] = momentum(1) / GeV;
215 p[2] = momentum(2) / GeV;
229 float momentumAtEndpoint[3];
233 _mcparticle->setMomentumAtEndpoint(momentumAtEndpoint);
static TrackManager * instance()
Manages access to stored track information used for MCParticle output.
TrackSummary * findTrackSummary(G4int trackID)
Container for all information from G4Track that may be persisted to MCParticle output collection.
G4double getCharge() const
G4int getSimulatorStatus() const
void update(const G4Track *track)
MCParticleImpl * getMCParticle()
TrackSummary(const G4Track *track, G4bool toBeSaved, G4bool backScattering=false)
G4bool _mcParticleIsUpToDate
G4ThreeVector getEndPoint() const
G4ThreeVector _momentumAtEndpoint
void setParentToBeSaved()
G4int getParentID() const
std::bitset< 32 > _simstatus
const G4ThreeVector & getVertex() const
G4ThreeVector getMomentum() const
static TrackManager * m_trackManager
TrackSummary * findParent() const
MCParticleImpl * _mcparticle
G4bool getBackScattering() const
G4int getHepEvtStatus() const
static UserRegionInformation * getRegionInformation(const G4Track *track)
G4Allocator< TrackSummary > TrackSummaryAllocator