-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cc
More file actions
executable file
·191 lines (164 loc) · 4.78 KB
/
main.cc
File metadata and controls
executable file
·191 lines (164 loc) · 4.78 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <TString.h>
#include <TSystem.h>
#include <TFile.h>
#include <TTree.h>
#include <TMinuit.h>
//#include <pthread.h>
//#include <unistd.h>
//#include "TThread.h"
#include "AnaInput.h"
#include "TestGen.h"
#include "Trigger.h"
#include "Histogram.h"
#include "Background.h"
#include "BackgroundStudy.h"
#include "Systematic.h"
#include "Output.h"
#include "Tester.h"
#include "GenAna.h"
//#include "mtest.h"
using namespace std;
int main( int argc, const char* argv[] ) {
string datacardfile = ( argc > 1 ) ? argv[1] : "DataCard.txt";
//AnaInput *Input = new AnaInput( datacardfile );
AnaInput *Input = AnaInput::Instance() ;
Input->SetDatacard( datacardfile ) ;
// method to read root files
string dataFileNames ;
Input->GetParameters( "TheData", &dataFileNames );
vector<string> mcFileNames ;
Input->GetParameters( "TheMC", &mcFileNames );
int module = -1 ;
Input->GetParameters( "Module", & module ) ;
if ( module == 0 ) {
TestGen *tgen = new TestGen( datacardfile ) ;
tgen->ReadTree( dataFileNames );
delete tgen ;
//Histogram *histo = new Histogram() ;
//histo->DrawHistograms();
//delete histo ;
}
if ( module == 1 ) {
Trigger *trg = new Trigger( datacardfile ) ;
trg->ReadTree( dataFileNames);
trg->Plot() ;
delete trg ;
//trg->EventList( dataFileNames ) ;
//trg->CutFlow( dataFileNames ) ;
}
if ( module == 2 ) {
Histogram *histo = new Histogram() ;
histo->DrawHistograms();
delete histo ;
}
if ( module == 3 ) {
TestGen *tgen = new TestGen( datacardfile ) ;
//vector<double >normV = Input->NormalizeComponents( datacardfile );
vector<string> mcIdx ;
Input->GetParameters( "mcIndex", &mcIdx );
for ( size_t i=0 ; i < mcFileNames.size() ; i++ ) {
//if ( i!= 4 && i!= 5 && i!= 6 && i!=1 ) continue ;
tgen->ReadTree( mcFileNames[i], 1., mcIdx[i] );
}
delete tgen ;
//Histogram *histo = new Histogram( ) ;
//histo->DrawHistograms();
//delete histo ;
}
if ( module == 4 ) {
Output* out = new Output( datacardfile ) ;
out->Produce() ;
delete out ;
}
if ( module == 5 ) {
Output* out = new Output( datacardfile ) ;
out->ReadHisto() ;
delete out ;
}
if ( module == 6 ) {
//Background * bg = new Background( datacardfile ) ;
//bg->RunEstimation( dataFileNames ) ;
//bg->SpikeShape() ;
//delete bg ;
Trigger *trg = new Trigger( datacardfile ) ;
trg->HistoOpen( );
trg->Plot() ;
delete trg ;
}
if ( module == 11 ) {
Output* out = new Output( datacardfile ) ;
out->ProduceMC() ;
delete out ;
}
if ( module == 12 ) {
Output* out = new Output( datacardfile ) ;
out->ProduceGen() ;
delete out ;
}
if ( module == 7 || module == 8 || module == 9 ) {
BackgroundStudy * bgS = new BackgroundStudy( datacardfile ) ;
if ( module == 7 ) {
bgS->CreateHistograms() ;
bgS->SimpleRun() ;
bgS->WriteDrawHistograms() ;
}
if ( module == 8 ) {
vector<double >normV = Input->NormalizeComponents( datacardfile );
bgS->CreateHistograms() ;
for ( size_t i = 0 ; i < mcFileNames.size() ; i++ ) {
cout<<" Runing MC : "<< mcFileNames[i] << endl ;
bgS->SimpleRun( mcFileNames[i], normV[i] ) ;
//bgS->Run( normV[i] ) ;
}
bgS->WriteDrawHistograms() ;
}
if ( module == 9 ) {
//if ( isData == 0 ) bgS->Run( mcFileNames[0] ) ;
bgS->OpenAllHistograms() ;
bgS->DrawAllHistograms() ;
}
delete bgS ;
}
if ( module == 10 ) {
Systematic* syst = new Systematic( datacardfile ) ;
syst->McDataCompare() ;
delete syst ;
}
if ( module == 13 ) {
GenAna *genA = new GenAna( datacardfile ) ;
genA->ReadTree( dataFileNames );
/*
vector<string> mcIdx ;
Input->GetParameters( "mcIndex", &mcIdx );
for ( size_t i=0 ; i < mcFileNames.size() ; i++ ) {
genA->ReadTree( mcFileNames[i], 1., mcIdx[i] );
}
*/
delete genA ;
}
if ( module == 20 ) {
Tester *tt = new Tester( datacardfile ) ;
tt->ReadTree( dataFileNames );
delete tt ;
}
if ( module == 21 ) {
Tester *tt = new Tester( datacardfile ) ;
tt->PlotOnly();
delete tt ;
}
delete Input ;
cout<<" Finished !!!"<<endl ;
return 0;
}
bool badCrystal( double eta , double phi ) {
bool badSeed = false ;
if ( eta > -0.75 && eta < -0.6 && phi > -1. && phi < -0.8 ) badSeed = true ;
if ( eta > 0.80 && eta < 0.95 && phi > -1.95 && phi < -1.8 ) badSeed = true ;
return badSeed ;
}