66 |
|
string output = cl.get_value<string> ("output", "mcrsp.root"); |
67 |
|
string selection = cl.get_value<string> ("selection", "njt>0"); |
68 |
|
float drmax = cl.get_value<float> ("drmax", 0.3); |
69 |
+ |
float jtetmin = cl.get_value<float> ("jtetmin", 0.0); |
70 |
+ |
float jtetmax = cl.get_value<float> ("jtetmax", 1e06); |
71 |
+ |
float jtetamin = cl.get_value<float> ("jtetamin", 0.0); |
72 |
+ |
float jtetamax = cl.get_value<float> ("jtetamax", 9.9); |
73 |
|
short applyjes = cl.get_value<short> ("applyjes", 0); |
74 |
|
string treename = cl.get_value<string> ("treename", "t"); |
75 |
|
float nsigma = cl.get_value<float> ("nsigma", 3.0); |
146 |
|
t->SetBranchAddress("jtemf", jtemf); |
147 |
|
t->SetBranchAddress("jtgenet",jtgenet); |
148 |
|
t->SetBranchAddress("jtgendr",jtgendr); |
149 |
< |
|
150 |
< |
if (t->FindBranch("jtjes")) t->SetBranchAddress("jtjes", jtjes); |
151 |
< |
else |
149 |
> |
|
150 |
> |
vector<TBranch*> branches; |
151 |
> |
branches.push_back(t->GetBranch("weight")); |
152 |
> |
branches.push_back(t->GetBranch("njt")); |
153 |
> |
branches.push_back(t->GetBranch("jtet")); |
154 |
> |
branches.push_back(t->GetBranch("jteta")); |
155 |
> |
branches.push_back(t->GetBranch("jtphi")); |
156 |
> |
branches.push_back(t->GetBranch("jtemf")); |
157 |
> |
branches.push_back(t->GetBranch("jtgenet")); |
158 |
> |
branches.push_back(t->GetBranch("jtgendr")); |
159 |
> |
|
160 |
> |
if (t->FindBranch("jtjes")) { |
161 |
> |
t->SetBranchAddress("jtjes", jtjes); |
162 |
> |
branches.push_back(t->GetBranch("jtjes")); |
163 |
> |
} |
164 |
> |
else { |
165 |
|
for (int i1=0;i1<100;i1++) |
166 |
|
for (int i2=0;i2<3;i2++) jtjes[i1][i2]=1.0; |
167 |
< |
|
167 |
> |
} |
168 |
|
string absrsp_xtitle = "E_{T}^{gen}-E_{T} [GeV]"; |
169 |
|
string relrsp_xtitle = "E_{T}^{rec}/E_{T}"; |
170 |
|
|
342 |
|
TTree*** tEtEmfEt(0); |
343 |
|
TTree**** tEtEmfEtaEt(0); |
344 |
|
|
345 |
< |
TFile *ftmp = new TFile("/tmp/mcrsp.root","RECREATE"); |
346 |
< |
|
345 |
> |
gROOT->cd(); |
346 |
> |
|
347 |
|
if (netbins>0) tGenEt = new TTree*[netbins]; |
348 |
|
if (netbins>0) tEt = new TTree*[netbins]; |
349 |
|
if (netabins>0) tEta = new TTree*[netabins]; |
438 |
|
|
439 |
|
cout<<jetalgs[i]<<": trees created."<<endl; |
440 |
|
|
424 |
– |
|
441 |
|
// loop over all events |
442 |
|
for (int ievt=0;ievt<nevts;ievt++) { |
443 |
|
|
444 |
< |
t->GetEntry(el->GetEntry(ievt)); |
445 |
< |
|
444 |
> |
//t->GetEntry(el->GetEntry(ievt)); |
445 |
> |
for (int ibrnch=0;ibrnch<(int)branches.size();ibrnch++) |
446 |
> |
branches[ibrnch]->GetEntry(el->GetEntry(ievt)); |
447 |
> |
|
448 |
|
// loop over all jets in the event |
449 |
|
for (int ijt=0;ijt<njt;ijt++) { |
450 |
|
|
451 |
< |
if (jtgendr[ijt]<0.0||jtgendr[ijt]>drmax) continue; |
451 |
> |
if (jtgendr[ijt]<0.0 ||jtgendr[ijt]>drmax) continue; |
452 |
> |
if (jtet[ijt]<jtetmin ||jtet[ijt]>jtetmax) continue; |
453 |
> |
if (jteta[ijt]<jtetamin||jteta[ijt]>jtetamax) continue; |
454 |
|
|
435 |
– |
//if (ijt>ijtmax) continue; |
436 |
– |
|
455 |
|
et = jtet[ijt]; |
456 |
|
genet = jtgenet[ijt]; |
457 |
|
eta = (abseta) ? std::abs(jteta[ijt]) : jteta[ijt]; |
517 |
|
d = plotfile->mkdir(jetalgs[i].c_str()); |
518 |
|
d->cd(); |
519 |
|
|
502 |
– |
cout<<"dbg1"<<endl; |
503 |
– |
|
520 |
|
// fit response histos |
521 |
|
fitHistos(hAbsRspGenEt,netbins,nsigma); |
522 |
|
fitHistos(hRelRspGenEt,netbins,nsigma); |
523 |
|
|
508 |
– |
cout<<"dbg2"<<endl; |
509 |
– |
|
524 |
|
fitHistos(hAbsRspEt, netbins,nsigma); |
525 |
|
fitHistos(hRelRspEt, netbins,nsigma); |
526 |
|
|
513 |
– |
cout<<"dbg3"<<endl; |
514 |
– |
|
527 |
|
fitHistos(hAbsRspEta, netabins,nsigma); |
528 |
|
fitHistos(hRelRspEta, netabins,nsigma); |
529 |
|
|
518 |
– |
cout<<"dbg4"<<endl; |
519 |
– |
|
530 |
|
fitHistos(hAbsRspPhi, nphibins,nsigma); |
531 |
|
fitHistos(hRelRspPhi, nphibins,nsigma); |
532 |
|
|
523 |
– |
cout<<"dbg5"<<endl; |
524 |
– |
|
533 |
|
fitHistos(hAbsRspEmf, nemfbins,nsigma); |
534 |
|
fitHistos(hRelRspEmf, nemfbins,nsigma); |
535 |
|
|
528 |
– |
cout<<"dbg6"<<endl; |
529 |
– |
|
536 |
|
fitHistos(hAbsRspEtaEt,netabins,netbins,nsigma); |
537 |
|
fitHistos(hRelRspEtaEt,netabins,netbins,nsigma); |
538 |
|
|
533 |
– |
cout<<"dbg7"<<endl; |
534 |
– |
|
539 |
|
fitHistos(hAbsRspEmfEt,nemfbins,netbins,nsigma); |
540 |
|
fitHistos(hRelRspEmfEt,nemfbins,netbins,nsigma); |
541 |
|
|
538 |
– |
cout<<"dbg8"<<endl; |
539 |
– |
|
542 |
|
fitHistos(hAbsRspEmfEtaEt,nemfbins,netabins,netbins,nsigma); |
543 |
|
fitHistos(hRelRspEmfEtaEt,nemfbins,netabins,netbins,nsigma); |
544 |
|
|
587 |
|
saveHistos(hRelRspEmfEtaEt,nemfbins,netabins,netbins); |
588 |
|
|
589 |
|
cout<<jetalgs[i]<<": histograms saved."<<endl; |
588 |
– |
|
589 |
– |
ftmp->Close(); |
590 |
– |
delete ftmp; |
591 |
– |
gSystem->Exec("rm -rf /tmp/mcrsp.root"); |
590 |
|
} |
591 |
|
|
592 |
|
plotfile->Write(); |
593 |
|
plotfile->Close(); |
594 |
|
delete plotfile; |
595 |
|
|
596 |
< |
app->Run(); |
596 |
> |
//app->Run(); |
597 |
|
|
598 |
|
return 0; |
599 |
|
} |
696 |
|
f->SetParameter(2,rms); |
697 |
|
f->SetLineWidth(1); |
698 |
|
f->SetLineColor(kRed); |
699 |
< |
histos[i]->Fit(f,"QR"); |
699 |
> |
histos[i]->Fit(f,"QR"); // Avoid TCanvas? |
700 |
|
} |
701 |
|
} |
702 |
|
|