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::TrackingAction ( EventAction ea,
const edm::ParameterSet ps,
CMSSteppingVerbose sv 
)
explicit

Definition at line 18 of file TrackingAction.cc.

19  : eventAction_(e),
20  currentTrack_(nullptr),
22  g4Track_(nullptr),
23  checkTrack_(p.getUntrackedParameter<bool>("CheckTrack", false)) {}

◆ ~TrackingAction()

TrackingAction::~TrackingAction ( )
override

Definition at line 25 of file TrackingAction.cc.

25 {}

Member Function Documentation

◆ currentTrackWithHistory()

TrackWithHistory* TrackingAction::currentTrackWithHistory ( )
inline

Definition at line 24 of file TrackingAction.h.

24 { return currentTrack_; }

References currentTrack_.

◆ geant4Track()

const G4Track* TrackingAction::geant4Track ( ) const
inline

Definition at line 25 of file TrackingAction.h.

25 { return g4Track_; }

References g4Track_.

Referenced by StackingAction::ClassifyNewTrack().

◆ getTrackManager()

G4TrackingManager* TrackingAction::getTrackManager ( )
inline

Definition at line 26 of file TrackingAction.h.

26 { return fpTrackingManager; }

◆ PostUserTrackingAction()

void TrackingAction::PostUserTrackingAction ( const G4Track *  aTrack)
override

Definition at line 43 of file TrackingAction.cc.

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 EDM_ML_DEBUG
58  edm::LogVerbatim("SimTrackManager")
59  << "TrackingAction addTkCaloStateInfo " << id << " of momentum " << mom << " at " << pos;
60 #endif
61  }
62 
63  bool withAncestor =
64  ((extractor_(aTrack).getIDonCaloSurface() == aTrack->GetTrackID()) ||
65  (extractor_(aTrack).getIDfineCalo() == aTrack->GetTrackID()) || (extractor_(aTrack).isAncestor()));
66 
67  if (extractor_(aTrack).isInHistory()) {
68  // check with end-of-track information
69  if (checkTrack_) {
70  currentTrack_->checkAtEnd(aTrack);
71  }
72 
73  eventAction_->addTrack(currentTrack_, true, withAncestor);
74 
75 #ifdef EDM_ML_DEBUG
76  edm::LogVerbatim("SimTrackManager")
77  << "TrackingAction addTrack " << currentTrack_->trackID() << " E(GeV)= " << aTrack->GetKineticEnergy() << " "
78  << aTrack->GetDefinition()->GetParticleName() << " added= " << withAncestor << " at "
79  << aTrack->GetPosition();
80 
81  math::XYZVectorD pos((aTrack->GetStep()->GetPostStepPoint()->GetPosition()).x(),
82  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).y(),
83  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).z());
84  edm::LogVerbatim("SimTrackManager") << "TrackingAction addTrack " << currentTrack_->trackID() << " added with "
85  << true << " and " << withAncestor << " at " << pos;
86 #endif
87 
88  } else {
89  eventAction_->addTrack(currentTrack_, false, false);
90 
91 #ifdef EDM_ML_DEBUG
92  edm::LogVerbatim("SimTrackManager")
93  << "TrackingAction addTrack " << currentTrack_->trackID() << " added with " << false << " 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 }

References EventAction::addTkCaloStateInfo(), EventAction::addTrack(), TrackWithHistory::checkAtEnd(), checkTrack_, currentTrack_, EgHLTOffHistBins_cfi::et, eventAction_, extractor_, 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().

◆ PreUserTrackingAction()

void TrackingAction::PreUserTrackingAction ( const G4Track *  aTrack)
override

Definition at line 27 of file TrackingAction.cc.

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 }

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

Member Data Documentation

◆ checkTrack_

bool TrackingAction::checkTrack_
private

Definition at line 37 of file TrackingAction.h.

Referenced by PostUserTrackingAction().

◆ currentTrack_

TrackWithHistory* TrackingAction::currentTrack_
private

◆ eventAction_

EventAction* TrackingAction::eventAction_
private

Definition at line 33 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().

◆ extractor_

TrackInformationExtractor TrackingAction::extractor_
private

Definition at line 32 of file TrackingAction.h.

Referenced by PostUserTrackingAction().

◆ g4Track_

const G4Track* TrackingAction::g4Track_
private

Definition at line 36 of file TrackingAction.h.

Referenced by geant4Track(), and PreUserTrackingAction().

◆ m_beginOfTrackSignal

SimActivityRegistry::BeginOfTrackSignal TrackingAction::m_beginOfTrackSignal

◆ m_endOfTrackSignal

SimActivityRegistry::EndOfTrackSignal TrackingAction::m_endOfTrackSignal

◆ steppingVerbose_

CMSSteppingVerbose* TrackingAction::steppingVerbose_
private

Definition at line 35 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().

DDAxes::y
EventAction::trackContainer
const TrackContainer * trackContainer() const
Definition: EventAction.h:33
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
math::XYZTLorentzVectorD
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
TrackWithHistory
Definition: TrackWithHistory.h:16
pos
Definition: PixelAliasList.h:18
EventAction::prepareForNewPrimary
void prepareForNewPrimary()
Definition: EventAction.h:41
TrackingAction::g4Track_
const G4Track * g4Track_
Definition: TrackingAction.h:36
TrackingAction::extractor_
TrackInformationExtractor extractor_
Definition: TrackingAction.h:32
DDAxes::x
TrackWithHistory::checkAtEnd
void checkAtEnd(const G4Track *)
Definition: TrackWithHistory.cc:56
EndOfTrack
Definition: EndOfTrack.h:6
TrackingAction::currentTrack_
TrackWithHistory * currentTrack_
Definition: TrackingAction.h:34
TrackInformation::isPrimary
bool isPrimary() const
Definition: TrackInformation.h:23
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
DDAxes::z
TrackingAction::m_endOfTrackSignal
SimActivityRegistry::EndOfTrackSignal m_endOfTrackSignal
Definition: TrackingAction.h:29
BeginOfTrack
Definition: BeginOfTrack.h:6
TrackWithHistory::save
void save()
Definition: TrackWithHistory.h:27
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
TrackingAction::eventAction_
EventAction * eventAction_
Definition: TrackingAction.h:33
CMSSteppingVerbose::TrackStarted
void TrackStarted(const G4Track *, bool isKilled)
Definition: CMSSteppingVerbose.cc:62
TrackInformation
Definition: TrackInformation.h:8
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
TrackingAction::m_beginOfTrackSignal
SimActivityRegistry::BeginOfTrackSignal m_beginOfTrackSignal
Definition: TrackingAction.h:28
TrackWithHistory::trackID
unsigned int trackID() const
Definition: TrackWithHistory.h:28
CMSSteppingVerbose::TrackEnded
void TrackEnded(const G4Track *) const
Definition: CMSSteppingVerbose.cc:130
EventAction::addTkCaloStateInfo
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: EventAction.cc:72
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
TrackingAction::checkTrack_
bool checkTrack_
Definition: TrackingAction.h:37
TrackingAction::steppingVerbose_
CMSSteppingVerbose * steppingVerbose_
Definition: TrackingAction.h:35
EventAction::addTrack
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
Definition: EventAction.h:35
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37