CMS 3D CMS Logo

Public Member Functions | Private Attributes

CountProcessesAction Class Reference

#include <CountProcessesAction.h>

Inheritance diagram for CountProcessesAction:
SimWatcher Observer< const BeginOfRun * > Observer< const EndOfRun * > Observer< const BeginOfTrack * > Observer< const G4Step * >

List of all members.

Public Member Functions

 CountProcessesAction (edm::ParameterSet const &p)
void DumpCreatorProcessList (bool printNsteps, std::ostream &out=std::cout)
void DumpParticleList (std::ostream &out=std::cout)
void DumpProcessList (bool printNsteps, std::ostream &out=std::cout)
void update (const G4Step *track)
 This routine will be called when the appropriate signal arrives.
void update (const EndOfRun *track)
 This routine will be called when the appropriate signal arrives.
void update (const BeginOfTrack *trk)
 This routine will be called when the appropriate signal arrives.
void update (const BeginOfRun *run)
 This routine will be called when the appropriate signal arrives.
 ~CountProcessesAction ()

Private Attributes

bool fDEBUG
mpssi theCreatorProcessList
psi theParticleList
mpssi theProcessList

Detailed Description

Definition at line 23 of file CountProcessesAction.h.


Constructor & Destructor Documentation

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

Definition at line 14 of file CountProcessesAction.cc.

    : fDEBUG(p.getUntrackedParameter<bool>("DEBUG",false))
{}
CountProcessesAction::~CountProcessesAction ( )

Definition at line 18 of file CountProcessesAction.cc.

{}

Member Function Documentation

void CountProcessesAction::DumpCreatorProcessList ( bool  printNsteps,
std::ostream &  out = std::cout 
)

Definition at line 100 of file CountProcessesAction.cc.

References theCreatorProcessList.

Referenced by update().

{    
    mpssi::iterator ite;
    for (ite = theCreatorProcessList.begin(); ite != theCreatorProcessList.end(); ite++) 
    {
        if (!printNsteps) 
            out << "PROC-CREATOR_LIST " << (*ite).first.first << " : " 
                <<(*ite) .first.second << std::endl; 
        else if ((*ite).second != 0) 
            out << "PROC_CREATOR_COUNT " << (*ite).first.first << " : " 
                <<(*ite) .first.second << " = " << (*ite).second << std::endl; 
    }
}
void CountProcessesAction::DumpParticleList ( std::ostream &  out = std::cout)

Definition at line 114 of file CountProcessesAction.cc.

References theParticleList.

Referenced by update().

{    
    psi::iterator ite;
    for (ite = theParticleList.begin(); ite != theParticleList.end(); ite++) 
    {
        if ((*ite).second != 0) 
            out << "PART_LIST: " << (*ite).first << " = " << (*ite).second << std::endl; 
    }
}
void CountProcessesAction::DumpProcessList ( bool  printNsteps,
std::ostream &  out = std::cout 
)

Definition at line 86 of file CountProcessesAction.cc.

References theProcessList.

Referenced by update().

{    
    mpssi::iterator ite;
    for (ite = theProcessList.begin(); ite != theProcessList.end(); ite++) 
    {
        if (!printNsteps) 
            out << "PROC_LIST " << (*ite).first.first << " : " 
                << (*ite) .first.second << std::endl; 
        else if ((*ite).second != 0)
            out << "PROC_COUNT " << (*ite).first.first << " : " 
                << (*ite) .first.second << " = " << (*ite).second << std::endl; 
    }
}
void CountProcessesAction::update ( const BeginOfTrack ) [virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 48 of file CountProcessesAction.cc.

References gather_cfg::cout, fDEBUG, if(), proc, AlCaHLTBitMon_QueryRunRegistry::string, theCreatorProcessList, and theParticleList.

{
    //----- Fill counter of particles
    const G4Track * aTrack = (*trk)();
    std::string particleName = aTrack->GetDefinition()->GetParticleName();
    theParticleList[particleName]++;

    //----- Fill counter of Creator Processes
    const G4VProcess * proc = aTrack->GetCreatorProcess();
    std::string processName;
    if (proc != 0) processName = proc->GetProcessName();
    else processName = "Primary";
    pss parproc(particleName,processName);
    mpssi::iterator ite = theCreatorProcessList.find(parproc);
    if (ite == theCreatorProcessList.end()) theCreatorProcessList[ parproc ] = 1;
    else (*ite).second = (*ite).second +1; 
    if (fDEBUG) 
        std::cout << " creator " << particleName << " " << processName 
                  << theCreatorProcessList.size() << std::endl;
}
void CountProcessesAction::update ( const G4Step *  ) [virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 69 of file CountProcessesAction.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and theProcessList.

{
    std::string processName;
    if(aStep->GetPostStepPoint()->GetProcessDefinedStep() != 0)
        processName = aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
    else processName = "User Limit";
    std::string particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
    theProcessList[pss(particleName,processName)] = theProcessList[pss(particleName,processName)] + 1;
}
void CountProcessesAction::update ( const EndOfRun ) [virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfRun * >.

Definition at line 79 of file CountProcessesAction.cc.

References DumpCreatorProcessList(), DumpParticleList(), and DumpProcessList().

void CountProcessesAction::update ( const BeginOfRun ) [virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 20 of file CountProcessesAction.cc.

References gather_cfg::cout, DumpProcessList(), fDEBUG, findQualityFiles::jj, AlCaHLTBitMon_QueryRunRegistry::string, theParticleList, and theProcessList.

{
    G4ParticleTable * partTable = G4ParticleTable::GetParticleTable();
    int siz = partTable->size();
    for (int ii= 0; ii < siz; ii++)
    {
        G4ParticleDefinition * particle = partTable->GetParticle(ii);
        std::string particleName = particle->GetParticleName();
        if (fDEBUG)
            std::cout << ii << " PCA " << particleName<< " " << particle->GetPDGStable() 
                      << " " << particle->IsShortLived() << std::endl;
        theParticleList[particleName] = 0;

        //--- All processes of this particle 
        G4ProcessManager * pmanager = particle->GetProcessManager();
        G4ProcessVector * pvect = pmanager->GetProcessList();
        int sizproc = pvect->size();
        for (int jj = 0; jj < sizproc; jj++) 
        {
            std::string processName = (*pvect)[jj]->GetProcessName();
            if (fDEBUG)
                std::cout << jj << " PCR " << processName<< std::endl;
            theProcessList[pss(particleName,processName)] = 0;
        }
    }
    DumpProcessList(0);
}

Member Data Documentation

Definition at line 43 of file CountProcessesAction.h.

Referenced by update().

Definition at line 45 of file CountProcessesAction.h.

Referenced by DumpCreatorProcessList(), and update().

Definition at line 46 of file CountProcessesAction.h.

Referenced by DumpParticleList(), and update().

Definition at line 44 of file CountProcessesAction.h.

Referenced by DumpProcessList(), and update().