CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackWithHistory Class Reference

#include <TrackWithHistory.h>

Public Member Functions

bool crossedBoundary () const
 
int genParticleID () const
 
int getIDAtBoundary () const
 
const math::XYZTLorentzVectorFgetMomentumAtBoundary () const
 
const math::XYZTLorentzVectorFgetPositionAtBoundary () const
 
const math::XYZVectorDmomentum () const
 
void operator delete (void *TrackWithHistory)
 
void * operator new (std::size_t)
 
int parentID () const
 
int particleID () const
 
int processType () const
 
bool saved () const
 
void setCrossedBoundaryPosMom (int id, const math::XYZTLorentzVectorF &position, const math::XYZTLorentzVectorF &momentum)
 
void setGenParticleID (int i)
 
void setParentID (int i)
 
void setSurfacePosMom (const math::XYZVectorD &pos, const math::XYZTLorentzVectorD &mom)
 
void setToBeSaved ()
 
void setTrackID (int i)
 
void setVertexID (int i)
 
bool storeTrack () const
 
double time () const
 
double totalEnergy () const
 
const math::XYZTLorentzVectorDtrackerSurfaceMomentum () const
 
const math::XYZVectorDtrackerSurfacePosition () const
 
int trackID () const
 
 TrackWithHistory (const G4Track *g4track, int pID)
 
 TrackWithHistory (const G4PrimaryParticle *, int trackID, const math::XYZVectorD &pos, const double time)
 
int vertexID () const
 
const math::XYZVectorDvertexPosition () const
 
double weight () const
 
 ~TrackWithHistory ()=default
 

Private Attributes

bool crossedBoundary_ {false}
 
int genParticleID_ {-1}
 
int idAtBoundary_ {-1}
 
math::XYZVectorD momentum_
 
math::XYZTLorentzVectorF momentumAtBoundary_ {math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)}
 
int parentID_
 
int pdgID_
 
math::XYZTLorentzVectorF positionAtBoundary_ {math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)}
 
int procType_ {0}
 
bool saved_ {false}
 
bool storeTrack_ {false}
 
double time_
 
math::XYZTLorentzVectorD tkSurfaceMomentum_ {math::XYZTLorentzVectorD(0., 0., 0., 0.)}
 
math::XYZVectorD tkSurfacePosition_ {math::XYZVectorD(0., 0., 0.)}
 
double totalEnergy_
 
int trackID_
 
int vertexID_ {-1}
 
math::XYZVectorD vertexPosition_
 
double weight_
 

Detailed Description

The part of the information about a SimTrack that we need from a G4Track

Definition at line 15 of file TrackWithHistory.h.

Constructor & Destructor Documentation

◆ TrackWithHistory() [1/2]

TrackWithHistory::TrackWithHistory ( const G4Track *  g4track,
int  pID 
)

The constructor is called at time, when some of the information may not available yet.

Definition at line 17 of file TrackWithHistory.cc.

References genParticleID_, momentum_, AlCaHLTBitMon_ParallelJobs::p, parentID_, G4TrackToParticleID::particleID(), pdgID_, procType_, TrackInformation::storeTrack(), storeTrack_, time_, totalEnergy_, trackID_, vertexPosition_, and weight_.

17  {
18  trackID_ = g4trk->GetTrackID();
20  parentID_ = pID;
21  auto mom = g4trk->GetMomentum();
22  momentum_ = math::XYZVectorD(mom.x(), mom.y(), mom.z());
23  totalEnergy_ = g4trk->GetTotalEnergy();
24  auto pos = g4trk->GetPosition();
25  vertexPosition_ = math::XYZVectorD(pos.x(), pos.y(), pos.z());
26  time_ = g4trk->GetGlobalTime();
27  auto p = g4trk->GetCreatorProcess();
28  procType_ = (nullptr != p) ? p->GetProcessSubType() : 0;
29  TrackInformation* trkinfo = static_cast<TrackInformation*>(g4trk->GetUserInformation());
30  storeTrack_ = trkinfo->storeTrack();
31  auto vgprimary = g4trk->GetDynamicParticle()->GetPrimaryParticle();
32  if (vgprimary != nullptr) {
33  auto priminfo = static_cast<GenParticleInfo*>(vgprimary->GetUserInformation());
34  if (nullptr != priminfo) {
35  genParticleID_ = priminfo->id();
36  }
37  }
38  // V.I. weight is computed in the same way as before
39  // without usage of G4Track::GetWeight()
40  weight_ = 10000 * genParticleID_;
41 }
bool storeTrack() const
math::XYZVectorD vertexPosition_
math::XYZVectorD momentum_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
static int particleID(const G4Track *)

◆ TrackWithHistory() [2/2]

TrackWithHistory::TrackWithHistory ( const G4PrimaryParticle *  ptr,
int  trackID,
const math::XYZVectorD pos,
const double  time 
)

Definition at line 43 of file TrackWithHistory.cc.

References genParticleID_, momentum_, parentID_, G4TrackToParticleID::particleID(), pdgID_, storeTrack_, time(), time_, totalEnergy_, trackID(), trackID_, vertexPosition_, and weight_.

43  {
44  trackID_ = trackID;
47  auto mom = ptr->GetMomentum();
48  momentum_ = math::XYZVectorD(mom.x(), mom.y(), mom.z());
49  totalEnergy_ = ptr->GetTotalEnergy();
50  vertexPosition_ = math::XYZVectorD(pos.x(), pos.y(), pos.z());
51  time_ = time;
52  storeTrack_ = true;
53  auto priminfo = static_cast<GenParticleInfo*>(ptr->GetUserInformation());
54  if (nullptr != priminfo) {
55  genParticleID_ = priminfo->id();
56  }
57  weight_ = 10000. * genParticleID_;
58 }
math::XYZVectorD vertexPosition_
math::XYZVectorD momentum_
double time() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
static int particleID(const G4Track *)
int trackID() const

◆ ~TrackWithHistory()

TrackWithHistory::~TrackWithHistory ( )
default

Member Function Documentation

◆ crossedBoundary()

bool TrackWithHistory::crossedBoundary ( ) const
inline

Definition at line 46 of file TrackWithHistory.h.

References crossedBoundary_.

46 { return crossedBoundary_; }

◆ genParticleID()

int TrackWithHistory::genParticleID ( ) const
inline

Definition at line 30 of file TrackWithHistory.h.

References genParticleID_.

30 { return genParticleID_; }

◆ getIDAtBoundary()

int TrackWithHistory::getIDAtBoundary ( ) const
inline

Definition at line 33 of file TrackWithHistory.h.

References idAtBoundary_.

33 { return idAtBoundary_; }

◆ getMomentumAtBoundary()

const math::XYZTLorentzVectorF& TrackWithHistory::getMomentumAtBoundary ( ) const
inline

Definition at line 61 of file TrackWithHistory.h.

References momentumAtBoundary_.

61 { return momentumAtBoundary_; }
math::XYZTLorentzVectorF momentumAtBoundary_

◆ getPositionAtBoundary()

const math::XYZTLorentzVectorF& TrackWithHistory::getPositionAtBoundary ( ) const
inline

Definition at line 60 of file TrackWithHistory.h.

References positionAtBoundary_.

60 { return positionAtBoundary_; }
math::XYZTLorentzVectorF positionAtBoundary_

◆ momentum()

const math::XYZVectorD& TrackWithHistory::momentum ( ) const
inline

Definition at line 48 of file TrackWithHistory.h.

References momentum_.

Referenced by CaloSD::createNewHit(), and setCrossedBoundaryPosMom().

48 { return momentum_; }
math::XYZVectorD momentum_

◆ operator delete()

void TrackWithHistory::operator delete ( void *  TrackWithHistory)
inline

Definition at line 101 of file TrackWithHistory.h.

References fpTrackWithHistoryAllocator.

101  {
102  fpTrackWithHistoryAllocator->FreeSingle((TrackWithHistory *)aTwH);
103 }
G4ThreadLocal G4Allocator< TrackWithHistory > * fpTrackWithHistoryAllocator

◆ operator new()

void * TrackWithHistory::operator new ( std::size_t  )
inline

Definition at line 95 of file TrackWithHistory.h.

References fpTrackWithHistoryAllocator.

95  {
97  fpTrackWithHistoryAllocator = new G4Allocator<TrackWithHistory>;
98  return (void *)fpTrackWithHistoryAllocator->MallocSingle();
99 }
G4ThreadLocal G4Allocator< TrackWithHistory > * fpTrackWithHistoryAllocator

◆ parentID()

int TrackWithHistory::parentID ( ) const
inline

◆ particleID()

int TrackWithHistory::particleID ( ) const
inline

Definition at line 28 of file TrackWithHistory.h.

References pdgID_.

28 { return pdgID_; }

◆ processType()

int TrackWithHistory::processType ( ) const
inline

Definition at line 32 of file TrackWithHistory.h.

References procType_.

Referenced by SimTrackManager::getOrCreateVertex().

32 { return procType_; }

◆ saved()

bool TrackWithHistory::saved ( ) const
inline

Definition at line 45 of file TrackWithHistory.h.

References saved_.

Referenced by TrackingAction::PostUserTrackingAction().

45 { return saved_; }

◆ setCrossedBoundaryPosMom()

void TrackWithHistory::setCrossedBoundaryPosMom ( int  id,
const math::XYZTLorentzVectorF position,
const math::XYZTLorentzVectorF momentum 
)
inline

◆ setGenParticleID()

void TrackWithHistory::setGenParticleID ( int  i)
inline

Definition at line 38 of file TrackWithHistory.h.

References genParticleID_, and mps_fire::i.

◆ setParentID()

void TrackWithHistory::setParentID ( int  i)
inline

Definition at line 36 of file TrackWithHistory.h.

References mps_fire::i, and parentID_.

◆ setSurfacePosMom()

void TrackWithHistory::setSurfacePosMom ( const math::XYZVectorD pos,
const math::XYZTLorentzVectorD mom 
)
inline

Definition at line 66 of file TrackWithHistory.h.

References tkSurfaceMomentum_, and tkSurfacePosition_.

66  {
68  tkSurfaceMomentum_ = mom;
69  }
math::XYZTLorentzVectorD tkSurfaceMomentum_
math::XYZVectorD tkSurfacePosition_

◆ setToBeSaved()

void TrackWithHistory::setToBeSaved ( )
inline

◆ setTrackID()

void TrackWithHistory::setTrackID ( int  i)
inline

Definition at line 35 of file TrackWithHistory.h.

References mps_fire::i, and trackID_.

◆ setVertexID()

void TrackWithHistory::setVertexID ( int  i)
inline

Definition at line 37 of file TrackWithHistory.h.

References mps_fire::i, and vertexID_.

◆ storeTrack()

bool TrackWithHistory::storeTrack ( ) const
inline

Definition at line 44 of file TrackWithHistory.h.

References storeTrack_.

44 { return storeTrack_; }

◆ time()

double TrackWithHistory::time ( ) const
inline

Definition at line 41 of file TrackWithHistory.h.

References time_.

Referenced by SimTrackManager::getOrCreateVertex(), and TrackWithHistory().

41 { return time_; }

◆ totalEnergy()

double TrackWithHistory::totalEnergy ( ) const
inline

Definition at line 40 of file TrackWithHistory.h.

References totalEnergy_.

40 { return totalEnergy_; }

◆ trackerSurfaceMomentum()

const math::XYZTLorentzVectorD& TrackWithHistory::trackerSurfaceMomentum ( ) const
inline

Definition at line 65 of file TrackWithHistory.h.

References tkSurfaceMomentum_.

65 { return tkSurfaceMomentum_; }
math::XYZTLorentzVectorD tkSurfaceMomentum_

◆ trackerSurfacePosition()

const math::XYZVectorD& TrackWithHistory::trackerSurfacePosition ( ) const
inline

Definition at line 64 of file TrackWithHistory.h.

References tkSurfacePosition_.

64 { return tkSurfacePosition_; }
math::XYZVectorD tkSurfacePosition_

◆ trackID()

int TrackWithHistory::trackID ( ) const
inline

◆ vertexID()

int TrackWithHistory::vertexID ( ) const
inline

Definition at line 31 of file TrackWithHistory.h.

References vertexID_.

31 { return vertexID_; }

◆ vertexPosition()

const math::XYZVectorD& TrackWithHistory::vertexPosition ( ) const
inline

Definition at line 49 of file TrackWithHistory.h.

References vertexPosition_.

Referenced by SimTrackManager::getOrCreateVertex().

49 { return vertexPosition_; }
math::XYZVectorD vertexPosition_

◆ weight()

double TrackWithHistory::weight ( ) const
inline

Definition at line 42 of file TrackWithHistory.h.

References weight_.

42 { return weight_; }

Member Data Documentation

◆ crossedBoundary_

bool TrackWithHistory::crossedBoundary_ {false}
private

Definition at line 90 of file TrackWithHistory.h.

Referenced by crossedBoundary(), and setCrossedBoundaryPosMom().

◆ genParticleID_

int TrackWithHistory::genParticleID_ {-1}
private

Definition at line 75 of file TrackWithHistory.h.

Referenced by genParticleID(), setGenParticleID(), and TrackWithHistory().

◆ idAtBoundary_

int TrackWithHistory::idAtBoundary_ {-1}
private

Definition at line 77 of file TrackWithHistory.h.

Referenced by getIDAtBoundary(), and setCrossedBoundaryPosMom().

◆ momentum_

math::XYZVectorD TrackWithHistory::momentum_
private

Definition at line 82 of file TrackWithHistory.h.

Referenced by momentum(), and TrackWithHistory().

◆ momentumAtBoundary_

math::XYZTLorentzVectorF TrackWithHistory::momentumAtBoundary_ {math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)}
private

Definition at line 85 of file TrackWithHistory.h.

Referenced by getMomentumAtBoundary(), and setCrossedBoundaryPosMom().

◆ parentID_

int TrackWithHistory::parentID_
private

Definition at line 74 of file TrackWithHistory.h.

Referenced by parentID(), setParentID(), and TrackWithHistory().

◆ pdgID_

int TrackWithHistory::pdgID_
private

Definition at line 73 of file TrackWithHistory.h.

Referenced by particleID(), and TrackWithHistory().

◆ positionAtBoundary_

math::XYZTLorentzVectorF TrackWithHistory::positionAtBoundary_ {math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)}
private

Definition at line 84 of file TrackWithHistory.h.

Referenced by getPositionAtBoundary(), and setCrossedBoundaryPosMom().

◆ procType_

int TrackWithHistory::procType_ {0}
private

Definition at line 78 of file TrackWithHistory.h.

Referenced by processType(), and TrackWithHistory().

◆ saved_

bool TrackWithHistory::saved_ {false}
private

Definition at line 89 of file TrackWithHistory.h.

Referenced by saved(), and setToBeSaved().

◆ storeTrack_

bool TrackWithHistory::storeTrack_ {false}
private

Definition at line 88 of file TrackWithHistory.h.

Referenced by storeTrack(), and TrackWithHistory().

◆ time_

double TrackWithHistory::time_
private

Definition at line 80 of file TrackWithHistory.h.

Referenced by time(), and TrackWithHistory().

◆ tkSurfaceMomentum_

math::XYZTLorentzVectorD TrackWithHistory::tkSurfaceMomentum_ {math::XYZTLorentzVectorD(0., 0., 0., 0.)}
private

Definition at line 87 of file TrackWithHistory.h.

Referenced by setSurfacePosMom(), and trackerSurfaceMomentum().

◆ tkSurfacePosition_

math::XYZVectorD TrackWithHistory::tkSurfacePosition_ {math::XYZVectorD(0., 0., 0.)}
private

Definition at line 86 of file TrackWithHistory.h.

Referenced by setSurfacePosMom(), and trackerSurfacePosition().

◆ totalEnergy_

double TrackWithHistory::totalEnergy_
private

Definition at line 79 of file TrackWithHistory.h.

Referenced by totalEnergy(), and TrackWithHistory().

◆ trackID_

int TrackWithHistory::trackID_
private

Definition at line 72 of file TrackWithHistory.h.

Referenced by setTrackID(), trackID(), and TrackWithHistory().

◆ vertexID_

int TrackWithHistory::vertexID_ {-1}
private

Definition at line 76 of file TrackWithHistory.h.

Referenced by setVertexID(), and vertexID().

◆ vertexPosition_

math::XYZVectorD TrackWithHistory::vertexPosition_
private

Definition at line 83 of file TrackWithHistory.h.

Referenced by TrackWithHistory(), and vertexPosition().

◆ weight_

double TrackWithHistory::weight_
private

Definition at line 81 of file TrackWithHistory.h.

Referenced by TrackWithHistory(), and weight().