-
Notifications
You must be signed in to change notification settings - Fork 4
/
RunCrossSection.cxx
75 lines (56 loc) · 1.88 KB
/
RunCrossSection.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "ThinSlice.h"
#include "Unfold.h"
#include "EventType.h"
#include "EventSelection.h"
#include "TChain.h"
#include "json/json.h"
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char ** argv){
bool found_config = false;
string config_file;
for (int iArg = 1; iArg < argc; iArg++) {
if (!strcasecmp(argv[iArg],"-c")) {
config_file = argv[++iArg];
found_config = true;
}
if (!strcasecmp(argv[iArg],"-h")) {
std::cout << "Usage: RunCrossSection " <<
"-c config.json " << std::endl;
return 1;
}
}
if (!found_config){
cout<<"Error: no configuration file was provided! Please provide with '-i'" <<endl;
return 1;
}
Json::Value root;
ifstream file(config_file);
file >> root;
cout<<root<<endl;
//cout<<root["mcfile"].asString()<<endl;
TChain *mcchain = new TChain();
//chain->Add("/data/tjyang/dune/pduneana_Prod4.1_5_11_21.root/pduneana/beamana");
//chain->Add("/data/tjyang/dune/pduneana_Prod4_1GeV_5_8_21.root/pduneana/beamana");
//mcchain->Add("pduneana_mc.root/pduneana/beamana"); // test
mcchain->Add(Form("%s/pduneana/beamana", root["mcfile"].asString().c_str()));
TChain *datachain = new TChain();
//datachain->Add("pduneana.root/pduneana/beamana"); // test
datachain->Add(Form("%s/pduneana/beamana", root["datafile"].asString().c_str()));
Unfold uf(pi::nthinslices+2, -1, pi::nthinslices+1);
anavar mcevt(mcchain);
ThinSlice mcths;
mcths.SetOutputFileName(root["mcoutfile"].asString());
mcths.Run(mcevt, uf, -1);
/*anavar dataevt(datachain);
ThinSlice dataths;
dataths.SetOutputFileName(root["dataoutfile"].asString());
dataths.Run(dataevt, uf, -1);
ThinSlice cosmicsths;
cosmicsths.SetSelectCosmics(true);
cosmicsths.SetOutputFileName(root["cosmicsoutfile"].asString());
cosmicsths.Run(dataevt, uf, -1);*/
return 0;
}