CMS 3D CMS Logo

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

#include <TrackWithHistory.h>

Public Member Functions

const G4VProcess * creatorProcess () const
 
bool crossedBoundary () const
 
int genParticleID () const
 
int getIDAtBoundary () const
 
const math::XYZTLorentzVectorFgetMomentumAtBoundary () const
 
const math::XYZTLorentzVectorFgetPositionAtBoundary () const
 
double globalTime () const
 
double localTime () const
 
const math::XYZVectorDmomentum () const
 
void operator delete (void *TrackWithHistory)
 
void * operator new (size_t)
 
int parentID () const
 
int particleID () const
 
double properTime () 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 setToBeSaved ()
 
void setTrackID (int i)
 
bool storeTrack () const
 
double totalEnergy () const
 
unsigned int trackID () const
 
 TrackWithHistory (const G4Track *g4track)
 
const math::XYZVectorDvertexPosition () const
 
double weight () const
 
 ~TrackWithHistory ()=default
 

Private Attributes

const G4VProcess * creatorProcess_
 
bool crossedBoundary_ {false}
 
int genParticleID_ {-1}
 
double globalTime_
 
int idAtBoundary_ {-1}
 
double localTime_
 
math::XYZVectorD momentum_
 
math::XYZTLorentzVectorF momentumAtBoundary_ {math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)}
 
int parentID_
 
int particleID_
 
math::XYZTLorentzVectorF positionAtBoundary_ {math::XYZTLorentzVectorF(0.f, 0.f, 0.f, 0.f)}
 
double properTime_
 
bool saved_ {false}
 
bool storeTrack_
 
double totalEnergy_
 
unsigned int trackID_
 
math::XYZVectorD vertexPosition_
 
double weight_
 

Detailed Description

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

Definition at line 16 of file TrackWithHistory.h.

Constructor & Destructor Documentation

◆ TrackWithHistory()

TrackWithHistory::TrackWithHistory ( const G4Track *  g4track)

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

Definition at line 19 of file TrackWithHistory.cc.

References creatorProcess_, genParticleID_, globalTime_, localTime_, LogDebug, momentum_, parentID_, G4TrackToParticleID::particleID(), particleID_, properTime_, TrackInformation::storeTrack(), storeTrack_, totalEnergy_, trackID_, vertexPosition_, and weight_.

19  {
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
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 *)
#define LogDebug(id)

◆ ~TrackWithHistory()

TrackWithHistory::~TrackWithHistory ( )
default

Member Function Documentation

◆ creatorProcess()

const G4VProcess* TrackWithHistory::creatorProcess ( ) const
inline

Definition at line 38 of file TrackWithHistory.h.

References creatorProcess_.

Referenced by SimTrackManager::getOrCreateVertex().

38 { return creatorProcess_; }
const G4VProcess * creatorProcess_

◆ crossedBoundary()

bool TrackWithHistory::crossedBoundary ( ) const
inline

Definition at line 55 of file TrackWithHistory.h.

References crossedBoundary_.

55 { return crossedBoundary_; }

◆ genParticleID()

int TrackWithHistory::genParticleID ( ) const
inline

Definition at line 31 of file TrackWithHistory.h.

References genParticleID_.

31 { return genParticleID_; }

◆ getIDAtBoundary()

int TrackWithHistory::getIDAtBoundary ( ) const
inline

Definition at line 58 of file TrackWithHistory.h.

References idAtBoundary_.

58 { return idAtBoundary_; }

◆ getMomentumAtBoundary()

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

Definition at line 57 of file TrackWithHistory.h.

References momentumAtBoundary_.

57 { return momentumAtBoundary_; }
math::XYZTLorentzVectorF momentumAtBoundary_

◆ getPositionAtBoundary()

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

Definition at line 56 of file TrackWithHistory.h.

References positionAtBoundary_.

56 { return positionAtBoundary_; }
math::XYZTLorentzVectorF positionAtBoundary_

◆ globalTime()

double TrackWithHistory::globalTime ( ) const
inline

Definition at line 35 of file TrackWithHistory.h.

References globalTime_.

Referenced by SimTrackManager::getOrCreateVertex().

35 { return globalTime_; }

◆ localTime()

double TrackWithHistory::localTime ( ) const
inline

Definition at line 36 of file TrackWithHistory.h.

References localTime_.

36 { return localTime_; }

◆ momentum()

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

Definition at line 32 of file TrackWithHistory.h.

References momentum_.

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

32 { return momentum_; }
math::XYZVectorD momentum_

◆ operator delete()

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

Definition at line 90 of file TrackWithHistory.h.

References fpTrackWithHistoryAllocator.

90  {
91  fpTrackWithHistoryAllocator->FreeSingle((TrackWithHistory *)aTwH);
92 }
G4ThreadLocal G4Allocator< TrackWithHistory > * fpTrackWithHistoryAllocator

◆ operator new()

void * TrackWithHistory::operator new ( size_t  )
inline

Definition at line 84 of file TrackWithHistory.h.

References fpTrackWithHistoryAllocator.

84  {
86  fpTrackWithHistoryAllocator = new G4Allocator<TrackWithHistory>;
87  return (void *)fpTrackWithHistoryAllocator->MallocSingle();
88 }
G4ThreadLocal G4Allocator< TrackWithHistory > * fpTrackWithHistoryAllocator

◆ parentID()

int TrackWithHistory::parentID ( ) const
inline

◆ particleID()

int TrackWithHistory::particleID ( ) const
inline

Definition at line 29 of file TrackWithHistory.h.

References particleID_.

29 { return particleID_; }

◆ properTime()

double TrackWithHistory::properTime ( ) const
inline

Definition at line 37 of file TrackWithHistory.h.

References properTime_.

37 { return properTime_; }

◆ saved()

bool TrackWithHistory::saved ( ) const
inline

Definition at line 44 of file TrackWithHistory.h.

References saved_.

Referenced by TrackingAction::PostUserTrackingAction().

44 { return saved_; }

◆ setCrossedBoundaryPosMom()

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

Definition at line 47 of file TrackWithHistory.h.

References crossedBoundary_, l1ctLayer2EG_cff::id, idAtBoundary_, momentum(), momentumAtBoundary_, position, and positionAtBoundary_.

Referenced by TrackingAction::PostUserTrackingAction().

49  {
50  crossedBoundary_ = true;
51  idAtBoundary_ = id;
54  }
const math::XYZVectorD & momentum() const
math::XYZTLorentzVectorF positionAtBoundary_
math::XYZTLorentzVectorF momentumAtBoundary_
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ setGenParticleID()

void TrackWithHistory::setGenParticleID ( int  i)
inline

Definition at line 42 of file TrackWithHistory.h.

References genParticleID_, and mps_fire::i.

◆ setParentID()

void TrackWithHistory::setParentID ( int  i)
inline

Definition at line 41 of file TrackWithHistory.h.

References mps_fire::i, and parentID_.

◆ setToBeSaved()

void TrackWithHistory::setToBeSaved ( )
inline

◆ setTrackID()

void TrackWithHistory::setTrackID ( int  i)
inline

Definition at line 40 of file TrackWithHistory.h.

References mps_fire::i, and trackID_.

40 { trackID_ = i; }
unsigned int trackID_

◆ storeTrack()

bool TrackWithHistory::storeTrack ( ) const
inline

Definition at line 43 of file TrackWithHistory.h.

References storeTrack_.

43 { return storeTrack_; }

◆ totalEnergy()

double TrackWithHistory::totalEnergy ( ) const
inline

Definition at line 33 of file TrackWithHistory.h.

References totalEnergy_.

33 { return totalEnergy_; }

◆ trackID()

unsigned int TrackWithHistory::trackID ( ) const
inline

Definition at line 28 of file TrackWithHistory.h.

References trackID_.

Referenced by SimTrackManager::addTrack(), trkIDLess::operator()(), and CaloSD::update().

28 { return trackID_; }
unsigned int trackID_

◆ vertexPosition()

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

Definition at line 34 of file TrackWithHistory.h.

References vertexPosition_.

Referenced by SimTrackManager::getOrCreateVertex().

34 { return vertexPosition_; }
math::XYZVectorD vertexPosition_

◆ weight()

double TrackWithHistory::weight ( ) const
inline

Definition at line 39 of file TrackWithHistory.h.

References weight_.

39 { return weight_; }

Member Data Documentation

◆ creatorProcess_

const G4VProcess* TrackWithHistory::creatorProcess_
private

Definition at line 71 of file TrackWithHistory.h.

Referenced by creatorProcess(), and TrackWithHistory().

◆ crossedBoundary_

bool TrackWithHistory::crossedBoundary_ {false}
private

Definition at line 76 of file TrackWithHistory.h.

Referenced by crossedBoundary(), and setCrossedBoundaryPosMom().

◆ genParticleID_

int TrackWithHistory::genParticleID_ {-1}
private

Definition at line 64 of file TrackWithHistory.h.

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

◆ globalTime_

double TrackWithHistory::globalTime_
private

Definition at line 68 of file TrackWithHistory.h.

Referenced by globalTime(), and TrackWithHistory().

◆ idAtBoundary_

int TrackWithHistory::idAtBoundary_ {-1}
private

Definition at line 77 of file TrackWithHistory.h.

Referenced by getIDAtBoundary(), and setCrossedBoundaryPosMom().

◆ localTime_

double TrackWithHistory::localTime_
private

Definition at line 69 of file TrackWithHistory.h.

Referenced by localTime(), and TrackWithHistory().

◆ momentum_

math::XYZVectorD TrackWithHistory::momentum_
private

Definition at line 65 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 79 of file TrackWithHistory.h.

Referenced by getMomentumAtBoundary(), and setCrossedBoundaryPosMom().

◆ parentID_

int TrackWithHistory::parentID_
private

Definition at line 63 of file TrackWithHistory.h.

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

◆ particleID_

int TrackWithHistory::particleID_
private

Definition at line 62 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 78 of file TrackWithHistory.h.

Referenced by getPositionAtBoundary(), and setCrossedBoundaryPosMom().

◆ properTime_

double TrackWithHistory::properTime_
private

Definition at line 70 of file TrackWithHistory.h.

Referenced by properTime(), and TrackWithHistory().

◆ saved_

bool TrackWithHistory::saved_ {false}
private

Definition at line 74 of file TrackWithHistory.h.

Referenced by saved(), and setToBeSaved().

◆ storeTrack_

bool TrackWithHistory::storeTrack_
private

Definition at line 73 of file TrackWithHistory.h.

Referenced by storeTrack(), and TrackWithHistory().

◆ totalEnergy_

double TrackWithHistory::totalEnergy_
private

Definition at line 66 of file TrackWithHistory.h.

Referenced by totalEnergy(), and TrackWithHistory().

◆ trackID_

unsigned int TrackWithHistory::trackID_
private

Definition at line 61 of file TrackWithHistory.h.

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

◆ vertexPosition_

math::XYZVectorD TrackWithHistory::vertexPosition_
private

Definition at line 67 of file TrackWithHistory.h.

Referenced by TrackWithHistory(), and vertexPosition().

◆ weight_

double TrackWithHistory::weight_
private

Definition at line 72 of file TrackWithHistory.h.

Referenced by TrackWithHistory(), and weight().