RunAction Class Reference

#include <RunAction.hh>

List of all members.

Public Member Functions

 RunAction ()
virtual ~RunAction ()
void BeginOfRunAction (const G4Run *)
void EndOfRunAction (const G4Run *)
G4int find_volume (G4VPhysicalVolume *volume)
G4int find_process (G4String process)

Private Attributes

std::map< G4VPhysicalVolume
*, G4int > 
m_volume
std::map< G4String, int > m_process
double t_begin
double t_end

Detailed Description

Definition at line 49 of file RunAction.hh.


Constructor & Destructor Documentation

RunAction::RunAction (  ) 

Definition at line 63 of file RunAction.cc.

00064 {
00065 }

RunAction::~RunAction (  )  [virtual]

Definition at line 69 of file RunAction.cc.

00070 {
00071 }


Member Function Documentation

void RunAction::BeginOfRunAction ( const G4Run *  aRun  ) 

Definition at line 75 of file RunAction.cc.

References MyAnalysisSvc::BeginOfRunAction(), MyGlobalField::getFields(), MyAnalysisSvc::GetMyAnalysisSvc(), and MyGlobalField::getObject().

00076 { 
00077   G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
00078 
00079   //inform the runManager to save random number seed
00080   G4RunManager::GetRunManager()->SetRandomNumberStore(true);
00081 
00082         //deal with analysis
00083         MyAnalysisSvc::GetMyAnalysisSvc()->BeginOfRunAction();
00084 
00085         //t_begin = (double)clock();
00086 
00087     FieldList* fields = MyGlobalField::getObject()->getFields();
00088     if (fields) {
00089         if (fields->size()>0) {
00090             FieldList::iterator i;
00091             for (i=fields->begin(); i!=fields->end(); ++i) {
00092                 (*i)->construct();
00093                 //G4cout << "Constructed field " << G4endl;
00094             }
00095         }
00096     }
00097 
00098         /*
00099 //#################################################################################333  
00100         //Print dE/dx tables with binning identical to the Geant3 JMATE bank.
00101         //The printout is readable as Geant3 ffread data cards (by the program g4mat).
00102         //
00103         const G4double tkmin=10*keV, tkmax=20*GeV;
00104         const G4int nbin=100;
00105         G4double tk[nbin];
00106 
00107         const G4int ncolumn = 1;
00108 
00109         //compute the kinetic energies
00110         //
00111         const G4double dp = std::log10(tkmax/tkmin)/nbin;
00112         const G4double dt = std::pow(10.,dp);
00113         tk[0] = tkmin;
00114         for (G4int i=1; i<nbin; ++i) tk[i] = tk[i-1]*dt;
00115 
00116         //print the kinetic energies
00117         //
00118         std::ios::fmtflags mode = G4cout.flags();
00119         G4cout.setf(std::ios::fixed,std::ios::floatfield);
00120         G4int  prec = G4cout.precision(3);
00121 
00122         //print the dE/dx tables
00123         //
00124         G4cout.setf(std::ios::scientific,std::ios::floatfield);
00125 
00126         G4ParticleDefinition*
00127         //      part = G4ParticleTable::GetParticleTable()->FindParticle("e-");
00128                         part = G4ParticleTable::GetParticleTable()->FindParticle("mu-");
00129 
00130         G4ProductionCutsTable* theCoupleTable =
00131                 G4ProductionCutsTable::GetProductionCutsTable();
00132         size_t numOfCouples = theCoupleTable->GetTableSize();
00133         const G4MaterialCutsCouple* couple = 0;
00134 
00135         for (size_t i=0; i<numOfCouples; i++) {
00136                 couple = theCoupleTable->GetMaterialCutsCouple(i);
00137                 const G4Material* mat = couple->GetMaterial();
00138                 G4cout << "\nLIST";
00139                 G4cout << "\nC \nC  dE/dx (MeV/cm) for " << part->GetParticleName()
00140                         << " in " << mat ->GetName() << "\nC";
00141                 G4cout.precision(6);
00142                 G4cout << "\nEnergy/MeV   dE/dx (MeV/cm)\n ";
00143                 for (G4int l=0;l<nbin; ++l)
00144                 {
00145                         G4cout << tk[l]/MeV<< "\t";
00146                         G4double dedx = G4LossTableManager::Instance()
00147                                 ->GetDEDX(part,tk[l],couple);
00148                         G4cout << dedx/(MeV/cm) << "\n";
00149                 }
00150                 G4cout << G4endl;
00151         }
00152 
00153         G4cout.precision(prec);
00154         G4cout.setf(mode,std::ios::floatfield);
00155 //#################################################################################333  
00156         */
00157 
00158 
00159 }

void RunAction::EndOfRunAction ( const G4Run *  aRun  ) 

Definition at line 163 of file RunAction.cc.

References MyAnalysisSvc::EndOfRunAction(), and MyAnalysisSvc::GetMyAnalysisSvc().

00164 {
00165 
00166         //deal with analysis
00167         MyAnalysisSvc::GetMyAnalysisSvc()->EndOfRunAction(aRun);
00168 
00169   G4int NbOfEvents = aRun->GetNumberOfEvent();
00170   if (NbOfEvents == 0) return;
00171 
00172         //t_end = clock();
00173         //double duration = (t_end-t_begin)/CLOCKS_PER_SEC;
00174         //std::cout<<"TOTAL TIME COST FOR THIS RUN:     "<<duration<<"s"<<std::endl;
00175         //std::cout<<"TIME COST PER EVENT FOR THIS RUN: "<<duration/NbOfEvents<<"s"<<std::endl;
00176 }

G4int RunAction::find_process ( G4String  process  )  [inline]

Definition at line 67 of file RunAction.hh.

References m_process.

00067                                       {
00068     std::map<G4String,G4int>::const_iterator cit = m_process.find(process);
00069     if ( cit != m_process.end() )
00070       return cit->second;
00071     else
00072       return -2;
00073   };

G4int RunAction::find_volume ( G4VPhysicalVolume *  volume  )  [inline]

Definition at line 59 of file RunAction.hh.

References m_volume.

00059                                               {
00060     std::map<G4VPhysicalVolume*,G4int>::const_iterator cit = m_volume.find(volume);
00061     if ( cit != m_volume.end() )
00062       return cit->second;
00063     else
00064       return 0;
00065   };


Member Data Documentation

std::map<G4String,int> RunAction::m_process [private]

Definition at line 77 of file RunAction.hh.

Referenced by find_process().

std::map<G4VPhysicalVolume*,G4int> RunAction::m_volume [private]

Definition at line 73 of file RunAction.hh.

Referenced by find_volume().

double RunAction::t_begin [private]

Definition at line 78 of file RunAction.hh.

double RunAction::t_end [private]

Definition at line 79 of file RunAction.hh.


The documentation for this class was generated from the following files:

Generated on 15 Jun 2016 for g4sim by  doxygen 1.6.1