CMS 3D CMS Logo

Public Member Functions | Private Attributes

PrintTrackNumberAction Class Reference

#include <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, gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), and theNoTracksToPrint.

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

Definition at line 20 of file PrintTrackNumberAction.cc.

{}

Member Function Documentation

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, gather_cfg::cout, theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, theNoTracksThisEventNoUL, and theNoTracksToPrint.

{
    const G4Track * aTrack = (*trk)(); 

    theNoTracks++;
    theNoTracksThisEvent++;

    if (bNoUserLimits) 
    {
        bool countTrk = 1;
        // tracks that have been killed before first step (by MinEkineCut). 
        // In fact the track makes the first step, MinEkineCut process determines 
        // that the energy is too low, set it to 0, and then at the next step 
        // the 0-energy particle dies
        if (aTrack->GetCurrentStepNumber() == 2) 
        {
            const G4VProcess* proccur = 
                aTrack->GetStep()->GetPostStepPoint()->GetProcessDefinedStep();
            if (proccur != 0)
            {
                if (proccur->GetProcessName() == "MinEkineCut") 
                {
                    countTrk = false;
                } 
                else 
                {
                    // for e+, last step is annihil, while previous is MinEkineCut
                    const G4VProcess* procprev = 
                        aTrack->GetStep()->GetPreStepPoint()->GetProcessDefinedStep();
                    if (procprev != 0)
                    {
                        if (procprev->GetProcessName() == "MinEkineCut") 
                        {
                            countTrk = false;
                        }
                    }
                }
            }
        }
        if (countTrk) 
        {
            theNoTracksNoUL++;
            theNoTracksThisEventNoUL++;
            if (theNoTracksToPrint > 0) 
            {
                if (theNoTracksThisEventNoUL%theNoTracksToPrint == 0) 
                {
                    std::cout << "PTNA: Simulating Track Number = " 
                              << theNoTracksThisEventNoUL << std::endl;
                }
            }
        }
    } 
    else 
    {
        if (theNoTracksToPrint > 0) 
        {
            if (theNoTracksThisEvent%theNoTracksToPrint == 0) 
            {
                std::cout << "PTNA: Simulating Track Number = " 
                          << theNoTracksThisEvent << std::endl;
            }
        }
    }
}
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, gather_cfg::cout, theNoTracks, theNoTracksNoUL, theNoTracksThisEvent, and theNoTracksThisEventNoUL.

{
    const G4Event * g4e = (*e)(); 
    std::cout << "PTNA: Event simulated= " << g4e->GetEventID() << " #tracks= ";
    if (bNoUserLimits) 
    {
        std::cout << theNoTracksThisEventNoUL << "  Total #tracks in run= " 
                  << theNoTracksNoUL << " counting killed by UL= " << theNoTracks 
                  << std::endl;
        theNoTracksThisEventNoUL = 0;
    } 
    else 
    {
        std::cout << theNoTracksThisEvent << "  Total #tracks in run= " 
                  << theNoTracks << std::endl;
        theNoTracksThisEvent = 0;
    }
}

Member Data Documentation

Definition at line 26 of file PrintTrackNumberAction.h.

Referenced by PrintTrackNumberAction(), and update().

Definition at line 21 of file PrintTrackNumberAction.h.

Referenced by update().

Definition at line 23 of file PrintTrackNumberAction.h.

Referenced by update().

Definition at line 22 of file PrintTrackNumberAction.h.

Referenced by update().

Definition at line 24 of file PrintTrackNumberAction.h.

Referenced by update().

Definition at line 25 of file PrintTrackNumberAction.h.

Referenced by PrintTrackNumberAction(), and update().