- Timestamp:
- Sep 30, 2010, 2:47:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/extended/electromagnetic/TestEm14/src/RunAction.cc
r1230 r1337 24 24 // ******************************************************************** 25 25 // 26 // $Id: RunAction.cc,v 1. 4 2006/09/06 09:56:06maire Exp $27 // GEANT4 tag $Name: geant4-09-0 3-cand-01 $26 // $Id: RunAction.cc,v 1.5 2010/04/05 18:02:39 maire Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-01 $ 28 28 // 29 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... … … 49 49 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim, 50 50 HistoManager* histo) 51 : detector(det), primary(prim), ProcCounter(0),histoManager(histo)51 : detector(det), primary(prim), histoManager(histo) 52 52 { } 53 53 … … 67 67 CLHEP::HepRandom::showEngineStatus(); 68 68 69 ProcCounter = new ProcessesCount;70 69 totalCount = 0; 71 70 sumTrack = sumTrack2 = 0.; … … 73 72 74 73 histoManager->book(); 75 }76 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......78 79 void RunAction::CountProcesses(G4String procName)80 {81 //does the process already encounted ?82 size_t nbProc = ProcCounter->size();83 size_t i = 0;84 while ((i<nbProc)&&((*ProcCounter)[i]->GetName()!=procName)) i++;85 if (i == nbProc) ProcCounter->push_back( new OneProcessCount(procName));86 87 (*ProcCounter)[i]->Count();88 74 } 89 75 … … 113 99 //frequency of processes 114 100 G4cout << "\n Process calls frequency --->"; 115 for (size_t i=0; i< ProcCounter->size();i++) { 116 G4String procName = (*ProcCounter)[i]->GetName(); 117 G4int count = (*ProcCounter)[i]->GetCounter(); 101 std::map<G4String,G4int>::iterator it; 102 for (it = procCounter.begin(); it != procCounter.end(); it++) { 103 G4String procName = it->first; 104 G4int count = it->second; 118 105 G4cout << "\t" << procName << " = " << count; 119 106 if (procName == "Transportation") survive = count; 120 107 } 121 108 122 109 if (survive > 0) { 123 110 G4cout << "\n\n Nb of incident particles surviving after " … … 160 147 G4EmCalculator emCalculator; 161 148 G4double sumc = 0.0; 162 for ( size_t i=0; i< ProcCounter->size();i++) {163 G4String procName = (*ProcCounter)[i]->GetName();149 for (it = procCounter.begin(); it != procCounter.end(); it++) { 150 G4String procName = it->first; 164 151 G4double massSigma = 165 152 emCalculator.GetCrossSectionPerVolume(energy,particle, … … 177 164 178 165 //restore default format 179 G4cout.precision(prec); 180 181 // delete and remove all contents in ProcCounter 182 while (ProcCounter->size()>0){ 183 OneProcessCount* aProcCount=ProcCounter->back(); 184 ProcCounter->pop_back(); 185 delete aProcCount; 186 } 187 delete ProcCounter; 166 G4cout.precision(prec); 167 168 // remove all contents in procCounter 169 procCounter.clear(); 188 170 189 171 histoManager->save();
Note: See TracChangeset
for help on using the changeset viewer.