CMS 3D CMS Logo

Public Member Functions | Private Attributes

G4StepStatistics Class Reference

#include <G4StepStatistics.h>

Inheritance diagram for G4StepStatistics:
SimWatcher

List of all members.

Public Member Functions

 G4StepStatistics (const edm::ParameterSet &pSet)
void update (const EndOfEvent *iRun)
void update (const G4Step *iStep)

Private Attributes

unsigned int Event
edm::Service< TFileServicefs
std::map< const StepID,
unsigned int * > 
G4StatsMap
Int_t G4StepFreq [100000]
TTree * G4StepTree
bool m_verbose
Int_t PDGID [100000]
TClonesArray * Process
TClonesArray * Region

Detailed Description

Definition at line 131 of file G4StepStatistics.h.


Constructor & Destructor Documentation

G4StepStatistics::G4StepStatistics ( const edm::ParameterSet pSet) [inline]

Definition at line 143 of file G4StepStatistics.h.

References fs, G4StepFreq, G4StepTree, PDGID, Process, and Region.

                                                 : 
     m_verbose(pSet.getUntrackedParameter<bool>("verbose",false)),
     Event(0)
     {
       //Adding TFile Service output
       G4StepTree = fs->make<TTree>("G4StepTree","G4Step Tree ");
       G4StepTree->Branch("Event",&Event,"Event/I");
       G4StepTree->Branch("PDGID",&PDGID,"PDGID[100000]/I");
       Region = new TClonesArray("TObjString",100000);
       G4StepTree->Branch("Region",&Region);
       Process = new TClonesArray("TObjString",100000);
       G4StepTree->Branch("Process",&Process);
       G4StepTree->Branch("G4StepFreq",&G4StepFreq,"G4StepFreq[100000]/I");
     }

Member Function Documentation

void G4StepStatistics::update ( const G4Step *  iStep) [inline]

Definition at line 165 of file G4StepStatistics.h.

References gather_cfg::cout, G4StatsMap, StepID::GetParticlePDGID(), StepID::GetProcessName(), StepID::GetRegionName(), and m_verbose.

                                    { 
   std::cout <<"++ signal G4Step " ;
   //Dump the relevant information from the G4 step in the object mysteptest
   StepID mysteptest(iStep);
   //Add the StepID to the map, or increment if it already exists:
   if ( G4StatsMap.find(mysteptest) == G4StatsMap.end() )
     {
       //Allocating new memory for a pointer to associate with the key mysteptest
       //in our map. Initializing it to 1,will be incremented working on the value of the pointer.
       unsigned int* MyValue = new unsigned int(1);
       //Inserting the new key,value pair
       G4StatsMap.insert(std::make_pair(mysteptest, MyValue));
     }
   else
     {
       //Incrementing the value of the pointer by 1
       *G4StatsMap[mysteptest] = *G4StatsMap[mysteptest] + 1;
        }
   
   //If the verbose flag is set, then dump the information
   if (m_verbose) {
     std::cout << " StepID RegionName: "<< mysteptest.GetRegionName();
     std::cout << " StepID ProcessName: "<< mysteptest.GetProcessName();
     std::cout << " StepID ParticlePDGID: "<< mysteptest.GetParticlePDGID();
   }
   std::cout<<std::endl;
}
void G4StepStatistics::update ( const EndOfEvent iRun) [inline]

Definition at line 199 of file G4StepStatistics.h.

References gather_cfg::cout, G4StatsMap, G4StepFreq, G4StepTree, getHLTprescales::index, m_verbose, PDGID, and ExpressReco_HICollisions_FallBack::step.

                                      {
  std::cout <<"++ signal EndOfEvent " <<std::endl;
  Event++;
  
  //Dumping the map in the log if verbose is chosen:
  if(m_verbose) {
    std::cout <<" G4StatsMap size is: "<<G4StatsMap.size()<<std::endl;
  }
  int index(0);
  for (std::map<const StepID,unsigned int*>::const_iterator step = G4StatsMap.begin(); step != G4StatsMap.end(); ++step, ++index){
    if(m_verbose) {
      std::cout <<" G4StatsMap step is: "<<step->first.GetRegionName()<<" "<<step->first.GetProcessName()<<" "<<step->first.GetParticlePDGID();//<<" "<<step->first.GetTrackID() ;
      std::cout <<" Number of such steps: "<< *step->second <<std::endl;
    }
    //Rolling the map into 5 "arrays", containing the StepID information and the G4Step statistics
    PDGID[index]=step->first.GetParticlePDGID();
    new ((*Region)[index]) TObjString (step->first.GetRegionName());
    new ((*Process)[index]) TObjString (step->first.GetProcessName());
    G4StepFreq[index]=*step->second;
  }
  
  G4StepTree->Fill();
}

Member Data Documentation

unsigned int G4StepStatistics::Event [private]

Definition at line 232 of file G4StepStatistics.h.

Definition at line 230 of file G4StepStatistics.h.

Referenced by G4StepStatistics().

std::map<const StepID,unsigned int*> G4StepStatistics::G4StatsMap [private]

Definition at line 229 of file G4StepStatistics.h.

Referenced by update().

Int_t G4StepStatistics::G4StepFreq[100000] [private]

Definition at line 236 of file G4StepStatistics.h.

Referenced by G4StepStatistics(), and update().

TTree* G4StepStatistics::G4StepTree [private]

Definition at line 231 of file G4StepStatistics.h.

Referenced by G4StepStatistics(), and update().

Definition at line 226 of file G4StepStatistics.h.

Referenced by update().

Int_t G4StepStatistics::PDGID[100000] [private]

Definition at line 233 of file G4StepStatistics.h.

Referenced by G4StepStatistics(), and update().

TClonesArray* G4StepStatistics::Process [private]

Definition at line 235 of file G4StepStatistics.h.

Referenced by G4StepStatistics().

TClonesArray* G4StepStatistics::Region [private]

Definition at line 234 of file G4StepStatistics.h.

Referenced by G4StepStatistics().