CMS 3D CMS Logo

PrintTrackNumberAction Class Reference

#include <SimG4Core/PrintTrackNumber/interface/PrintTrackNumberAction.h>

Inheritance diagram for PrintTrackNumberAction:

SimWatcher Observer< const EndOfEvent * > Observer< const EndOfTrack * >

List of all members.

Public Member Functions

 PrintTrackNumberAction (edm::ParameterSet const &p)
void update (const EndOfEvent *trk)
 This routine will be called when the appropriate signal arrives.
void update (const EndOfTrack *trk)
 This routine will be called when the appropriate signal arrives.
 ~PrintTrackNumberAction ()

Private Attributes

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


Detailed Description

Definition at line 11 of file PrintTrackNumberAction.h.


Constructor & Destructor Documentation

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

Definition at line 10 of file PrintTrackNumberAction.cc.

References bNoUserLimits, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::ParameterSet::getUntrackedParameter(), and theNoTracksToPrint.

00011     : theNoTracks(0), theNoTracksThisEvent(0),
00012       theNoTracksNoUL(0), theNoTracksThisEventNoUL(0)
00013 {
00014     theNoTracksToPrint = p.getUntrackedParameter<int>("EachNTrack",-1); 
00015     // do not count tracks killed by user limits (MinEkineCut for the moment only)
00016     bNoUserLimits = p.getUntrackedParameter<bool>("NoUserLimits", true); 
00017     std::cout << " PrintTrackNumberAction::bNoUserLimits " << bNoUserLimits << std::endl; 
00018 }

PrintTrackNumberAction::~PrintTrackNumberAction (  ) 

Definition at line 20 of file PrintTrackNumberAction.cc.

00020 {}


Member Function Documentation

void PrintTrackNumberAction::update ( const EndOfEvent  )  [virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 89 of file PrintTrackNumberAction.cc.

References bNoUserLimits, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, and theNoTracksThisEventNoUL.

00090 {
00091     const G4Event * g4e = (*e)(); 
00092     std::cout << "PTNA: Event simulated= " << g4e->GetEventID() << " #tracks= ";
00093     if (bNoUserLimits) 
00094     {
00095         std::cout << theNoTracksThisEventNoUL << "  Total #tracks in run= " 
00096                   << theNoTracksNoUL << " counting killed by UL= " << theNoTracks 
00097                   << std::endl;
00098         theNoTracksThisEventNoUL = 0;
00099     } 
00100     else 
00101     {
00102         std::cout << theNoTracksThisEvent << "  Total #tracks in run= " 
00103                   << theNoTracks << std::endl;
00104         theNoTracksThisEvent = 0;
00105     }
00106 }

void PrintTrackNumberAction::update ( const EndOfTrack  )  [virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 22 of file PrintTrackNumberAction.cc.

References bNoUserLimits, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, theNoTracksThisEventNoUL, and theNoTracksToPrint.

00023 {
00024     const G4Track * aTrack = (*trk)(); 
00025 
00026     theNoTracks++;
00027     theNoTracksThisEvent++;
00028 
00029     if (bNoUserLimits) 
00030     {
00031         bool countTrk = 1;
00032         // tracks that have been killed before first step (by MinEkineCut). 
00033         // In fact the track makes the first step, MinEkineCut process determines 
00034         // that the energy is too low, set it to 0, and then at the next step 
00035         // the 0-energy particle dies
00036         if (aTrack->GetCurrentStepNumber() == 2) 
00037         {
00038             const G4VProcess* proccur = 
00039                 aTrack->GetStep()->GetPostStepPoint()->GetProcessDefinedStep();
00040             if (proccur != 0)
00041             {
00042                 if (proccur->GetProcessName() == "MinEkineCut") 
00043                 {
00044                     countTrk = false;
00045                 } 
00046                 else 
00047                 {
00048                     // for e+, last step is annihil, while previous is MinEkineCut
00049                     const G4VProcess* procprev = 
00050                         aTrack->GetStep()->GetPreStepPoint()->GetProcessDefinedStep();
00051                     if (procprev != 0)
00052                     {
00053                         if (procprev->GetProcessName() == "MinEkineCut") 
00054                         {
00055                             countTrk = false;
00056                         }
00057                     }
00058                 }
00059             }
00060         }
00061         if (countTrk) 
00062         {
00063             theNoTracksNoUL++;
00064             theNoTracksThisEventNoUL++;
00065             if (theNoTracksToPrint > 0) 
00066             {
00067                 if (theNoTracksThisEventNoUL%theNoTracksToPrint == 0) 
00068                 {
00069                     std::cout << "PTNA: Simulating Track Number = " 
00070                               << theNoTracksThisEventNoUL << std::endl;
00071                 }
00072             }
00073         }
00074     } 
00075     else 
00076     {
00077         if (theNoTracksToPrint > 0) 
00078         {
00079             if (theNoTracksThisEvent%theNoTracksToPrint == 0) 
00080             {
00081                 std::cout << "PTNA: Simulating Track Number = " 
00082                           << theNoTracksThisEvent << std::endl;
00083             }
00084         }
00085     }
00086 }


Member Data Documentation

bool PrintTrackNumberAction::bNoUserLimits [private]

Definition at line 26 of file PrintTrackNumberAction.h.

Referenced by PrintTrackNumberAction(), and update().

int PrintTrackNumberAction::theNoTracks [private]

Definition at line 21 of file PrintTrackNumberAction.h.

Referenced by update().

int PrintTrackNumberAction::theNoTracksNoUL [private]

Definition at line 23 of file PrintTrackNumberAction.h.

Referenced by update().

int PrintTrackNumberAction::theNoTracksThisEvent [private]

Definition at line 22 of file PrintTrackNumberAction.h.

Referenced by update().

int PrintTrackNumberAction::theNoTracksThisEventNoUL [private]

Definition at line 24 of file PrintTrackNumberAction.h.

Referenced by update().

int PrintTrackNumberAction::theNoTracksToPrint [private]

Definition at line 25 of file PrintTrackNumberAction.h.

Referenced by PrintTrackNumberAction(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:19 2009 for CMSSW by  doxygen 1.5.4