1 |
yygao |
1.2 |
|
2 |
yygao |
1.1 |
/**_________________________________________________________________
|
3 |
|
|
class: PVEffHistograms.cc
|
4 |
|
|
|
5 |
|
|
author: Geng-yuan Jeng, UC Riverside (Geng-yuan.Jeng@cern.ch)
|
6 |
|
|
Yanyan Gao, Fermilab (ygao@fnal.gov)
|
7 |
|
|
|
8 |
yygao |
1.3 |
version $Id: PVEffHistograms.cc,v 1.2 2010/04/30 12:28:49 yygao Exp $
|
9 |
yygao |
1.1 |
1
|
10 |
|
|
________________________________________________________________**/
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
#include "UserCode/PVStudy/interface/PVEffHistograms.h"
|
14 |
|
|
#include <iostream>
|
15 |
|
|
|
16 |
|
|
//_______________________________________________________________
|
17 |
|
|
PVEffHistograms::PVEffHistograms() {
|
18 |
|
|
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
//_______________________________________________________________
|
22 |
|
|
PVEffHistograms::~PVEffHistograms() {
|
23 |
|
|
|
24 |
|
|
this->DeleteHisto();
|
25 |
|
|
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
//_______________________________________________________________
|
29 |
|
|
void PVEffHistograms::Init(TString type, TString suffix, int nTrkMin_, int nTrkMax_) {
|
30 |
|
|
|
31 |
|
|
TString methodName = suffix;
|
32 |
|
|
|
33 |
|
|
if (type == "summary") {
|
34 |
yygao |
1.3 |
h1[TString("eff_numer_ntrack"+suffix)] = new TH1D(TString("eff_numer_ntrack"+suffix),"eff ntracks numberator",nTrkMax_-nTrkMin_, nTrkMin_-0.5, nTrkMax_-0.5);
|
35 |
|
|
h1[TString("eff_denom_ntrack"+suffix)] = new TH1D(TString("eff_denom_ntrack"+suffix),"eff ntracks numberator",nTrkMax_-nTrkMin_, nTrkMin_-0.5, nTrkMax_-0.5);
|
36 |
yygao |
1.1 |
h1[TString("eff_ntrack"+suffix)] = new TH1D(TString("eff_ntrack"+suffix),"efficiency vs #tracks", nTrkMax_-nTrkMin_, nTrkMin_-0.5, nTrkMax_-0.5);
|
37 |
yygao |
1.3 |
h1[TString("fakerate_numer_ntrack"+suffix)] = new TH1D(TString("fakerate_numer_ntrack"+suffix),"fakerate ntracks numberator",nTrkMax_-nTrkMin_, nTrkMin_-0.5, nTrkMax_-0.5);
|
38 |
|
|
h1[TString("fakerate_denom_ntrack"+suffix)] = new TH1D(TString("fakerate_denom_ntrack"+suffix),"fakerate ntracks numberator",nTrkMax_-nTrkMin_, nTrkMin_-0.5, nTrkMax_-0.5);
|
39 |
|
|
h1[TString("fakerate_ntrack"+suffix)] = new TH1D(TString("fakerate_ntrack"+suffix),"fakerate vs #tracks", nTrkMax_-nTrkMin_, nTrkMin_-0.5, nTrkMax_-0.5);
|
40 |
yygao |
1.2 |
h1[TString("avgWeight_orgvtx_eff")] = new TH1D(TString("avgWeight_orgvtx_eff"),"Average Track Weight", 200, 0.0, 1.0);
|
41 |
|
|
h1[TString("avgWeight_orgvtx_ineff")] = new TH1D(TString("avgWeight_orgvtx_ineff"),"Average Track Weight", 200, 0.0, 1.0);
|
42 |
|
|
h1[TString("avgWeight_tagvtx_eff")] = new TH1D(TString("avgWeight_tagvtx_eff"),"Average Track Weight", 200, 0.0, 1.0);
|
43 |
|
|
h1[TString("avgWeight_tagvtx_ineff")] = new TH1D(TString("avgWeight_tagvtx_ineff"),"Average Track Weight", 200, 0.0, 1.0);
|
44 |
|
|
h1[TString("avgWeight_probevtx_eff")] = new TH1D(TString("avgWeight_probevtx_eff"),"Average Track Weight", 200, 0.0, 1.0);
|
45 |
|
|
h1[TString("avgWeight_probevtx_ineff")] = new TH1D(TString("avgWeight_probevtx_ineff"),"Average Track Weight", 200, 0.0, 1.0);
|
46 |
|
|
h1[TString("trackweight")] = new TH1D(TString("trackweight"),"Track Weight", 200, 0.0, 1.0);
|
47 |
|
|
h1[TString("deltazSign"+suffix)] = new TH1D(TString("deltazSign_mct"),"deltaZ significance", 200, -10, 10);
|
48 |
yygao |
1.1 |
}
|
49 |
|
|
else if (type == "generator") {
|
50 |
|
|
h1["genPart_T"] = new TH1D("genPart_T","t component of gen particles",300,-0.5,0.5);
|
51 |
|
|
h1["genPart_T"]->GetXaxis()->SetTitle("t (nanosecond)");
|
52 |
|
|
h1["genPart_cT"] = new TH1D("genPart_cT","ct component of gen particles",300,-150.,150.);
|
53 |
|
|
h1["genPart_cT"]->GetXaxis()->SetTitle("ct (mm)");
|
54 |
|
|
h1["nsimPV"] = new TH1D("nsimPV","Num of sim PV",51,-0.5,50.5);
|
55 |
|
|
}
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
//_______________________________________________________________
|
59 |
|
|
void PVEffHistograms::Fill1d(TString name, Double_t x, Double_t weight) {
|
60 |
|
|
|
61 |
|
|
h1[name]->Fill(x,weight);
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
//_______________________________________________________________
|
65 |
|
|
void PVEffHistograms::Fill2d(TString name, Double_t x, Double_t y, Double_t weight) {
|
66 |
|
|
|
67 |
|
|
h2[name]->Fill(x,y,weight);
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
//_______________________________________________________________
|
71 |
|
|
void PVEffHistograms::Print(TString extension, TString tag) {
|
72 |
|
|
|
73 |
|
|
if ( tag != "" ) tag = "_"+tag;
|
74 |
|
|
|
75 |
|
|
for(std::map<TString,TCanvas*>::const_iterator icv=cv_map.begin(); icv!=cv_map.end(); ++icv){
|
76 |
|
|
|
77 |
|
|
TString tmpname = icv->first;
|
78 |
|
|
TCanvas *acv = icv->second;
|
79 |
|
|
acv->Print(TString(tmpname+tag+"."+extension));
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
//_______________________________________________________________
|
85 |
|
|
void PVEffHistograms::Save() {
|
86 |
|
|
|
87 |
|
|
for(std::map<TString,TH1D* >::const_iterator ih=h1.begin(); ih!=h1.end(); ++ih){
|
88 |
|
|
TH1 *htemp = (TH1D*) ih->second;
|
89 |
|
|
if (htemp->GetEntries() > 0 ) htemp->Write();
|
90 |
|
|
}
|
91 |
|
|
for(std::map<TString,TH2D* >::const_iterator ih=h2.begin(); ih!=h2.end(); ++ih){
|
92 |
|
|
TH2D *htemp = (TH2D*) ih->second;
|
93 |
|
|
if (htemp->GetEntries() > 0 ) htemp->Write();
|
94 |
|
|
}
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
//_______________________________________________________________
|
98 |
|
|
void PVEffHistograms::SaveToFile(TString filename) {
|
99 |
|
|
|
100 |
|
|
foutfile = new TFile(filename,"RECREATE");
|
101 |
|
|
for(std::map<TString,TH1D* >::const_iterator ih=h1.begin(); ih!=h1.end(); ++ih){
|
102 |
|
|
TH1 *htemp = (TH1D*) ih->second;
|
103 |
|
|
htemp->Write();
|
104 |
|
|
}
|
105 |
|
|
for(std::map<TString,TH2D* >::const_iterator ih=h2.begin(); ih!=h2.end(); ++ih){
|
106 |
|
|
TH2D *htemp = (TH2D*) ih->second;
|
107 |
|
|
htemp->Write();
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
foutfile->Write();
|
111 |
|
|
foutfile->Close();
|
112 |
|
|
|
113 |
|
|
}
|