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.

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

Definition at line 24 of file TrackingAction.cc.

24 {}

Member Function Documentation

TrackWithHistory* TrackingAction::currentTrackWithHistory ( )
inline

Definition at line 26 of file TrackingAction.h.

References currentTrack_.

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

Definition at line 27 of file TrackingAction.h.

References g4Track_.

Referenced by StackingAction::ClassifyNewTrack().

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

Definition at line 28 of file TrackingAction.h.

Referenced by TrackingVerboseAction::update().

28 { 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_, stringResolutionProvider_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().

44 {
45  if (eventAction_->trackContainer() != nullptr) {
46 
47  if (extractor_(aTrack).storeTrack()) {
49 
50  math::XYZVectorD pos((aTrack->GetStep()->GetPostStepPoint()->GetPosition()).x(),
51  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).y(),
52  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).z());
54 
55  uint32_t id = aTrack->GetTrackID();
56 
57  std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> p(pos,mom);
59 #ifdef DebugLog
60  LogDebug("SimTrackManager") << "TrackingAction addTkCaloStateInfo "
61  << id << " of momentum " << mom << " at " << pos;
62 #endif
63  }
64 
65  bool withAncestor =
66  ((extractor_(aTrack).getIDonCaloSurface() == aTrack->GetTrackID())
67  || (extractor_(aTrack).isAncestor()));
68 
69  if (extractor_(aTrack).isInHistory()) {
70 
71  // check with end-of-track information
72  if(checkTrack_) { currentTrack_->checkAtEnd(aTrack); }
73 
74  eventAction_->addTrack(currentTrack_, true, withAncestor);
75  /*
76  cout << "TrackingAction addTrack "
77  << currentTrack_->trackID() << " E(GeV)= " << aTrack->GetKineticEnergy()
78  << " " << aTrack->GetDefinition()->GetParticleName()
79  << " added= " << withAncestor
80  << " at " << aTrack->GetPosition() << endl;
81  */
82 #ifdef DebugLog
83  math::XYZVectorD pos((aTrack->GetStep()->GetPostStepPoint()->GetPosition()).x(),
84  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).y(),
85  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).z());
86  LogDebug("SimTrackManager") << "TrackingAction addTrack "
87  << currentTrack_->trackID()
88  << " added with " << true << " and " << withAncestor
89  << " at " << pos;
90 #endif
91 
92  } else {
93  eventAction_->addTrack(currentTrack_, false, false);
94 
95 #ifdef DebugLog
96  LogDebug("SimTrackManager") << "TrackingAction addTrack "
97  << currentTrack_->trackID() << " added with "
98  << false << " and " << false;
99 #endif
100 
101  delete currentTrack_;
102  }
103  }
104  if(nullptr != steppingVerbose_) { steppingVerbose_->TrackEnded(aTrack); }
105 
106  EndOfTrack et(aTrack);
108 
109  currentTrack_ = nullptr; // reset for next track
110 }
#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:37
et
define resolution functions of each parameter
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: EventAction.cc:74
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
Definition: EventAction.h:41
void TrackingAction::PreUserTrackingAction ( const G4Track *  aTrack)
override

Definition at line 26 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:48
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 40 of file TrackingAction.h.

Referenced by PostUserTrackingAction().

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

Definition at line 36 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().

TrackInformationExtractor TrackingAction::extractor_
private

Definition at line 35 of file TrackingAction.h.

Referenced by PostUserTrackingAction().

const G4Track* TrackingAction::g4Track_
private

Definition at line 39 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 38 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().