-
Notifications
You must be signed in to change notification settings - Fork 0
/
RunManager.cxx
61 lines (58 loc) · 1.74 KB
/
RunManager.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include "TFile.h"
#include "TTree.h"
#include "TRandom3.h"
#include "TStopwatch.h"
#include "EventGenerator.h"
#include "Reco.h"
#include "MyParser.h"
using namespace std;
void ppSimulation(string config_file){
vector<vector<string> > v;
ifstream config(config_file.c_str());
cout<<"Reading configuration file..."<<endl;
ColonParser(config,v);
delete gRandom;
gRandom = new TRandom3(stod(v.at(23).at(1)));
TTree* tree = new TTree("ppSimulation","ppSimulation");
EventGenerator EG(v,tree);
cout<<"Creating Output File..."<<endl;
TFile* output_file = new TFile(v.at(22).at(1).c_str(),"recreate");
cout<<"Starting simulation.."<<endl;
TStopwatch* sim_watch = new TStopwatch();
for(Int_t i=0;i<stod(v.at(21).at(1));i++){
// cout << "Event " << i<< endl;
EG.NewEvent();
if(i%1000==999) cout << i+1 << " generated events..." << endl;
}
sim_watch->Stop();
cout << "Simulation completed" << endl;
cout << "Starting reconstruction.." << endl;
TStopwatch* reco_watch = new TStopwatch();
Reco Reconstruction(v,tree);
reco_watch->Stop();
tree->Write();
delete tree;
cout << "Closing Output File: " << output_file->GetName() << endl;
output_file->Close();
cout << "Reconstruction completed" << endl;
cout << "************SIMULATION PERFORMANCE************" <<endl;
sim_watch->Print("u");
cout << "**********RECONSTRUCTION PERFORMANCE**********" <<endl;
reco_watch->Print("u");
delete output_file;
delete sim_watch;
delete reco_watch;
}
# ifndef __CINT__
int main(int argc, char *argv[])
{
if(argc==1)cout << "CONFIG FILE MISSING"<< endl<<"TERMINATING..."<< endl;
else ppSimulation(argv[1]);
return 0;
}
# endif