#include <TrackWithHistory.h>
Public Member Functions | |
void | checkAtEnd (const G4Track *) |
const G4VProcess * | creatorProcess () const |
int | genParticleID () const |
double | globalTime () const |
double | localTime () const |
const math::XYZVectorD & | momentum () const |
void | operator delete (void *TrackWithHistory) |
void * | operator new (size_t) |
int | parentID () const |
int | particleID () const |
double | properTime () const |
void | save () |
bool | saved () const |
void | setGenParticleID (int i) |
void | setParentID (int i) |
void | setTrackID (int i) |
bool | storeTrack () const |
double | totalEnergy () const |
unsigned int | trackID () const |
TrackWithHistory (const G4Track *g4track) | |
const math::XYZVectorD & | vertexPosition () const |
double | weight () const |
~TrackWithHistory () | |
Private Member Functions | |
int | extractGenID (const G4Track *gt) const |
Private Attributes | |
const G4VProcess * | creatorProcess_ |
int | genParticleID_ |
double | globalTime_ |
double | localTime_ |
math::XYZVectorD | momentum_ |
int | parentID_ |
int | particleID_ |
double | properTime_ |
bool | saved_ |
bool | storeTrack_ |
double | totalEnergy_ |
unsigned int | trackID_ |
math::XYZVectorD | vertexPosition_ |
double | weight_ |
Static Private Attributes | |
static G4TrackToParticleID * | theG4TrackToParticleID |
The part of the information about a SimTrack that we need from a G4Track
Definition at line 16 of file TrackWithHistory.h.
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_, extractGenID(), genParticleID_, globalTime_, localTime_, LogDebug, momentum_, parentID_, G4TrackToParticleID::particleID(), particleID_, properTime_, saved_, storeTrack_, theG4TrackToParticleID, totalEnergy_, trackID_, vertexPosition_, and weight_.
: trackID_(0),particleID_(0),parentID_(0),momentum_(math::XYZVectorD(0.,0.,0.)), totalEnergy_(0),vertexPosition_(math::XYZVectorD(0.,0.,0.)),globalTime_(0), localTime_(0),properTime_(0),creatorProcess_(0),weight_(0), storeTrack_(false),saved_(false) { if (theG4TrackToParticleID == 0) theG4TrackToParticleID = new G4TrackToParticleID; if (g4trk!=0) { TrackInformationExtractor extractor; trackID_ = g4trk->GetTrackID(); particleID_ = theG4TrackToParticleID->particleID(g4trk); parentID_ = g4trk->GetParentID(); momentum_ = math::XYZVectorD(g4trk->GetMomentum().x(),g4trk->GetMomentum().y(),g4trk->GetMomentum().z()); totalEnergy_ = g4trk->GetTotalEnergy(); vertexPosition_ = math::XYZVectorD(g4trk->GetPosition().x(),g4trk->GetPosition().y(),g4trk->GetPosition().z()); globalTime_ = g4trk->GetGlobalTime(); localTime_ = g4trk->GetLocalTime(); properTime_ = g4trk->GetProperTime(); creatorProcess_ = g4trk->GetCreatorProcess(); weight_ = g4trk->GetWeight(); storeTrack_ = extractor(g4trk).storeTrack(); saved_ = false; genParticleID_ = extractGenID( g4trk); #ifdef DEBUG LogDebug("TrackInformation") << " TrackWithHistory : created history for " << trackID_ << " with mother " << parentID_; #endif } }
TrackWithHistory::~TrackWithHistory | ( | ) | [inline] |
Definition at line 23 of file TrackWithHistory.h.
{}
void TrackWithHistory::checkAtEnd | ( | const G4Track * | gt | ) |
Internal consistency check (optional). Method called at PostUserTrackingAction time, to check if the information is consistent with that provided to the constructor.
Definition at line 49 of file TrackWithHistory.cc.
References epsilon, momentum_, convertSQLiteXML::ok, and vertexPosition_.
Referenced by TrackingAction::PostUserTrackingAction().
{ math::XYZVectorD vposdir(gt->GetVertexPosition().x(),gt->GetVertexPosition().y(),gt->GetVertexPosition().z()); math::XYZVectorD vmomdir(gt->GetVertexMomentumDirection().x(),gt->GetVertexMomentumDirection().y(),gt->GetVertexMomentumDirection().z()); bool ok = true; double epsilon = 1.e-6; double eps2 = epsilon*epsilon; if ((vertexPosition_-vposdir).Mag2() > eps2) { edm::LogWarning("TrackInformation") << "TrackWithHistory vertex position check failed" << "\nAt construction: " << vertexPosition_ << "\nAt end: " << vposdir; ok = false; } math::XYZVectorD dirDiff = momentum_.Unit() - vmomdir; if (dirDiff.Mag2() > eps2 && momentum_.Unit().R() > eps2) { edm::LogWarning("TrackInformation") << "TrackWithHistory momentum direction check failed" << "\nAt construction: " << momentum_.Unit() << "\nAt end: " << vmomdir; ok = false; } if (!ok) throw SimG4Exception("TrackWithHistory::checkAtEnd failed"); }
const G4VProcess* TrackWithHistory::creatorProcess | ( | ) | const [inline] |
Definition at line 39 of file TrackWithHistory.h.
References creatorProcess_.
{ return creatorProcess_; }
int TrackWithHistory::extractGenID | ( | const G4Track * | gt | ) | const [private] |
Definition at line 72 of file TrackWithHistory.cc.
Referenced by TrackWithHistory().
{ void * vgprimary = gt->GetDynamicParticle()->GetPrimaryParticle(); if (vgprimary == 0) return -1; // replace old-style cast with appropriate new-style cast... G4PrimaryParticle* gprimary = (G4PrimaryParticle*) vgprimary; GenParticleInfoExtractor ext; return ext(gprimary).id(); }
int TrackWithHistory::genParticleID | ( | ) | const [inline] |
Definition at line 32 of file TrackWithHistory.h.
References genParticleID_.
Referenced by SimTrackManager::reallyStoreTracks(), and SimTrackManager::resetGenID().
{ return genParticleID_; }
double TrackWithHistory::globalTime | ( | ) | const [inline] |
Definition at line 36 of file TrackWithHistory.h.
References globalTime_.
Referenced by SimTrackManager::getOrCreateVertex().
{ return globalTime_; }
double TrackWithHistory::localTime | ( | ) | const [inline] |
const math::XYZVectorD& TrackWithHistory::momentum | ( | ) | const [inline] |
Definition at line 33 of file TrackWithHistory.h.
References momentum_.
Referenced by CaloSD::createNewHit(), and SimTrackManager::reallyStoreTracks().
{ return momentum_; }
void TrackWithHistory::operator delete | ( | void * | TrackWithHistory | ) | [inline] |
Definition at line 79 of file TrackWithHistory.h.
References TrackWithHistoryAllocator.
{ TrackWithHistoryAllocator.FreeSingle((TrackWithHistory*) aTwH); }
void * TrackWithHistory::operator new | ( | size_t | ) | [inline] |
Definition at line 73 of file TrackWithHistory.h.
References TrackWithHistoryAllocator.
{ void * aTwH; aTwH = (void *) TrackWithHistoryAllocator.MallocSingle(); return aTwH; }
int TrackWithHistory::parentID | ( | ) | const [inline] |
Definition at line 31 of file TrackWithHistory.h.
References parentID_.
Referenced by SimTrackManager::addTrack(), and SimTrackManager::reallyStoreTracks().
{ return parentID_; }
int TrackWithHistory::particleID | ( | ) | const [inline] |
Definition at line 30 of file TrackWithHistory.h.
References particleID_.
Referenced by SimTrackManager::reallyStoreTracks().
{ return particleID_; }
double TrackWithHistory::properTime | ( | ) | const [inline] |
void TrackWithHistory::save | ( | ) | [inline] |
Definition at line 28 of file TrackWithHistory.h.
References saved_.
Referenced by CaloSD::createNewHit(), and TrackingAction::PostUserTrackingAction().
{ saved_ = true; }
bool TrackWithHistory::saved | ( | ) | const [inline] |
Definition at line 45 of file TrackWithHistory.h.
References saved_.
Referenced by SimTrackManager::cleanTracksWithHistory().
{ return saved_; }
void TrackWithHistory::setGenParticleID | ( | int | i | ) | [inline] |
Definition at line 43 of file TrackWithHistory.h.
References genParticleID_, and i.
Referenced by SimTrackManager::resetGenID().
{ genParticleID_ = i; }
void TrackWithHistory::setParentID | ( | int | i | ) | [inline] |
void TrackWithHistory::setTrackID | ( | int | i | ) | [inline] |
bool TrackWithHistory::storeTrack | ( | ) | const [inline] |
double TrackWithHistory::totalEnergy | ( | ) | const [inline] |
Definition at line 34 of file TrackWithHistory.h.
References totalEnergy_.
Referenced by SimTrackManager::reallyStoreTracks().
{ return totalEnergy_; }
unsigned int TrackWithHistory::trackID | ( | ) | const [inline] |
Definition at line 29 of file TrackWithHistory.h.
References trackID_.
Referenced by SimTrackManager::addTrack(), SimTrackManager::cleanTracksWithHistory(), trkIDLess::operator()(), SimTrackManager::StrictWeakOrdering::operator()(), TrackingAction::PostUserTrackingAction(), SimTrackManager::reallyStoreTracks(), and CaloSD::update().
{ return trackID_; }
const math::XYZVectorD& TrackWithHistory::vertexPosition | ( | ) | const [inline] |
Definition at line 35 of file TrackWithHistory.h.
References vertexPosition_.
Referenced by SimTrackManager::getOrCreateVertex().
{ return vertexPosition_; }
double TrackWithHistory::weight | ( | void | ) | const [inline] |
const G4VProcess* TrackWithHistory::creatorProcess_ [private] |
Definition at line 63 of file TrackWithHistory.h.
Referenced by creatorProcess(), and TrackWithHistory().
int TrackWithHistory::genParticleID_ [private] |
Definition at line 56 of file TrackWithHistory.h.
Referenced by genParticleID(), setGenParticleID(), and TrackWithHistory().
double TrackWithHistory::globalTime_ [private] |
Definition at line 60 of file TrackWithHistory.h.
Referenced by globalTime(), and TrackWithHistory().
double TrackWithHistory::localTime_ [private] |
Definition at line 61 of file TrackWithHistory.h.
Referenced by localTime(), and TrackWithHistory().
math::XYZVectorD TrackWithHistory::momentum_ [private] |
Definition at line 57 of file TrackWithHistory.h.
Referenced by checkAtEnd(), momentum(), and TrackWithHistory().
int TrackWithHistory::parentID_ [private] |
Definition at line 55 of file TrackWithHistory.h.
Referenced by parentID(), setParentID(), and TrackWithHistory().
int TrackWithHistory::particleID_ [private] |
Definition at line 54 of file TrackWithHistory.h.
Referenced by particleID(), and TrackWithHistory().
double TrackWithHistory::properTime_ [private] |
Definition at line 62 of file TrackWithHistory.h.
Referenced by properTime(), and TrackWithHistory().
bool TrackWithHistory::saved_ [private] |
Definition at line 66 of file TrackWithHistory.h.
Referenced by save(), saved(), and TrackWithHistory().
bool TrackWithHistory::storeTrack_ [private] |
Definition at line 65 of file TrackWithHistory.h.
Referenced by storeTrack(), and TrackWithHistory().
G4TrackToParticleID * TrackWithHistory::theG4TrackToParticleID [static, private] |
Definition at line 67 of file TrackWithHistory.h.
Referenced by TrackWithHistory().
double TrackWithHistory::totalEnergy_ [private] |
Definition at line 58 of file TrackWithHistory.h.
Referenced by totalEnergy(), and TrackWithHistory().
unsigned int TrackWithHistory::trackID_ [private] |
Definition at line 53 of file TrackWithHistory.h.
Referenced by setTrackID(), trackID(), and TrackWithHistory().
Definition at line 59 of file TrackWithHistory.h.
Referenced by checkAtEnd(), TrackWithHistory(), and vertexPosition().
double TrackWithHistory::weight_ [private] |
Definition at line 64 of file TrackWithHistory.h.
Referenced by TrackWithHistory(), and weight().