test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
virtual void PostUserTrackingAction (const G4Track *aTrack)
 
virtual void PreUserTrackingAction (const G4Track *aTrack)
 
 TrackingAction (EventAction *ea, const edm::ParameterSet &ps)
 
virtual ~TrackingAction ()
 

Public Attributes

SimActivityRegistry::BeginOfTrackSignal m_beginOfTrackSignal
 
SimActivityRegistry::EndOfTrackSignal m_endOfTrackSignal
 

Private Attributes

bool checkTrack
 
TrackWithHistorycurrentTrack_
 
bool detailedTiming
 
EventActioneventAction_
 
const G4Track * g4Track_
 
int trackMgrVerbose
 
G4VSolid * worldSolid
 

Detailed Description

Definition at line 15 of file TrackingAction.h.

Constructor & Destructor Documentation

TrackingAction::TrackingAction ( EventAction ea,
const edm::ParameterSet ps 
)

Definition at line 23 of file TrackingAction.cc.

References worldSolid.

25  detailedTiming(p.getUntrackedParameter<bool>("DetailedTiming",false)),
26  checkTrack(p.getUntrackedParameter<bool>("CheckTrack",false)),
27  trackMgrVerbose(p.getUntrackedParameter<int>("G4TrackManagerVerbosity",0))
28 {
29  worldSolid = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume()->GetSolid();
30 }
const G4Track * g4Track_
TrackWithHistory * currentTrack_
G4VSolid * worldSolid
EventAction * eventAction_
TrackingAction::~TrackingAction ( )
virtual

Definition at line 32 of file TrackingAction.cc.

32 {}

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 ( )

Definition at line 145 of file TrackingAction.cc.

References trackMgrVerbose.

Referenced by TrackingVerboseAction::update().

146 {
147  G4TrackingManager * theTrackingManager = 0;
148  theTrackingManager = fpTrackingManager;
149  theTrackingManager->SetVerboseLevel(trackMgrVerbose);
150  return theTrackingManager;
151 }
void TrackingAction::PostUserTrackingAction ( const G4Track *  aTrack)
virtual

Definition at line 78 of file TrackingAction.cc.

References EventAction::addTkCaloStateInfo(), EventAction::addTrack(), TrackWithHistory::checkAtEnd(), checkTrack, currentTrack_, eventAction_, LogDebug, m_endOfTrackSignal, AlCaHLTBitMon_ParallelJobs::p, TrackWithHistory::save(), EventAction::trackContainer(), TrackWithHistory::trackID(), x, y, and z.

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

79 {
80  if (eventAction_->trackContainer() != 0) {
81 
82  TrackInformationExtractor extractor;
83  if (extractor(aTrack).storeTrack()) {
85 
86  math::XYZVectorD pos((aTrack->GetStep()->GetPostStepPoint()->GetPosition()).x(),
87  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).y(),
88  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).z());
90 
91  uint32_t id = aTrack->GetTrackID();
92 
93  std::pair<math::XYZVectorD,math::XYZTLorentzVectorD> p(pos,mom);
95 #ifdef DebugLog
96  LogDebug("SimTrackManager") << "TrackingAction addTkCaloStateInfo "
97  << id << " of momentum " << mom << " at " << pos;
98 #endif
99  }
100 
101  bool withAncestor =
102  ((extractor(aTrack).getIDonCaloSurface() == aTrack->GetTrackID())
103  || (extractor(aTrack).isAncestor()));
104 
105  if (extractor(aTrack).isInHistory()) {
106 
107  // check with end-of-track information
108  if(checkTrack) { currentTrack_->checkAtEnd(aTrack); }
109 
110  eventAction_->addTrack(currentTrack_, true, withAncestor);
111  /*
112  cout << "TrackingAction addTrack "
113  << currentTrack_->trackID() << " E(GeV)= " << aTrack->GetKineticEnergy()
114  << " " << aTrack->GetDefinition()->GetParticleName()
115  << " added= " << withAncestor
116  << " at " << aTrack->GetPosition() << endl;
117  */
118 #ifdef DebugLog
119  math::XYZVectorD pos((aTrack->GetStep()->GetPostStepPoint()->GetPosition()).x(),
120  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).y(),
121  (aTrack->GetStep()->GetPostStepPoint()->GetPosition()).z());
122  LogDebug("SimTrackManager") << "TrackingAction addTrack "
123  << currentTrack_->trackID()
124  << " added with " << true << " and " << withAncestor
125  << " at " << pos;
126 #endif
127 
128  } else {
129  eventAction_->addTrack(currentTrack_, false, false);
130 
131 #ifdef DebugLog
132  LogDebug("SimTrackManager") << "TrackingAction addTrack "
133  << currentTrack_->trackID() << " added with "
134  << false << " and " << false;
135 #endif
136 
137  delete currentTrack_;
138  }
139  }
140  EndOfTrack et(aTrack);
141  m_endOfTrackSignal(&et);
142  currentTrack_ = 0; // reset for next track
143 }
#define LogDebug(id)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
TrackWithHistory * currentTrack_
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:38
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: EventAction.cc:90
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
Definition: EventAction.cc:84
void TrackingAction::PreUserTrackingAction ( const G4Track *  aTrack)
virtual

Definition at line 34 of file TrackingAction.cc.

References currentTrack_, eventAction_, g4Track_, TrackInformation::isPrimary(), m_beginOfTrackSignal, EventAction::prepareForNewPrimary(), and worldSolid.

35 {
36  g4Track_ = aTrack;
37 
38  if (currentTrack_ != 0) {
39  throw SimG4Exception("TrackingAction: currentTrack is a mess...");
40  }
41  currentTrack_ = new TrackWithHistory(aTrack);
42 
43  /*
44  Trick suggested by Vladimir I. in order to debug with high
45  level verbosity only a single problematic tracks
46  */
47 
48  /*
49  if ( aTrack->GetTrackID() == palce_here_the_trackid_of_problematic_tracks ) {
50  G4UImanager::GetUIpointer()->ApplyCommand("/tracking/verbose 6");
51  } else if ( aTrack->GetTrackID() == place_here_the_trackid_of_following_track_to_donwgrade_the_severity ) {
52  G4UImanager::GetUIpointer()->ApplyCommand("/tracking/verbose 0");
53  }
54  */
55  BeginOfTrack bt(aTrack);
57 
58  TrackInformation * trkInfo = (TrackInformation *)aTrack->GetUserInformation();
59  if(trkInfo && trkInfo->isPrimary()) {
61  }
62  /*
63  G4cout << "Track " << aTrack->GetTrackID() << " R "
64  << (aTrack->GetVertexPosition()).r() << " Z "
65  << std::abs((aTrack->GetVertexPosition()).z()) << G4endl << "Top Solid "
66  << worldSolid->GetName() << " is it inside "
67  << worldSolid->Inside(aTrack->GetVertexPosition())
68  << " compared to " << kOutside << G4endl;
69  */
70  // VI: why this check is TrackingAction?
71  if (worldSolid->Inside(aTrack->GetVertexPosition()) == kOutside) {
72  // G4cout << "Kill Track " << aTrack->GetTrackID() << G4endl;
73  G4Track* theTrack = (G4Track *)(aTrack);
74  theTrack->SetTrackStatus(fStopAndKill);
75  }
76 }
const G4Track * g4Track_
TrackWithHistory * currentTrack_
void prepareForNewPrimary()
Definition: EventAction.h:43
G4VSolid * worldSolid
EventAction * eventAction_
bool isPrimary() const
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
bool TrackingAction::detailedTiming
private

Definition at line 36 of file TrackingAction.h.

EventAction* TrackingAction::eventAction_
private

Definition at line 32 of file TrackingAction.h.

Referenced by PostUserTrackingAction(), and PreUserTrackingAction().

const G4Track* TrackingAction::g4Track_
private

Definition at line 34 of file TrackingAction.h.

Referenced by geant4Track(), and PreUserTrackingAction().

SimActivityRegistry::BeginOfTrackSignal TrackingAction::m_beginOfTrackSignal
SimActivityRegistry::EndOfTrackSignal TrackingAction::m_endOfTrackSignal
int TrackingAction::trackMgrVerbose
private

Definition at line 38 of file TrackingAction.h.

Referenced by getTrackManager().

G4VSolid* TrackingAction::worldSolid
private

Definition at line 35 of file TrackingAction.h.

Referenced by PreUserTrackingAction(), and TrackingAction().