CMS 3D CMS Logo

TrackWithHistory.cc
Go to the documentation of this file.
5 
7 
8 #include "G4VProcess.hh"
9 #include "G4DynamicParticle.hh"
10 #include "G4PrimaryParticle.hh"
11 #include "G4ThreeVector.hh"
12 
13 #include <iostream>
14 
15 G4ThreadLocal G4Allocator<TrackWithHistory>* fpTrackWithHistoryAllocator = nullptr;
16 
17 //#define DEBUG
18 
19 TrackWithHistory::TrackWithHistory(const G4Track* g4trk) {
20  trackID_ = g4trk->GetTrackID();
22  parentID_ = g4trk->GetParentID();
23  auto mom = g4trk->GetMomentum();
24  momentum_ = math::XYZVectorD(mom.x(), mom.y(), mom.z());
25  totalEnergy_ = g4trk->GetTotalEnergy();
26  auto pos = g4trk->GetPosition();
27  vertexPosition_ = math::XYZVectorD(pos.x(), pos.y(), pos.z());
28  globalTime_ = g4trk->GetGlobalTime();
29  localTime_ = g4trk->GetLocalTime();
30  properTime_ = g4trk->GetProperTime();
31  creatorProcess_ = g4trk->GetCreatorProcess();
32  TrackInformation* trkinfo = static_cast<TrackInformation*>(g4trk->GetUserInformation());
33  storeTrack_ = trkinfo->storeTrack();
34  auto vgprimary = g4trk->GetDynamicParticle()->GetPrimaryParticle();
35  if (vgprimary != nullptr) {
36  auto priminfo = static_cast<GenParticleInfo*>(vgprimary->GetUserInformation());
37  if (nullptr != priminfo) {
38  genParticleID_ = priminfo->id();
39  }
40  }
41  // V.I. weight is computed in the same way as before
42  // without usage of G4Track::GetWeight()
43  weight_ = 10000 * genParticleID_;
44 #ifdef DEBUG
45  LogDebug("TrackInformation") << " TrackWithHistory : created history for " << trackID_ << " with mother "
46  << parentID_;
47 #endif
48 }
const G4VProcess * creatorProcess_
bool storeTrack() const
G4ThreadLocal G4Allocator< TrackWithHistory > * fpTrackWithHistoryAllocator
math::XYZVectorD vertexPosition_
math::XYZVectorD momentum_
unsigned int trackID_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
static int particleID(const G4Track *)
TrackWithHistory(const G4Track *g4track)
#define LogDebug(id)