CMS 3D CMS Logo

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 EndOfEvent *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
 ~PrintTrackNumberAction () override
 
- Public Member Functions inherited from SimWatcher
const SimWatcheroperator= (const SimWatcher &)=delete
 
 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

Detailed Description

Definition at line 11 of file PrintTrackNumberAction.h.

Constructor & Destructor Documentation

◆ PrintTrackNumberAction()

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

Definition at line 10 of file PrintTrackNumberAction.cc.

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

References bNoUserLimits, gather_cfg::cout, AlCaHLTBitMon_ParallelJobs::p, and theNoTracksToPrint.

◆ ~PrintTrackNumberAction()

PrintTrackNumberAction::~PrintTrackNumberAction ( )
override

Definition at line 18 of file PrintTrackNumberAction.cc.

18 {}

Member Function Documentation

◆ update() [1/2]

void PrintTrackNumberAction::update ( const EndOfEvent )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 66 of file PrintTrackNumberAction.cc.

66  {
67  const G4Event *g4e = (*e)();
68  std::cout << "PTNA: Event simulated= " << g4e->GetEventID() << " #tracks= ";
69  if (bNoUserLimits) {
70  std::cout << theNoTracksThisEventNoUL << " Total #tracks in run= " << theNoTracksNoUL
71  << " counting killed by UL= " << theNoTracks << std::endl;
73  } else {
74  std::cout << theNoTracksThisEvent << " Total #tracks in run= " << theNoTracks << std::endl;
76  }
77 }

References bNoUserLimits, gather_cfg::cout, theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, and theNoTracksThisEventNoUL.

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

◆ update() [2/2]

void PrintTrackNumberAction::update ( const EndOfTrack )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 20 of file PrintTrackNumberAction.cc.

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

References bNoUserLimits, gather_cfg::cout, theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, theNoTracksThisEventNoUL, and theNoTracksToPrint.

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

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

gather_cfg.cout
cout
Definition: gather_cfg.py:144
PrintTrackNumberAction::theNoTracks
int theNoTracks
Definition: PrintTrackNumberAction.h:21
PrintTrackNumberAction::bNoUserLimits
bool bNoUserLimits
Definition: PrintTrackNumberAction.h:26
PrintTrackNumberAction::theNoTracksToPrint
int theNoTracksToPrint
Definition: PrintTrackNumberAction.h:25
PrintTrackNumberAction::theNoTracksThisEvent
int theNoTracksThisEvent
Definition: PrintTrackNumberAction.h:22
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PrintTrackNumberAction::theNoTracksThisEventNoUL
int theNoTracksThisEventNoUL
Definition: PrintTrackNumberAction.h:24
PrintTrackNumberAction::theNoTracksNoUL
int theNoTracksNoUL
Definition: PrintTrackNumberAction.h:23