-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompilereference_4e_data.C
139 lines (96 loc) · 3.1 KB
/
compilereference_4e_data.C
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
#if !defined(__CINT__) || defined(__MAKECINT__)
#include "HZZ4LeptonsAnalysis_4e.h"
#include <TTree.h>
#include <TFile.h>
#include <TString.h>
#include <TROOT.h>
#include <iostream>
#include <TSystem.h>
#include <TH2.h>
#include "TChain.h"
#include <stdlib.h>
#include <TDCacheFile.h>
#endif
using namespace std;
int main (int argc, char ** argv){
cout << "Ciao" << endl;
string site=argv[7];
cout << site << " configuration" <<endl;
string dataconf=argv[8];
if (dataconf.find("2012_postICHEP")<15) dataconf="2012";
cout << dataconf << " data configuration" <<endl;
string mcconf=argv[9];
cout << mcconf << " mc configuration" <<endl;
// data
ifstream fdata;
fdata.open(argv[5]);
cout << "Data samples" << endl;
const int ndata = atoi(argv[6]);
string datasamples[ndata];
for(int i=0;i<ndata;i++){
fdata >> datasamples[i];
cout << "Sample=" << datasamples[i] << endl;
}
//
float lumifb=4710./1000.;
Double_t mH=150.;
cout << "mH= " << mH << endl;
// data
bool runondata=true;
if (runondata==true){
bool itera=false;
//if (mH<=160.){
// if (i==0) itera=true;
//}
//else {
itera=true;
//}
for(int i=0;i<ndata && itera==true;i++){
string name= "roottree_leptons_crab_";
name.append(datasamples[i]);
name.append(".root");
TString dirInput;
if ( site.find("CERN")<5 ){
dirInput="/castor/cern.ch/user/n/ndefilip/Paper/data"; // to run at CERN
}
else if (site.find("DESY")<5){
dirInput="/nfs/dust/test/cmsdas/school16/HZZ4lExercise/data"; //to run at DESY
}
else if ( site.find("FNAL")<5 && name.find("2011")<38){
dirInput="dcap://cmsgridftp.fnal.gov:24125/pnfs/fnal.gov/usr/cms/WAX/11/store/user/cmsdas/2014/HZZ4lExercise/data/2011";
}
else if ( site.find("FNAL")<5 && name.find("2012")<38){
dirInput="dcap://cmsgridftp.fnal.gov:24125/pnfs/fnal.gov/usr/cms/WAX/11/store/user/cmsdas/2014/HZZ4lExercise/data/2012";
}
else {
if ( name.find("2015")<100){
dirInput="/lustreold/cms/store/user/gminiell/MonoHiggs/Data2015_MonoHiggs_13TeV_76X_merged";
}
}
cout << "Input directory is:" << dirInput<< endl;
TString dataFile=name;
Char_t nome[300];
sprintf(nome,"%s/%s",dirInput.Data(),name.c_str());
TFile *file3;
file3 = TFile::Open(nome);
//if (site.find("FNAL")<5){
// file3 = new TDCacheFile (nome,"READ","ROOT file with trees",0);
//}
//else {
// file3 = TFile::Open(nome);
//}
cout << "Read file with name: " << nome << endl;
TTree *tree3 = (TTree*)file3->Get("HZZ4LeptonsAnalysis");
HZZ4LeptonsAnalysis make3(tree3,1.,dataconf,mcconf);
char *path=NULL;
size_t size=300;
path=getcwd(path,size);
sprintf(nome,"%s/output_%s.root",path,datasamples[i].c_str());
make3.Loop(nome);
cout << "Create file with name: " << nome << endl;
delete tree3;
file3 -> Close();
}
}
return 0;
}