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 (SimTrackManager *, CMSSteppingVerbose *, const edm::ParameterSet &ps)
 
 ~TrackingAction () override=default
 

Public Attributes

SimActivityRegistry::BeginOfTrackSignal m_beginOfTrackSignal
 
SimActivityRegistry::EndOfTrackSignal m_endOfTrackSignal
 

Private Attributes

bool checkTrack_
 
TrackWithHistorycurrentTrack_ = nullptr
 
bool doFineCalo_
 
double ekinMin_
 
std::vector< double > ekinMinRegion_
 
int endPrintTrackID_
 
const G4Track * g4Track_ = nullptr
 
std::vector< G4Region * > ptrRegion_
 
bool saveCaloBoundaryInformation_
 
CMSSteppingVerbosesteppingVerbose_
 
SimTrackManagertrackManager_
 
TrackInformationtrkInfo_ = nullptr
 

Detailed Description

Definition at line 19 of file TrackingAction.h.

Constructor & Destructor Documentation

◆ TrackingAction()

TrackingAction::TrackingAction ( SimTrackManager stm,
CMSSteppingVerbose sv,
const edm::ParameterSet ps 
)
explicit

Definition at line 19 of file TrackingAction.cc.

References doFineCalo_, ekinMin_, ekinMinRegion_, AlCaHLTBitMon_ParallelJobs::p, ptrRegion_, and saveCaloBoundaryInformation_.

20  : trackManager_(stm),
22  endPrintTrackID_(p.getParameter<int>("EndPrintTrackID")),
23  checkTrack_(p.getUntrackedParameter<bool>("CheckTrack", false)),
24  doFineCalo_(p.getParameter<bool>("DoFineCalo")),
25  saveCaloBoundaryInformation_(p.getParameter<bool>("SaveCaloBoundaryInformation")),
26  ekinMin_(p.getParameter<double>("PersistencyEmin") * CLHEP::GeV),
27  ekinMinRegion_(p.getParameter<std::vector<double>>("RegionEmin")) {
28  double eth = p.getParameter<double>("EminFineTrack") * CLHEP::MeV;
29  if (doFineCalo_ && eth < ekinMin_) {
30  ekinMin_ = eth;
31  }
32  edm::LogVerbatim("SimG4CoreApplication") << "TrackingAction: boundary: " << saveCaloBoundaryInformation_
33  << "; DoFineCalo: " << doFineCalo_ << "; ekinMin(MeV)=" << ekinMin_;
34  if (!ekinMinRegion_.empty()) {
35  ptrRegion_.resize(ekinMinRegion_.size(), nullptr);
36  }
37 }
Log< level::Info, true > LogVerbatim
SimTrackManager * trackManager_
CMSSteppingVerbose * steppingVerbose_
bool saveCaloBoundaryInformation_
std::vector< double > ekinMinRegion_
std::vector< G4Region * > ptrRegion_

◆ ~TrackingAction()

TrackingAction::~TrackingAction ( )
overridedefault

Member Function Documentation

◆ currentTrackWithHistory()

TrackWithHistory* TrackingAction::currentTrackWithHistory ( )
inline

Definition at line 27 of file TrackingAction.h.

References currentTrack_.

27 { return currentTrack_; }
TrackWithHistory * currentTrack_

◆ geant4Track()

const G4Track* TrackingAction::geant4Track ( ) const
inline

Definition at line 28 of file TrackingAction.h.

References g4Track_.

Referenced by StackingAction::ClassifyNewTrack().

28 { return g4Track_; }
const G4Track * g4Track_

◆ getTrackManager()

G4TrackingManager* TrackingAction::getTrackManager ( )
inline

Definition at line 29 of file TrackingAction.h.

29 { return fpTrackingManager; }

◆ PostUserTrackingAction()

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

Definition at line 77 of file TrackingAction.cc.

References SimTrackManager::addTrack(), TrackInformation::crossedBoundary(), currentTrack_, doFineCalo_, l1tnanotables_cff::et, TrackInformation::getIDonCaloSurface(), TrackInformation::getMomentumAtBoundary(), TrackInformation::getPositionAtBoundary(), TrackInformation::isAncestor(), TrackInformation::isInHistory(), m_endOfTrackSignal, convertSQLiteXML::ok, saveCaloBoundaryInformation_, TrackWithHistory::saved(), TrackWithHistory::setCrossedBoundaryPosMom(), TrackWithHistory::setToBeSaved(), TrackInformation::storeTrack(), trackManager_, and trkInfo_.

Referenced by RunManagerMTWorker::abortEvent().

77  {
78  // Tracks in history may be upgraded to stored secondary tracks,
79  // which cross the boundary between Tracker and Calo
80  int id = aTrack->GetTrackID();
81  bool ok = (trkInfo_->storeTrack() || currentTrack_->saved());
82  if (trkInfo_->crossedBoundary()) {
85  }
86  if (ok) {
88  }
89 
90  bool withAncestor = (trkInfo_->getIDonCaloSurface() == id || trkInfo_->isAncestor());
91  bool isInHistory = trkInfo_->isInHistory();
92 
93  trackManager_->addTrack(currentTrack_, aTrack, isInHistory, withAncestor);
94 
95 #ifdef EDM_ML_DEBUG
96  edm::LogVerbatim("TrackingAction") << "TrackingAction end track=" << id << " "
97  << aTrack->GetDefinition()->GetParticleName() << " proposed to be saved= " << ok
98  << " end point " << aTrack->GetPosition();
99 #endif
100 
101  if (!isInHistory) {
102  delete currentTrack_;
103  }
104 
105  EndOfTrack et(aTrack);
107 }
bool storeTrack() const
Log< level::Info, true > LogVerbatim
bool crossedBoundary() const
SimTrackManager * trackManager_
bool isAncestor() const
const math::XYZTLorentzVectorF & getPositionAtBoundary() const
TrackWithHistory * currentTrack_
bool isInHistory() const
TrackInformation * trkInfo_
bool saveCaloBoundaryInformation_
SimActivityRegistry::EndOfTrackSignal m_endOfTrackSignal
const math::XYZTLorentzVectorF & getMomentumAtBoundary() const
int getIDonCaloSurface() const
void addTrack(TrackWithHistory *iTrack, const G4Track *track, bool inHistory, bool withAncestor)
bool saved() const
void setCrossedBoundaryPosMom(int id, const math::XYZTLorentzVectorF &position, const math::XYZTLorentzVectorF &momentum)

◆ PreUserTrackingAction()

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

Definition at line 39 of file TrackingAction.cc.

References SimTrackManager::cleanTracksWithHistory(), currentTrack_, ekinMin_, endPrintTrackID_, g4Track_, TrackInformation::isPrimary(), m_beginOfTrackSignal, TrackInformation::putInHistory(), TrackWithHistory::setToBeSaved(), steppingVerbose_, CMSSteppingVerbose::stopEventPrint(), trackManager_, CMSSteppingVerbose::trackStarted(), and trkInfo_.

39  {
40  g4Track_ = aTrack;
41  currentTrack_ = new TrackWithHistory(aTrack, aTrack->GetParentID());
42 
43  BeginOfTrack bt(aTrack);
45 
46  trkInfo_ = static_cast<TrackInformation*>(aTrack->GetUserInformation());
47 
48  // Always save primaries
49  if (trkInfo_->isPrimary()) {
52  }
53 
54  if (nullptr != steppingVerbose_) {
55  steppingVerbose_->trackStarted(aTrack, false);
56  if (aTrack->GetTrackID() == endPrintTrackID_) {
58  }
59  }
60  double ekin = aTrack->GetKineticEnergy();
61 
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("DoFineCalo") << "PreUserTrackingAction: Start processing track " << aTrack->GetTrackID()
64  << " pdgid=" << aTrack->GetDefinition()->GetPDGEncoding()
65  << " ekin[GeV]=" << ekin / CLHEP::GeV << " vertex[cm]=("
66  << aTrack->GetVertexPosition().x() / CLHEP::cm << ","
67  << aTrack->GetVertexPosition().y() / CLHEP::cm << ","
68  << aTrack->GetVertexPosition().z() / CLHEP::cm << ")"
69  << " parentid=" << aTrack->GetParentID();
70 #endif
71  if (ekin > ekinMin_) {
72  // Each track with energy above the threshold should be saved
74  }
75 }
Log< level::Info, true > LogVerbatim
bool isPrimary() const
SimTrackManager * trackManager_
const G4Track * g4Track_
CMSSteppingVerbose * steppingVerbose_
TrackWithHistory * currentTrack_
TrackInformation * trkInfo_
void cleanTracksWithHistory()
void trackStarted(const G4Track *, bool isKilled)
SimActivityRegistry::BeginOfTrackSignal m_beginOfTrackSignal

Member Data Documentation

◆ checkTrack_

bool TrackingAction::checkTrack_
private

Definition at line 41 of file TrackingAction.h.

◆ currentTrack_

TrackWithHistory* TrackingAction::currentTrack_ = nullptr
private

◆ doFineCalo_

bool TrackingAction::doFineCalo_
private

Definition at line 42 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and TrackingAction().

◆ ekinMin_

double TrackingAction::ekinMin_
private

Definition at line 44 of file TrackingAction.h.

Referenced by PreUserTrackingAction(), and TrackingAction().

◆ ekinMinRegion_

std::vector<double> TrackingAction::ekinMinRegion_
private

Definition at line 45 of file TrackingAction.h.

Referenced by TrackingAction().

◆ endPrintTrackID_

int TrackingAction::endPrintTrackID_
private

Definition at line 40 of file TrackingAction.h.

Referenced by PreUserTrackingAction().

◆ g4Track_

const G4Track* TrackingAction::g4Track_ = nullptr
private

Definition at line 37 of file TrackingAction.h.

Referenced by geant4Track(), and PreUserTrackingAction().

◆ m_beginOfTrackSignal

SimActivityRegistry::BeginOfTrackSignal TrackingAction::m_beginOfTrackSignal

Definition at line 31 of file TrackingAction.h.

Referenced by RunManagerMTWorker::Connect(), and PreUserTrackingAction().

◆ m_endOfTrackSignal

SimActivityRegistry::EndOfTrackSignal TrackingAction::m_endOfTrackSignal

Definition at line 32 of file TrackingAction.h.

Referenced by RunManagerMTWorker::Connect(), and PostUserTrackingAction().

◆ ptrRegion_

std::vector<G4Region*> TrackingAction::ptrRegion_
private

Definition at line 46 of file TrackingAction.h.

Referenced by TrackingAction().

◆ saveCaloBoundaryInformation_

bool TrackingAction::saveCaloBoundaryInformation_
private

Definition at line 43 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and TrackingAction().

◆ steppingVerbose_

CMSSteppingVerbose* TrackingAction::steppingVerbose_
private

Definition at line 36 of file TrackingAction.h.

Referenced by PreUserTrackingAction().

◆ trackManager_

SimTrackManager* TrackingAction::trackManager_
private

Definition at line 35 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().

◆ trkInfo_

TrackInformation* TrackingAction::trkInfo_ = nullptr
private

Definition at line 38 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().