CMS 3D CMS Logo

List of all members | 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 * >

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 BeginOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfRun *track) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *track) override
 This routine will be called when the appropriate signal arrives. More...
 
 ~CountProcessesAction () 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 BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfRun * >
 Observer ()
 
void slotForUpdate (const EndOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step * >
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 

Private Attributes

bool fDEBUG
 
mpssi theCreatorProcessList
 
psi theParticleList
 
mpssi theProcessList
 

Additional Inherited Members

Detailed Description

Definition at line 22 of file CountProcessesAction.h.

Constructor & Destructor Documentation

◆ CountProcessesAction()

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

Definition at line 14 of file CountProcessesAction.cc.

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

◆ ~CountProcessesAction()

CountProcessesAction::~CountProcessesAction ( )
override

Definition at line 17 of file CountProcessesAction.cc.

17 {}

Member Function Documentation

◆ DumpCreatorProcessList()

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

Definition at line 93 of file CountProcessesAction.cc.

93  {
94  mpssi::iterator ite;
95  for (ite = theCreatorProcessList.begin(); ite != theCreatorProcessList.end(); ite++) {
96  if (!printNsteps)
97  out << "PROC-CREATOR_LIST " << (*ite).first.first << " : " << (*ite).first.second << std::endl;
98  else if ((*ite).second != 0)
99  out << "PROC_CREATOR_COUNT " << (*ite).first.first << " : " << (*ite).first.second << " = " << (*ite).second
100  << std::endl;
101  }
102 }

References MillePedeFileConverter_cfg::out, and theCreatorProcessList.

Referenced by update().

◆ DumpParticleList()

void CountProcessesAction::DumpParticleList ( std::ostream &  out = std::cout)

Definition at line 104 of file CountProcessesAction.cc.

104  {
105  psi::iterator ite;
106  for (ite = theParticleList.begin(); ite != theParticleList.end(); ite++) {
107  if ((*ite).second != 0)
108  out << "PART_LIST: " << (*ite).first << " = " << (*ite).second << std::endl;
109  }
110 }

References MillePedeFileConverter_cfg::out, and theParticleList.

Referenced by update().

◆ DumpProcessList()

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

Definition at line 83 of file CountProcessesAction.cc.

83  {
84  mpssi::iterator ite;
85  for (ite = theProcessList.begin(); ite != theProcessList.end(); ite++) {
86  if (!printNsteps)
87  out << "PROC_LIST " << (*ite).first.first << " : " << (*ite).first.second << std::endl;
88  else if ((*ite).second != 0)
89  out << "PROC_COUNT " << (*ite).first.first << " : " << (*ite).first.second << " = " << (*ite).second << std::endl;
90  }
91 }

References MillePedeFileConverter_cfg::out, and theProcessList.

Referenced by update().

◆ update() [1/4]

void CountProcessesAction::update ( const BeginOfRun )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 19 of file CountProcessesAction.cc.

19  {
20  G4ParticleTable *partTable = G4ParticleTable::GetParticleTable();
21  int siz = partTable->size();
22  for (int ii = 0; ii < siz; ii++) {
23  G4ParticleDefinition *particle = partTable->GetParticle(ii);
24  std::string particleName = particle->GetParticleName();
25  if (fDEBUG)
26  std::cout << ii << " PCA " << particleName << " " << particle->GetPDGStable() << " " << particle->IsShortLived()
27  << std::endl;
29 
30  //--- All processes of this particle
31  G4ProcessManager *pmanager = particle->GetProcessManager();
32  G4ProcessVector *pvect = pmanager->GetProcessList();
33  int sizproc = pvect->size();
34  for (int jj = 0; jj < sizproc; jj++) {
35  std::string processName = (*pvect)[jj]->GetProcessName();
36  if (fDEBUG)
37  std::cout << jj << " PCR " << processName << std::endl;
39  }
40  }
41  DumpProcessList(false);
42 }

References gather_cfg::cout, DumpProcessList(), fDEBUG, cuy::ii, findQualityFiles::jj, HiggsValidation_cfi::particleName, SimL1EmulatorRepack_CalouGT_cff::processName, AlCaHLTBitMon_QueryRunRegistry::string, theParticleList, and theProcessList.

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

◆ update() [2/4]

void CountProcessesAction::update ( const BeginOfTrack )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 44 of file CountProcessesAction.cc.

44  {
45  //----- Fill counter of particles
46  const G4Track *aTrack = (*trk)();
47  std::string particleName = aTrack->GetDefinition()->GetParticleName();
49 
50  //----- Fill counter of Creator Processes
51  const G4VProcess *proc = aTrack->GetCreatorProcess();
53  if (proc != nullptr)
54  processName = proc->GetProcessName();
55  else
56  processName = "Primary";
57  pss parproc(particleName, processName);
58  mpssi::iterator ite = theCreatorProcessList.find(parproc);
59  if (ite == theCreatorProcessList.end())
60  theCreatorProcessList[parproc] = 1;
61  else
62  (*ite).second = (*ite).second + 1;
63  if (fDEBUG)
64  std::cout << " creator " << particleName << " " << processName << theCreatorProcessList.size() << std::endl;
65 }

References gather_cfg::cout, fDEBUG, if(), HiggsValidation_cfi::particleName, ValidateTausOnZEEFastSim_cff::proc, SimL1EmulatorRepack_CalouGT_cff::processName, AlCaHLTBitMon_QueryRunRegistry::string, theCreatorProcessList, and theParticleList.

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

◆ update() [3/4]

void CountProcessesAction::update ( const EndOfRun )
overridevirtual

◆ update() [4/4]

void CountProcessesAction::update ( const G4Step *  )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 67 of file CountProcessesAction.cc.

67  {
69  if (aStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr)
70  processName = aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
71  else
72  processName = "User Limit";
73  std::string particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
75 }

References HiggsValidation_cfi::particleName, SimL1EmulatorRepack_CalouGT_cff::processName, AlCaHLTBitMon_QueryRunRegistry::string, and theProcessList.

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

Member Data Documentation

◆ fDEBUG

bool CountProcessesAction::fDEBUG
private

Definition at line 42 of file CountProcessesAction.h.

Referenced by update().

◆ theCreatorProcessList

mpssi CountProcessesAction::theCreatorProcessList
private

Definition at line 44 of file CountProcessesAction.h.

Referenced by DumpCreatorProcessList(), and update().

◆ theParticleList

psi CountProcessesAction::theParticleList
private

Definition at line 45 of file CountProcessesAction.h.

Referenced by DumpParticleList(), and update().

◆ theProcessList

mpssi CountProcessesAction::theProcessList
private

Definition at line 43 of file CountProcessesAction.h.

Referenced by DumpProcessList(), and update().

CountProcessesAction::DumpCreatorProcessList
void DumpCreatorProcessList(bool printNsteps, std::ostream &out=std::cout)
Definition: CountProcessesAction.cc:93
pss
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
gather_cfg.cout
cout
Definition: gather_cfg.py:144
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:58
CountProcessesAction::DumpProcessList
void DumpProcessList(bool printNsteps, std::ostream &out=std::cout)
Definition: CountProcessesAction.cc:83
HiggsValidation_cfi.particleName
particleName
Definition: HiggsValidation_cfi.py:7
CountProcessesAction::theParticleList
psi theParticleList
Definition: CountProcessesAction.h:45
ValidateTausOnZEEFastSim_cff.proc
proc
Definition: ValidateTausOnZEEFastSim_cff.py:6
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CountProcessesAction::fDEBUG
bool fDEBUG
Definition: CountProcessesAction.h:42
CountProcessesAction::theCreatorProcessList
mpssi theCreatorProcessList
Definition: CountProcessesAction.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
CountProcessesAction::theProcessList
mpssi theProcessList
Definition: CountProcessesAction.h:43
cuy.ii
ii
Definition: cuy.py:589
CountProcessesAction::DumpParticleList
void DumpParticleList(std::ostream &out=std::cout)
Definition: CountProcessesAction.cc:104