Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "G4Timer.hh"
00017
00018
00019
00020 #include "RunAction.h"
00021
00022
00023
00024 #include "G4Run.hh"
00025
00026 #include "Randomize.hh"
00027
00028
00029
00030 #include "TFile.h"
00031 #include "TTree.h"
00032
00033
00034
00035 #include <ctime>
00036
00037
00038
00039 using namespace std;
00040
00041
00042
00043
00044
00045 G4Timer * RunAction::Timer = new G4Timer();
00046
00047 TFile * RunAction::File = 0;
00048
00049 TTree * RunAction::Tree = 0;
00050
00051
00052
00053 RunAction::RunAction() {}
00054
00055
00056
00057 RunAction::~RunAction() {}
00058
00059
00060
00061 void RunAction::BeginOfRunAction( const G4Run * run ) {
00062
00063
00064
00065 Timer->Start();
00066
00067
00068
00069 time_t DateTime = time( NULL );
00070
00071
00072
00073 CLHEP::HepRandom::setTheSeed( DateTime );
00074
00075
00076
00077 struct tm * GMTDateTime = gmtime( &DateTime );
00078
00079
00080
00081 G4cout << "Start of run " << run->GetRunID() << "\n"
00082 << " Number of events requested "
00083 << run->GetNumberOfEventToBeProcessed() << " "
00084 << " Number of events processed "
00085 << run->GetNumberOfEvent() << "\n"
00086 << " GMT time " << asctime( GMTDateTime )
00087 << " Random seed " << DateTime << "\n"
00088 << G4endl;
00089
00090
00091
00092 File = new TFile( "MCData.root", "RECREATE",
00093 "OLYMPUS MC data file" );
00094
00095
00096
00097 Tree = new TTree( "Tree", "OLYMPUS MC TTree" );
00098
00099 }
00100
00101
00102
00103 void RunAction::EndOfRunAction( const G4Run * run ) {
00104
00105
00106
00107 time_t DateTime = time( NULL );
00108
00109
00110
00111 struct tm * GMTDateTime = gmtime( &DateTime );
00112
00113
00114
00115 long seed = CLHEP::HepRandom::getTheSeed();
00116
00117
00118
00119 Timer->Stop();
00120
00121
00122
00123 G4cout << "\n\nEnd of run " << run->GetRunID() << "\n"
00124 << " Number of events requested "
00125 << run->GetNumberOfEventToBeProcessed() << " "
00126 << " Number of events processed "
00127 << run->GetNumberOfEvent() << "\n"
00128 << " GMT time " << asctime( GMTDateTime )
00129 << " Random seed " << seed << "\n\n"
00130 << *Timer
00131 << G4endl;
00132
00133
00134
00135 Tree->Print();
00136
00137
00138
00139 File->Write();
00140
00141 File->Close();
00142
00143 }