-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfinalize2012_radion_commonNtp.cpp
267 lines (175 loc) · 12.5 KB
/
finalize2012_radion_commonNtp.cpp
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#include <TMath.h>
#include <iostream>
#include <fillPlot2012_radion_commonNtp.h>
struct RedntpDirStruct {
std::string maindatadir;
std::string mainmcdir;
std::string datadir;
std::string mcdir;
};
void finalize_oneDataset_commonNtp(const std::string& redntpVersion, const std::string& dataset, const std::string& selectionType, const std::string& bTaggerType, std::vector<std::string> *datasets );
void do_haddCommand_commonNtp( const std::string& redntpVersion, const std::string& dataset, std::vector<std::string> *datasets, const std::string& selectionType, const std::string& bTaggerType );
std::string getSingleFileName_commonNtp( const std::string& redntpVersion, const std::string& dataset, const std::string& selectionType, const std::string& bTaggerType );
RedntpDirStruct get_dirs_commonNtp( const std::string& prodVersion );
int main( int argc, char* argv[] ) {
if( argc!=4 && argc!=5 ) {
std::cout << "USAGE: ./finalize2012_radion_commonNtp [redntpVersion] [dataset] [selectionType] [bTaggerType=JP or CSV]" <<std::endl;
return 13;
}
std::string redntpVersion(argv[1]);
std::string dataset(argv[2]);
std::string selectionType(argv[3]);
std::string bTaggerType="JP";
if( argc>4 ) {
std::string bTaggerType_str(argv[4]);
bTaggerType = bTaggerType_str;
}
cout << "Running analysis for bTaggerType = " << bTaggerType << endl;
std::vector<std::string> *datasets = new std::vector<std::string>;
// chiara: qui andranno messi gli altri a mano a mano che arrivano
if( dataset=="Data2012" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Data2012", selectionType, bTaggerType, datasets);
} else if( dataset=="DataABCD_regr" ) {
finalize_oneDataset_commonNtp(redntpVersion, "DataABCD_regr", selectionType, bTaggerType, datasets);
} else if( dataset=="DiPhotonBox_8TeV-pythia6" ) {
// finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonBox_Pt-10To25_8TeV-pythia6", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonBox_Pt-250ToInf_8TeV-pythia", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonBox_Pt-25To250_8TeV-pythia", selectionType, bTaggerType, datasets);
} else if( dataset=="DiPhoton_8TeV" ) {
// finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonBox_Pt-10To25_8TeV-pythia6", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonBox_Pt-250ToInf_8TeV-pythia6", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonBox_Pt-25To250_8TeV-pythia6", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonJets_8TeV-madgraph", selectionType, bTaggerType, datasets);
} else if( dataset=="DiPhoton_madgraph" ) {
finalize_oneDataset_commonNtp(redntpVersion, "DiPhotonJets_8TeV-madgraph", selectionType, bTaggerType, datasets);
} else if( dataset=="V_8TeV") {
finalize_oneDataset_commonNtp(redntpVersion, "DYJetsToLL", selectionType, bTaggerType, datasets);
// finalize_oneDataset_commonNtp(redntpVersion, "WJetsToLNu_TuneZ2Star_8TeV-madgraph-tarball_Summer12_DR53X-PU_S10_START53_V7A-v1", selectionType, bTaggerType, datasets);
} else if( dataset=="GJet_doubleEMEnriched_TuneZ2star_8TeV-pythia6" ) {
finalize_oneDataset_commonNtp(redntpVersion, "GJet_Pt-20to40_doubleEMEnriched_8TeV-pf", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "GJet_Pt-20to40_doubleEMEnriched_8TeV-pp", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "GJet_Pt40_doubleEMEnriched_8TeV-pf", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "GJet_Pt40_doubleEMEnriched_8TeV-pp", selectionType, bTaggerType, datasets);
} else if( dataset=="QCD_doubleEMEnriched_TuneZ2star_8TeV-pythia6") {
finalize_oneDataset_commonNtp(redntpVersion, "QCD_Pt-30to40_doubleEMEnriched_8TeV-ff", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "QCD_Pt-30to40_doubleEMEnriched_8TeV-pf", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "QCD_Pt-40_doubleEMEnriched_8TeV-ff", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "QCD_Pt-40_doubleEMEnriched_8TeV-pf", selectionType, bTaggerType, datasets);
} else if( dataset=="TT_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "TTbarGG", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "TTGJets_8TeV-madgraph", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "TTJets_TuneZ2star_8TeV-madgraph", selectionType, bTaggerType, datasets);
} else if( dataset=="VV_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "ZZ_TuneZ2star_8TeV", selectionType, bTaggerType, datasets);
// finalize_oneDataset_commonNtp(redntpVersion, "WW_TuneZ2star_8TeV_pythia6_tauola_Summer12_DR53X-PU_S10_START53_V7A-v1", selectionType, bTaggerType, datasets);
// finalize_oneDataset_commonNtp(redntpVersion, "WZ_TuneZ2star_8TeV_pythia6_tauola_Summer12_DR53X-PU_S10_START53_V7A-v1", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "WGToLNuG_8TeV", selectionType, bTaggerType, datasets);
// finalize_oneDataset_commonNtp(redntpVersion, "ZGToLLG_8TeV-madgraph_Summer12_DR53X-PU_S10_START53_V7A-v1", selectionType, bTaggerType, datasets);
} else if( dataset=="VGG_8TeV" ) {
// finalize_oneDataset_commonNtp(redntpVersion, "WmGG", selectionType, bTaggerType, datasets);
// finalize_oneDataset_commonNtp(redntpVersion, "WpGG", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "ZGG", selectionType, bTaggerType, datasets);
} else if( dataset=="HToGG_M-125_8TeV-pythia6" ) {
finalize_oneDataset_commonNtp(redntpVersion, "WH_ZH_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "GluGluToHToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "VBF_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
finalize_oneDataset_commonNtp(redntpVersion, "TTH_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
} else if( dataset=="WH_ZH_HToGG_M-125_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "WH_ZH_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
} else if( dataset=="WH_HToGG_M-125_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "WH_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
} else if( dataset=="ZH_HToGG_M-125_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "ZH_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
} else if( dataset=="VBF_HToGG_M-125_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "VBF_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
} else if( dataset=="GluGluToHToGG_M-125_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "GluGluToHToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
} else if( dataset=="TTH_HToGG_M-125_8TeV" ) {
finalize_oneDataset_commonNtp(redntpVersion, "TTH_HToGG_M-125_8TeV", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-300_madgraph" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-300_madgraph", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-500_madgraph" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-500_madgraph", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-700_madgraph" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-700_madgraph", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-1000_madgraph" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-1000_madgraph", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-300_regr" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-300_regr", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-500_regr" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-500_regr", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-700_regr" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-700_regr", selectionType, bTaggerType, datasets);
} else if( dataset=="Radion_M-1000_regr" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Radion_M-1000_regr", selectionType, bTaggerType, datasets);
} else if( dataset=="Graviton_M-300" ) {
finalize_oneDataset_commonNtp(redntpVersion, "Graviton_M-300", selectionType, bTaggerType, datasets);
} else {
cout << "this dataset does not exists" << endl;
}
do_haddCommand_commonNtp(redntpVersion, dataset, datasets, selectionType, bTaggerType );
return 0;
}
void finalize_oneDataset_commonNtp( const std::string& redntpProdVersion, const std::string& dataset, const std::string& selectionType, const std::string& bTaggerType, std::vector<std::string> *datasets ) {
TString dataset_tstr(dataset);
std::cout << std::endl << std::endl << std::endl << "#### Finalizing " << dataset << std::endl;
std::cout << "#### Selection: " << selectionType << std::endl;
std::cout << "#### b-Tagger: " << bTaggerType << std::endl << std::endl;
RedntpDirStruct dirs = get_dirs_commonNtp( redntpProdVersion );
fillPlot2012_radion_commonNtp* rf = new fillPlot2012_radion_commonNtp( dataset, selectionType, bTaggerType );
bool isData = ( dataset_tstr.Contains("2011") || dataset_tstr.Contains("2012") );
std::string redNtpDir;
if( isData ) {
redNtpDir = dirs.maindatadir;
redNtpDir = redNtpDir + "/" + dirs.datadir;
cout << "Running on redNtpDir = " << redNtpDir << endl;
} else {
redNtpDir = dirs.mainmcdir;
redNtpDir = redNtpDir + "/" + dirs.mcdir;
cout << "Running on redNtpDir = " << redNtpDir << endl;
}
rf->set_redNtpDir(redNtpDir);
rf->set_outputDir("finalizedTrees_"+redntpProdVersion);
rf->addFile(dataset);
rf->finalize();
delete rf;
datasets->push_back(dataset);
}
void do_haddCommand_commonNtp( const std::string& redntpVersion, const std::string& dataset, std::vector<std::string> *datasets, const std::string& selectionType, const std::string& bTaggerType ) {
if( datasets->size()<=1 ) return;
std::string hadd_command = "hadd -f " + getSingleFileName_commonNtp( redntpVersion, dataset, selectionType, bTaggerType );
std::string suffix = "";
for( unsigned i=0; i<datasets->size(); ++i )
suffix = suffix + " " + getSingleFileName_commonNtp( redntpVersion, datasets->at(i), selectionType, bTaggerType );
hadd_command += suffix;
std::string rm_command = "rm " + suffix;
system(hadd_command.c_str());
if( dataset!="HToGG_M-125_8TeV" ) //keep also separate higgs processes to quantify VH
system(rm_command.c_str());
}
std::string getSingleFileName_commonNtp( const std::string& redntpVersion, const std::string& dataset, const std::string& selectionType, const std::string& bTaggerType ) {
std::string fileName = "finalizedTrees_" + redntpVersion + "/Radion_" + dataset + "_" + selectionType + "_" + bTaggerType + ".root";
return fileName;
}
RedntpDirStruct get_dirs_commonNtp( const std::string& prodVersion ) {
RedntpDirStruct returnStruct;
if( prodVersion=="Radion" ) {
// returnStruct.maindatadir = "/xrootdfs/cms/local/crovelli/Radion/common";
// returnStruct.mainmcdir = "/xrootdfs/cms/local/crovelli/Radion/common";
// returnStruct.datadir = "radion_tree_v03";
// returnStruct.mcdir = "radion_tree_v03";
returnStruct.maindatadir = "/afs/cern.ch/work/c/crovelli/Radion/CMSSW_5_3_6/src/HHggbb";
returnStruct.mainmcdir = "/afs/cern.ch/work/c/crovelli/Radion/CMSSW_5_3_6/src/HHggbb";
returnStruct.datadir = "dataCommonNtp";
returnStruct.mcdir = "dataCommonNtp";
} else if ( prodVersion=="Radion_V05" ) {
returnStruct.maindatadir = "/afs/cern.ch/work/c/crovelli/Radion/CMSSW_5_3_6/src/HHggbb";
returnStruct.mainmcdir = "/afs/cern.ch/work/c/crovelli/Radion/CMSSW_5_3_6/src/HHggbb";
returnStruct.datadir = "dataCommonNtp_v05";
returnStruct.mcdir = "dataCommonNtp_v05";
} else {
std::cout << "-> Unknown prodVersion: '" << prodVersion << "'! Exiting." << std::endl;
exit(11);
}
return returnStruct;
}