10 |
|
#include "utils/cmdline.h" |
11 |
|
#include "utils/hist.h" |
12 |
|
|
13 |
+ |
#include <TSystem.h> |
14 |
|
#include <TROOT.h> |
15 |
|
#include <TRint.h> |
16 |
|
#include <TFile.h> |
128 |
|
TFile* plotfile = new TFile(output.c_str(),"UPDATE"); |
129 |
|
|
130 |
|
for (unsigned int i=0;i<input.size();++i) { |
131 |
< |
TFile* f = new TFile(input[i].c_str(),"UPDATE"); if (!f->IsOpen()) return 0; |
131 |
> |
TFile* f = new TFile(input[i].c_str(),"READ"); if (!f->IsOpen()) return 0; |
132 |
|
TTree* t = (TTree*)f->Get(treename.c_str()); |
133 |
|
|
134 |
|
TEventList* el = new TEventList("sel","sel"); |
325 |
|
TTree*** tEtEmfEt(0); |
326 |
|
TTree**** tEtEmfEtaEt(0); |
327 |
|
|
328 |
+ |
TFile *ftmp = new TFile("/tmp/mcrsp.root","RECREATE"); |
329 |
+ |
|
330 |
|
if (netbins>0) tGenEt = new TTree*[netbins]; |
331 |
|
if (netbins>0) tEt = new TTree*[netbins]; |
332 |
|
if (netabins>0) tEta = new TTree*[netabins]; |
493 |
|
cout<<jetalgs[i]<<": all histograms replaced, and tree deleted."<<endl; |
494 |
|
|
495 |
|
|
496 |
+ |
plotfile->cd(); |
497 |
|
TDirectory* d = plotfile->GetDirectory(jetalgs[i].c_str()); |
498 |
|
if (0!=d) plotfile->rmdir(jetalgs[i].c_str()); |
499 |
|
d = plotfile->mkdir(jetalgs[i].c_str()); |
500 |
|
d->cd(); |
501 |
|
|
502 |
+ |
cout<<"dbg1"<<endl; |
503 |
+ |
|
504 |
|
// fit response histos |
505 |
|
fitHistos(hAbsRspGenEt,netbins,nsigma); |
506 |
|
fitHistos(hRelRspGenEt,netbins,nsigma); |
507 |
+ |
|
508 |
+ |
cout<<"dbg2"<<endl; |
509 |
|
|
510 |
|
fitHistos(hAbsRspEt, netbins,nsigma); |
511 |
|
fitHistos(hRelRspEt, netbins,nsigma); |
512 |
|
|
513 |
+ |
cout<<"dbg3"<<endl; |
514 |
+ |
|
515 |
|
fitHistos(hAbsRspEta, netabins,nsigma); |
516 |
|
fitHistos(hRelRspEta, netabins,nsigma); |
517 |
|
|
518 |
+ |
cout<<"dbg4"<<endl; |
519 |
+ |
|
520 |
|
fitHistos(hAbsRspPhi, nphibins,nsigma); |
521 |
|
fitHistos(hRelRspPhi, nphibins,nsigma); |
522 |
+ |
|
523 |
+ |
cout<<"dbg5"<<endl; |
524 |
|
|
525 |
|
fitHistos(hAbsRspEmf, nemfbins,nsigma); |
526 |
|
fitHistos(hRelRspEmf, nemfbins,nsigma); |
527 |
+ |
|
528 |
+ |
cout<<"dbg6"<<endl; |
529 |
|
|
530 |
|
fitHistos(hAbsRspEtaEt,netabins,netbins,nsigma); |
531 |
|
fitHistos(hRelRspEtaEt,netabins,netbins,nsigma); |
532 |
|
|
533 |
+ |
cout<<"dbg7"<<endl; |
534 |
+ |
|
535 |
|
fitHistos(hAbsRspEmfEt,nemfbins,netbins,nsigma); |
536 |
|
fitHistos(hRelRspEmfEt,nemfbins,netbins,nsigma); |
537 |
|
|
538 |
+ |
cout<<"dbg8"<<endl; |
539 |
+ |
|
540 |
|
fitHistos(hAbsRspEmfEtaEt,nemfbins,netabins,netbins,nsigma); |
541 |
|
fitHistos(hRelRspEmfEtaEt,nemfbins,netabins,netbins,nsigma); |
542 |
|
|
584 |
|
saveHistos(hAbsRspEmfEtaEt,nemfbins,netabins,netbins); |
585 |
|
saveHistos(hRelRspEmfEtaEt,nemfbins,netabins,netbins); |
586 |
|
|
567 |
– |
plotfile->Write(); |
568 |
– |
|
587 |
|
cout<<jetalgs[i]<<": histograms saved."<<endl; |
588 |
+ |
|
589 |
+ |
ftmp->Close(); |
590 |
+ |
delete ftmp; |
591 |
+ |
gSystem->Exec("rm -rf /tmp/mcrsp.root"); |
592 |
|
} |
593 |
|
|
594 |
|
plotfile->Write(); |
595 |
|
plotfile->Close(); |
596 |
|
delete plotfile; |
597 |
+ |
|
598 |
+ |
app->Run(); |
599 |
|
|
600 |
|
return 0; |
601 |
|
} |
706 |
|
//______________________________________________________________________________ |
707 |
|
void fitHistos(TH1F*** histos,int n1,int n2,double nsigma) |
708 |
|
{ |
709 |
+ |
if (n1==0||n2==0) return; |
710 |
|
for (int i1=0;i1<n1;i1++) fitHistos(histos[i1],n2,nsigma); |
711 |
|
} |
712 |
|
|
714 |
|
//______________________________________________________________________________ |
715 |
|
void fitHistos(TH1F**** histos,int n1,int n2,int n3,double nsigma) |
716 |
|
{ |
717 |
+ |
if (n1==0||n2==0||n3==0) return; |
718 |
|
for (int i1=0;i1<n1;i1++) fitHistos(histos[i1],n2,n3,nsigma); |
719 |
|
} |
720 |
|
|