ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Jeng/PVStudy/src/PVHistograms.cc
(Generate patch)

Comparing UserCode/Jeng/PVStudy/src/PVHistograms.cc (file contents):
Revision 1.1 by jengbou, Fri Dec 4 08:38:17 2009 UTC vs.
Revision 1.3 by yygao, Tue Jan 26 12:05:42 2010 UTC

# Line 2 | Line 2
2     class:   PVHistograms.cc
3  
4     author: Geng-yuan Jeng, UC Riverside (Geng-yuan.Jeng@cern.ch)
5 +           Yanyan Gao, Fermilab (ygao@fnal.gov)
6  
7     version $Id$
8  
# Line 9 | Line 10
10  
11  
12   #include "UserCode/PVStudy/interface/PVHistograms.h"
13 < #include "TF1.h"
13 <
14 < #include<iostream>
13 > #include <iostream>
14  
15   //_______________________________________________________________
16   PVHistograms::PVHistograms() {
# Line 30 | Line 29 | void PVHistograms::Init(TString type, TS
29  
30    TString methodName = suffix1;
31    if (suffix2 != "") suffix1 += "_" + suffix2;
33  //std::cout << "suffix1 = " << suffix1 << std::endl;
32  
33    if (type == "pvTrk") {
34      // Histograms of track properties
35      h1["nTrk"+suffix1]     = new TH1D("nTrk"+suffix1, "Num of rec tracks"+suffix1, 300,0,300);
36 <    h1["trkPt"+suffix1]    = new TH1D("trkPt"+suffix1, "Pt of rec tracks "+suffix1, 100,0,100);
36 >    h1["trkPt"+suffix1]    = new TH1D("trkPt"+suffix1, "Pt of rec tracks "+suffix1, 800,0,100);
37      h1["trkEta"+suffix1]   = new TH1D("trkEta"+suffix1, "#eta of rec tracks "+suffix1, 100,-3,3);
38      h1["trkPhi"+suffix1]   = new TH1D("trkPhi"+suffix1, "#phi of rec tracks "+suffix1, 100,-3.2,3.2);
39      h1["trkDxy"+suffix1]   = new TH1D("trkDxy"+suffix1, "Dxy of rec tracks "+suffix1, 100,-0.5,0.5);
40 <    h1["trkDz"+suffix1]    = new TH1D("trkDz"+suffix1, "Dz of rec tracks "+suffix1, 100,-50,50);
40 >    h1["trkDxyCorr"+suffix1] = new TH1D("trkDxyCorr"+suffix1, TString("BS Corrected Dxy of rec tracks "+suffix1),100,-0.5,0.5);
41 >    h1["trkDz"+suffix1]    = new TH1D("trkDz"+suffix1, "Dz of rec tracks "+suffix1, 300,-50,50);
42  
43      h1["nTrkPV"+suffix1]   = new TH1D("nTrkPV"+suffix1, "Num of rec tracks in PV"+suffix1, 300,0,300);
44 <    h1["trkPtPV"+suffix1]  = new TH1D("trkPtPV"+suffix1, "Pt of rec tracks in "+suffix1 ,100,0,100);
44 >    h1["nHWTrkPV"+suffix1]   = new TH1D("nHWTrkPV"+suffix1, "Num of rec tracks with over 0.5 weight in PV"+suffix1, 300,0,300);
45 >    h1["ndofPV"+suffix1]   = new TH1D("ndofPV"+suffix1, "PV ndof"+suffix1, 300,0,100);
46 >    h1["trkPtPV"+suffix1]  = new TH1D("trkPtPV"+suffix1, "Pt of rec tracks in "+suffix1 ,800,0,100);
47      h1["trkEtaPV"+suffix1] = new TH1D("trkEtaPV"+suffix1, "#eta of rec tracks in PV"+suffix1, 100,-3,3);
48      h1["trkPhiPV"+suffix1] = new TH1D("trkPhiPV"+suffix1, "#phi of rec tracks in PV"+suffix1, 100,-3.2,3.2);
49 <    h1["trkDxyPV"+suffix1] = new TH1D("trkDxyPV"+suffix1, "Dxy of rec tracks in PV"+suffix1, 100,-5,5);
50 <    h1["trkDzPV"+suffix1]  = new TH1D("trkDzPV"+suffix1, "Dz of rec tracks "+suffix1, 100,-50,50);
49 >    h1["trkDxyPV"+suffix1] = new TH1D("trkDxyPV"+suffix1, "Dxy of rec tracks in PV"+suffix1, 100,-0.5,0.5);
50 >    h1["trkDxyCorrPV"+suffix1] = new TH1D("trkDxyCorrPV"+suffix1, "BS corrected Dxy of rec tracks in PV"+suffix1, 100,-0.5,0.5);
51 >    h1["trkDzPV"+suffix1]  = new TH1D("trkDzPV"+suffix1, "Dz of rec tracks "+suffix1, 300,-50,50);
52      h1["nrecPV"+suffix1]   = new TH1D("nrecPV"+suffix1, "Num of rec pvtx"+suffix1, 50,0,50);
53    }
54    else if (type == "pixVtx") {
# Line 74 | Line 76 | void PVHistograms::Init(TString type, TS
76    else if (type == "misc") {
77      h1["nrecPVDiff"]     = new TH1D("nrecPVDiff","nrecPV1-nRecPV2",21,-10.5,10.5);
78      h1["nTrkPVDiff"]     = new TH1D("nTrkPVDiff","nTrkPV1-nTrkPV2",41,-20.5,20.5);
79 <    h1["nTrkPVRelDiff"]  = new TH1D("nTrkPVRelDiff","(nTrkPV1-nTrkPV2)/(nTrkPV1+nTrkPV2)",100,-1,1);
79 >    h1["nTrkPVRelDiff"]  = new TH1D("nTrkPVRelDiff","(nTrkPV1-nTrkPV2)/(nTrkPV1+nTrkPV2)",100,-1,1);  
80 >    h1["ndofPVDiff"]     = new TH1D("ndofPVDiff","ndofPV1-ndofPV2",100,-10,10);
81 >    h1["ndofPVRelDiff"]  = new TH1D("ndofPVRelDiff","(ndofPV1-ndofPV2)/(ndofPV1+ndofPV2)",100,-1,1);  
82 >    h1["twovtxzsign"]     = new TH1D("twovtxzsign", "two vtx z signficance",300,-20,20);
83      // Histograms on comparing the multi-vertices
84      // Difference in reconstructed vtx position
85      h1["min_xsep"]       = new TH1D("min_xsep", "min x diff of primary and secondary pvtx",300,0,0.1);
# Line 86 | Line 91 | void PVHistograms::Init(TString type, TS
91      // Difference in reconstructed vtx position
92      h1["min_ntrksep"]    = new TH1D("min_ntrksep", "min nTrk diff of primary and secondary pvtx",201,-50.5,150.5);
93      h1["min_sumpt2sep"]  = new TH1D("min_sumpt2sep", "min sumpt2 diff of primary and secondary pvtx",300,0,10000);
94 +
95    }
96    else if (type == "summary") {
97 <    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual pvtx"+suffix1, 800,-0.04,0.04);
98 <    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual pvtx"+suffix1, 800,-0.04,0.04);
99 <    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual pvtx"+suffix1, 800,-0.04,0.04);
100 <    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull pvtx"+suffix1, 800,-10,10);
101 <    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull pvtx"+suffix1, 800,-10,10);
102 <    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull pvtx"+suffix1, 800,-10,10);
103 <    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+suffix1+" vertex error", 100,0.,0.02);
104 <    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+suffix1+" vertex error", 100,0.,0.02);
105 <    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+suffix1+" vertex error", 100,0.,0.02);
97 >    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual pvtx"+suffix1, 800,-0.1,0.1);
98 >    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual pvtx"+suffix1, 800,-0.1,0.1);
99 >    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual pvtx"+suffix1, 800,-0.1,0.1);
100 >    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull pvtx"+suffix1, 800,-5,5);
101 >    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull pvtx"+suffix1, 800,-5,5);
102 >    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull pvtx"+suffix1, 800,-5,5);
103 >    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+suffix1+" vertex error", 200,0.,0.1);
104 >    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+suffix1+" vertex error", 200,0.,0.1);
105 >    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+suffix1+" vertex error", 200,0.,0.1);
106    }
107    else if (type == "others") {
108 <    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual of pvtx"+methodName, 100,-0.02,0.02);
108 >    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual of pvtx"+methodName, 200,-0.1,0.1);
109      h1["deltax"+suffix1]->GetXaxis()->SetTitle("cm");
110 <    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual of pvtx"+methodName, 100,-0.02,0.02);
110 >    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual of pvtx"+methodName, 200,-0.1,0.1);
111      h1["deltay"+suffix1]->GetXaxis()->SetTitle("cm");
112 <    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual of pvtx"+methodName, 100,-0.02,0.02);
112 >    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual of pvtx"+methodName, 200,-0.1,0.1);
113      h1["deltaz"+suffix1]->GetXaxis()->SetTitle("cm");
114 <    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull of pvtx"+methodName, 100,-10.,10.);
115 <    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull of pvtx"+methodName, 100,-10.,10.);
116 <    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull of pvtx"+methodName, 100,-10.,10.);
117 <    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+methodName+" vertex error", 100,0.,0.02);
118 <    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+methodName+" vertex error", 100,0.,0.02);
119 <    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+methodName+" vertex error", 100,0.,0.02);
114 >    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull of pvtx"+methodName, 200,-5.,5.);
115 >    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull of pvtx"+methodName, 200,-5.,5.);
116 >    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull of pvtx"+methodName, 200,-5.,5.);
117 >    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+methodName+" vertex error", 200,0.,0.1);
118 >    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+methodName+" vertex error", 200,0.,0.1);
119 >    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+methodName+" vertex error", 200,0.,0.1);
120    }
121  
122   }
# Line 119 | Line 125 | void PVHistograms::InitA(TString type, T
125  
126    TString methodName = suffix1;
127    if (suffix2 != "") suffix1 += "_" + suffix2;
122  //std::cout << "suffix1 = " << suffix1 << std::endl;
128  
129    if (type == "analysis") {
130 <    h2["resx"+suffix1]= new TH2D("resx"+suffix1, "x-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_-0.5,nTrkMax_-0.5,400,0.,200);
130 >    h2["resx"+suffix1]= new TH2D("resx"+suffix1, "x-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,400,0.,500);
131      h2["resx"+suffix1]->SetMarkerStyle(21);
132      h2["resx"+suffix1]->SetMarkerColor(4);
133      h2["resx"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
134      h2["resx"+suffix1]->GetYaxis()->SetTitle("#mum");
135 <    h2["resy"+suffix1]= new TH2D("resy"+suffix1, "y-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_-0.5,nTrkMax_-0.5,400,0.,200);
135 >    h2["resy"+suffix1]= new TH2D("resy"+suffix1, "y-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,400,0.,500);
136      h2["resy"+suffix1]->SetMarkerStyle(21);
137      h2["resy"+suffix1]->SetMarkerColor(4);
138      h2["resy"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
139      h2["resy"+suffix1]->GetYaxis()->SetTitle("#mum");
140 <    h2["resz"+suffix1]= new TH2D("resz"+suffix1, "z-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_-0.5,nTrkMax_-0.5,400,0.,200);
140 >    h2["resz"+suffix1]= new TH2D("resz"+suffix1, "z-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,400,0.,500);
141      h2["resz"+suffix1]->SetMarkerStyle(21);
142      h2["resz"+suffix1]->SetMarkerColor(4);
143      h2["resz"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
144      h2["resz"+suffix1]->GetYaxis()->SetTitle("#mum");
145 <    h2["pullx"+suffix1]= new TH2D("pullx"+suffix1, "x-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_-0.5,nTrkMax_-0.5,100,0.,2.);
145 >    h2["pullx"+suffix1]= new TH2D("pullx"+suffix1, "x-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,100,0.,2.);
146      h2["pullx"+suffix1]->SetMarkerStyle(21);
147      h2["pullx"+suffix1]->SetMarkerColor(4);
148      h2["pullx"+suffix1]->SetBit(TH1::kCanRebin);
149      h2["pullx"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
150 <    h2["pully"+suffix1]= new TH2D("pully"+suffix1, "y-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_-0.5,nTrkMax_-0.5,100,0.,2.);
150 >    h2["pully"+suffix1]= new TH2D("pully"+suffix1, "y-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,100,0.,2.);
151      h2["pully"+suffix1]->SetMarkerStyle(21);
152      h2["pully"+suffix1]->SetMarkerColor(4);
153      h2["pully"+suffix1]->SetBit(TH1::kCanRebin);
154      h2["pully"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
155 <    h2["pullz"+suffix1]= new TH2D("pullz"+suffix1, "z-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_-0.5,nTrkMax_-0.5,100,0.,2.);
155 >    h2["pullz"+suffix1]= new TH2D("pullz"+suffix1, "z-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,100,0.,2.);
156      h2["pullz"+suffix1]->SetMarkerStyle(21);
157      h2["pullz"+suffix1]->SetMarkerColor(4);
158      h2["pullz"+suffix1]->SetBit(TH1::kCanRebin);
# Line 157 | Line 162 | void PVHistograms::InitA(TString type, T
162  
163   }
164  
160
161 //_______________________________________________________________
162 void PVHistograms::Counter(TString name) {
163
164  h1["counter"]->Fill(name, 1);
165 }
166
165   //_______________________________________________________________
166   void PVHistograms::Fill1d(TString name, Double_t x, Double_t weight) {
167  
# Line 174 | Line 172 | void PVHistograms::Fill1d(TString name,
172   void PVHistograms::Fill2d(TString name, Double_t x, Double_t y, Double_t weight) {
173  
174    h2[name]->Fill(x,y,weight);
177        
175   }
176  
177   //_______________________________________________________________
# Line 187 | Line 184 | void PVHistograms::Print(TString extensi
184      TString tmpname = icv->first;
185      TCanvas *acv = icv->second;
186      acv->Print(TString(tmpname+tag+"."+extension));
187 <  }              
187 >  }
188  
189   }
190 +
191   //_______________________________________________________________
192   void PVHistograms::Save() {
193          
# Line 215 | Line 213 | void PVHistograms::SaveToFile(TString fi
213      TH2D *htemp = (TH2D*) ih->second;
214      htemp->Write();
215    }
216 <                
216 >  
217    foutfile->Write();
218    foutfile->Close();
219 <        
219 >  
220   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines