CMS 3D CMS Logo

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

#include <TrackingAction.h>

Inheritance diagram for TrackingAction:

Public Member Functions

TrackWithHistorycurrentTrackWithHistory ()
 
const G4Track * geant4Track () const
 
G4TrackingManager * getTrackManager ()
 
void PostUserTrackingAction (const G4Track *aTrack) override
 
void PreUserTrackingAction (const G4Track *aTrack) override
 
 TrackingAction (EventAction *ea, const edm::ParameterSet &ps, CMSSteppingVerbose *)
 
 ~TrackingAction () override
 

Public Attributes

SimActivityRegistry::BeginOfTrackSignal m_beginOfTrackSignal
 
SimActivityRegistry::EndOfTrackSignal m_endOfTrackSignal
 

Private Attributes

bool checkTrack_
 
TrackWithHistorycurrentTrack_
 
EventActioneventAction_
 
TrackInformationExtractor extractor_
 
const G4Track * g4Track_
 
CMSSteppingVerbosesteppingVerbose_
 

Detailed Description

Definition at line 16 of file TrackingAction.h.

Constructor & Destructor Documentation

TrackingAction::TrackingAction ( EventAction ea,
const edm::ParameterSet ps,
CMSSteppingVerbose sv 
)
explicit

Definition at line 18 of file TrackingAction.cc.

19  : eventAction_(e),
20  currentTrack_(nullptr),
21  steppingVerbose_(sv),
22  g4Track_(nullptr),
23  checkTrack_(p.getUntrackedParameter<bool>("CheckTrack", false)) {}
const G4Track * g4Track_
CMSSteppingVerbose * steppingVerbose_
TrackWithHistory * currentTrack_
EventAction * eventAction_
TrackingAction::~TrackingAction ( )
override

Definition at line 25 of file TrackingAction.cc.

25 {}

Member Function Documentation

TrackWithHistory* TrackingAction::currentTrackWithHistory ( )
inline

Definition at line 24 of file TrackingAction.h.

References currentTrack_.

24 { return currentTrack_; }
TrackWithHistory * currentTrack_
const G4Track* TrackingAction::geant4Track ( ) const
inline

Definition at line 25 of file TrackingAction.h.

References g4Track_.

Referenced by StackingAction::ClassifyNewTrack().

25 { return g4Track_; }
const G4Track * g4Track_
G4TrackingManager* TrackingAction::getTrackManager ( )
inline

Definition at line 26 of file TrackingAction.h.

26 { return fpTrackingManager; }
void TrackingAction::PostUserTrackingAction ( const G4Track *  aTrack)
override

Definition at line 43 of file TrackingAction.cc.

References EventAction::addTkCaloStateInfo(), EventAction::addTrack(), TrackWithHistory::checkAtEnd(), checkTrack_, currentTrack_, EgHLTOffHistBins_cfi::et, eventAction_, extractor_, LogDebug, m_endOfTrackSignal, AlCaHLTBitMon_ParallelJobs::p, TrackWithHistory::save(), steppingVerbose_, EventAction::trackContainer(), CMSSteppingVerbose::TrackEnded(), TrackWithHistory::trackID(), x, y, and z.

Referenced by RunManagerMTWorker::abortEvent(), and RunManager::abortEvent().

43  {
44  if (eventAction_->trackContainer() != nullptr) {
45  if (extractor_(aTrack).storeTrack()) {
47 
48  math::XYZVectorD pos((aTrack->GetStep()->GetPostStepPoint()->GetPosition()).x(),
49  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).y(),
50  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).z());
52 
53  uint32_t id = aTrack->GetTrackID();
54 
55  std::pair<math::XYZVectorD, math::XYZTLorentzVectorD> p(pos, mom);
57 #ifdef DebugLog
58  LogDebug("SimTrackManager") << "TrackingAction addTkCaloStateInfo " << id << " of momentum " << mom << " at "
59  << pos;
60 #endif
61  }
62 
63  bool withAncestor =
64  ((extractor_(aTrack).getIDonCaloSurface() == aTrack->GetTrackID()) || (extractor_(aTrack).isAncestor()));
65 
66  if (extractor_(aTrack).isInHistory()) {
67  // check with end-of-track information
68  if (checkTrack_) {
69  currentTrack_->checkAtEnd(aTrack);
70  }
71 
72  eventAction_->addTrack(currentTrack_, true, withAncestor);
73  /*
74  cout << "TrackingAction addTrack "
75  << currentTrack_->trackID() << " E(GeV)= " << aTrack->GetKineticEnergy()
76  << " " << aTrack->GetDefinition()->GetParticleName()
77  << " added= " << withAncestor
78  << " at " << aTrack->GetPosition() << endl;
79  */
80 #ifdef DebugLog
81  math::XYZVectorD pos((aTrack->GetStep()->GetPostStepPoint()->GetPosition()).x(),
82  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).y(),
83  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).z());
84  LogDebug("SimTrackManager") << "TrackingAction addTrack " << currentTrack_->trackID() << " added with " << true
85  << " and " << withAncestor << " at " << pos;
86 #endif
87 
88  } else {
89  eventAction_->addTrack(currentTrack_, false, false);
90 
91 #ifdef DebugLog
92  LogDebug("SimTrackManager") << "TrackingAction addTrack " << currentTrack_->trackID() << " added with " << false
93  << " and " << false;
94 #endif
95 
96  delete currentTrack_;
97  }
98  }
99  if (nullptr != steppingVerbose_) {
100  steppingVerbose_->TrackEnded(aTrack);
101  }
102 
103  EndOfTrack et(aTrack);
105 
106  currentTrack_ = nullptr; // reset for next track
107 }
#define LogDebug(id)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
TrackInformationExtractor extractor_
CMSSteppingVerbose * steppingVerbose_
TrackWithHistory * currentTrack_
void TrackEnded(const G4Track *) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
EventAction * eventAction_
unsigned int trackID() const
void checkAtEnd(const G4Track *)
SimActivityRegistry::EndOfTrackSignal m_endOfTrackSignal
const TrackContainer * trackContainer() const
Definition: EventAction.h:33
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: EventAction.cc:72
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
Definition: EventAction.h:35
void TrackingAction::PreUserTrackingAction ( const G4Track *  aTrack)
override

Definition at line 27 of file TrackingAction.cc.

References currentTrack_, eventAction_, g4Track_, TrackInformation::isPrimary(), m_beginOfTrackSignal, EventAction::prepareForNewPrimary(), steppingVerbose_, and CMSSteppingVerbose::TrackStarted().

27  {
28  g4Track_ = aTrack;
29  currentTrack_ = new TrackWithHistory(aTrack);
30 
31  BeginOfTrack bt(aTrack);
33 
34  TrackInformation* trkInfo = (TrackInformation*)aTrack->GetUserInformation();
35  if (trkInfo && trkInfo->isPrimary()) {
37  }
38  if (nullptr != steppingVerbose_) {
39  steppingVerbose_->TrackStarted(aTrack, false);
40  }
41 }
const G4Track * g4Track_
CMSSteppingVerbose * steppingVerbose_
TrackWithHistory * currentTrack_
void prepareForNewPrimary()
Definition: EventAction.h:41
EventAction * eventAction_
bool isPrimary() const
void TrackStarted(const G4Track *, bool isKilled)
SimActivityRegistry::BeginOfTrackSignal m_beginOfTrackSignal

Member Data Documentation

bool TrackingAction::checkTrack_
private

Definition at line 37 of file TrackingAction.h.

Referenced by PostUserTrackingAction().

TrackWithHistory* TrackingAction::currentTrack_
private
EventAction* TrackingAction::eventAction_
private

Definition at line 33 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().

TrackInformationExtractor TrackingAction::extractor_
private

Definition at line 32 of file TrackingAction.h.

Referenced by PostUserTrackingAction().

const G4Track* TrackingAction::g4Track_
private

Definition at line 36 of file TrackingAction.h.

Referenced by geant4Track(), and PreUserTrackingAction().

SimActivityRegistry::BeginOfTrackSignal TrackingAction::m_beginOfTrackSignal
SimActivityRegistry::EndOfTrackSignal TrackingAction::m_endOfTrackSignal
CMSSteppingVerbose* TrackingAction::steppingVerbose_
private

Definition at line 35 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().