CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes
PrintTrackNumberAction Class Reference

#include <PrintTrackNumberAction.h>

Inheritance diagram for PrintTrackNumberAction:
SimWatcher Observer< const EndOfEvent *> Observer< const EndOfTrack *>

Public Member Functions

 PrintTrackNumberAction (edm::ParameterSet const &p)
 
void update (const EndOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
 ~PrintTrackNumberAction () override
 
- Public Member Functions inherited from SimWatcher
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const EndOfEvent *>
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack *>
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 

Private Attributes

bool bNoUserLimits
 
int theNoTracks
 
int theNoTracksNoUL
 
int theNoTracksThisEvent
 
int theNoTracksThisEventNoUL
 
int theNoTracksToPrint
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

Definition at line 11 of file PrintTrackNumberAction.h.

Constructor & Destructor Documentation

◆ PrintTrackNumberAction()

PrintTrackNumberAction::PrintTrackNumberAction ( edm::ParameterSet const &  p)

Definition at line 11 of file PrintTrackNumberAction.cc.

References bNoUserLimits, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, AlCaHLTBitMon_ParallelJobs::p, and theNoTracksToPrint.

13  theNoTracksToPrint = p.getUntrackedParameter<int>("EachNTrack", -1);
14  // do not count tracks killed by user limits (MinEkineCut for the moment only)
15  bNoUserLimits = p.getUntrackedParameter<bool>("NoUserLimits", true);
16  G4cout << " PrintTrackNumberAction::bNoUserLimits " << bNoUserLimits << G4endl;
17 }

◆ ~PrintTrackNumberAction()

PrintTrackNumberAction::~PrintTrackNumberAction ( )
override

Definition at line 19 of file PrintTrackNumberAction.cc.

19 {}

Member Function Documentation

◆ update() [1/2]

void PrintTrackNumberAction::update ( const EndOfTrack )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack *>.

Definition at line 21 of file PrintTrackNumberAction.cc.

References bNoUserLimits, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, theNoTracksThisEventNoUL, and theNoTracksToPrint.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

21  {
22  const G4Track *aTrack = (*trk)();
23 
24  theNoTracks++;
26 
27  if (bNoUserLimits) {
28  bool countTrk = true;
29  // tracks that have been killed before first step (by MinEkineCut).
30  // In fact the track makes the first step, MinEkineCut process determines
31  // that the energy is too low, set it to 0, and then at the next step
32  // the 0-energy particle dies
33  if (aTrack->GetCurrentStepNumber() == 2) {
34  const G4VProcess *proccur = aTrack->GetStep()->GetPostStepPoint()->GetProcessDefinedStep();
35  if (proccur != nullptr) {
36  if (proccur->GetProcessName() == "MinEkineCut") {
37  countTrk = false;
38  } else {
39  // for e+, last step is annihil, while previous is MinEkineCut
40  const G4VProcess *procprev = aTrack->GetStep()->GetPreStepPoint()->GetProcessDefinedStep();
41  if (procprev != nullptr) {
42  if (procprev->GetProcessName() == "MinEkineCut") {
43  countTrk = false;
44  }
45  }
46  }
47  }
48  }
49  if (countTrk) {
52  if (theNoTracksToPrint > 0) {
54  G4cout << "PTNA: Simulating Track Number = " << theNoTracksThisEventNoUL << G4endl;
55  }
56  }
57  }
58  } else {
59  if (theNoTracksToPrint > 0) {
61  G4cout << "PTNA: Simulating Track Number = " << theNoTracksThisEvent << G4endl;
62  }
63  }
64  }
65 }

◆ update() [2/2]

void PrintTrackNumberAction::update ( const EndOfEvent )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent *>.

Definition at line 67 of file PrintTrackNumberAction.cc.

References bNoUserLimits, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, and theNoTracksThisEventNoUL.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

67  {
68  const G4Event *g4e = (*e)();
69  G4cout << "PTNA: Event simulated= " << g4e->GetEventID() << " #tracks= ";
70  if (bNoUserLimits) {
71  G4cout << theNoTracksThisEventNoUL << " Total #tracks in run= " << theNoTracksNoUL
72  << " counting killed by UL= " << theNoTracks << G4endl;
74  } else {
75  G4cout << theNoTracksThisEvent << " Total #tracks in run= " << theNoTracks << G4endl;
77  }
78 }

Member Data Documentation

◆ bNoUserLimits

bool PrintTrackNumberAction::bNoUserLimits
private

Definition at line 26 of file PrintTrackNumberAction.h.

Referenced by PrintTrackNumberAction(), and update().

◆ theNoTracks

int PrintTrackNumberAction::theNoTracks
private

Definition at line 21 of file PrintTrackNumberAction.h.

Referenced by update().

◆ theNoTracksNoUL

int PrintTrackNumberAction::theNoTracksNoUL
private

Definition at line 23 of file PrintTrackNumberAction.h.

Referenced by update().

◆ theNoTracksThisEvent

int PrintTrackNumberAction::theNoTracksThisEvent
private

Definition at line 22 of file PrintTrackNumberAction.h.

Referenced by update().

◆ theNoTracksThisEventNoUL

int PrintTrackNumberAction::theNoTracksThisEventNoUL
private

Definition at line 24 of file PrintTrackNumberAction.h.

Referenced by update().

◆ theNoTracksToPrint

int PrintTrackNumberAction::theNoTracksToPrint
private

Definition at line 25 of file PrintTrackNumberAction.h.

Referenced by PrintTrackNumberAction(), and update().