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
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 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

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

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.

References MillePedeFileConverter_cfg::out, and theCreatorProcessList.

Referenced by update().

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 }

◆ DumpParticleList()

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

Definition at line 104 of file CountProcessesAction.cc.

References MillePedeFileConverter_cfg::out, and theParticleList.

Referenced by update().

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 }

◆ DumpProcessList()

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

Definition at line 83 of file CountProcessesAction.cc.

References MillePedeFileConverter_cfg::out, and theProcessList.

Referenced by update().

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 }

◆ 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.

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

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 }
void DumpProcessList(bool printNsteps, std::ostream &out=std::cout)
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
ii
Definition: cuy.py:589

◆ 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.

References gather_cfg::cout, fDEBUG, caHitNtupletGeneratorKernels::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().

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 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25

◆ update() [3/4]

void CountProcessesAction::update ( const EndOfRun )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfRun *>.

Definition at line 77 of file CountProcessesAction.cc.

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

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

77  {
78  DumpProcessList(true);
81 }
void DumpProcessList(bool printNsteps, std::ostream &out=std::cout)
void DumpParticleList(std::ostream &out=std::cout)
void DumpCreatorProcessList(bool printNsteps, std::ostream &out=std::cout)

◆ 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.

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

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 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25

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