4 #include "utilities.hh" 22 TString hname=
"histo";
23 TH1D
histo(hname,
"",1000,0,1.5);
24 TString
folder=
"/net/cms26/cms26r0/babymaker/babies/2016_08_10/to_renormalize/manuelf/tt/";
25 vector<TString>
files({
"TTJets_Tune",
"TTJets_HT-600to800",
"TTJets_HT-800to1200",
"TTJets_HT-1200to2500",
26 "TTJets_HT-2500toInf"});
27 vector<TString> vars({
"w_isr",
"sys_isr[0]",
"sys_isr[1]"});
28 vector<double> average;
30 vector<TChain*> chains;
32 chains.push_back(
new TChain(
"tree"));
33 chains.back()->Add(folder+
"/*"+
files[
ind]+
"*.root");
36 if(
ind>0) cout<<
" if(sample.Contains(\""<<
files[
ind]<<
"\")) {"<<endl;
37 for(
size_t ivar=0; ivar<vars.size(); ivar++){
38 chains.back()->Project(hname, vars[ivar],
"",
"goff");
39 double mean = histo.GetMean();
40 if(
ind==0) average.push_back(mean);
42 TString wanted =
"wanted_"+vars[ivar];
44 cout<<
" "<<wanted<<
" = "<<
roundNumber(mean,4,average[ivar])<<
";"<<endl;
47 if(
ind>0) cout<<
" }"<<endl;
54 int seconds = difftime(curTime,startTime);
55 cout<<endl<<
"Took "<< seconds <<
" seconds ("<<
hoursMinSec(seconds)<<
") to find average weights"<<endl<<endl;
TString hoursMinSec(long seconds)
TString roundNumber(double num, int decimals, double denom=1.)