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.4 by yygao, Sat Jan 30 18:25:53 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    }
52  else if (type == "pixVtx") {
53    // Book histograms about pixelVertices
54    h1["trkdz_pxlpvtxdz"]              = new TH1D("trkdz_pxlpvtxdz", "(Track dz - pixelpvtx dz) in cm",300,-0.5,0.5);
55    h1["trkdz_pxlpvtxdz_pxlpvtxdzerr"] = new TH1D("trkdz_pxlpvtxdz_pxlpvtxdzerr", "|Track dz - pixelpvtx dz| / pxlpvtxdzErr",300,0,100);  
56    h1["trkdz_pxlpvtxdz_trkdzerr"]     = new TH1D("trkdz_pxlpvtxdz_trkdzerr", "|Track dz - pixelpvtx dz| / trkdzErr",300,0,50);
57    h1["trkdzErr_pxlpvtx"]             = new TH1D("trkdzErr_pxlpvtxdz", "Track dzErr of leading pixelpvtx ",300,0,0.5);
58    h1["trkdzErr_pvtx"]                = new TH1D("trkdzErr_pvtx", "Track dzErr of the leading pvtx ",300,0,0.5);
59    h1["dzErr_pxlpvtx"]                = new TH1D("dzErr_pxlpvtx", "zError of the leading pvtx ",300,0,0.5);
60
61    // Compare offlinePrimaryVertices with pixelVertices
62    h1["nrecPV_minus_nrecPxlPV"]       = new TH1D("nrecPV_minus_nrecPxlPV", "nrecPV_minus_nrecPxlPV",21,-10.5,10.5);
63    h1["recxPV_minus_recxPxlPV"]       = new TH1D("recxPV_minus_recxPxlPV", "recxPV_minus_recxPxlPV",300,-0.02,0.02);
64    h1["recyPV_minus_recyPxlPV"]       = new TH1D("recyPV_minus_recyPxlPV", "recyPV_minus_recyPxlPV",300,-0.02,0.02);
65    h1["reczPV_minus_reczPxlPV"]       = new TH1D("reczPV_minus_reczPxlPV", "reczPV_minus_reczPxlPV",300,-0.1,0.1);
66  }
54    else if (type == "generator") {
55      h1["genPart_T"]      = new TH1D("genPart_T","t component of gen particles",300,-0.5,0.5);
56      h1["genPart_T"]->GetXaxis()->SetTitle("t (nanosecond)");
# Line 74 | Line 61 | void PVHistograms::Init(TString type, TS
61    else if (type == "misc") {
62      h1["nrecPVDiff"]     = new TH1D("nrecPVDiff","nrecPV1-nRecPV2",21,-10.5,10.5);
63      h1["nTrkPVDiff"]     = new TH1D("nTrkPVDiff","nTrkPV1-nTrkPV2",41,-20.5,20.5);
64 <    h1["nTrkPVRelDiff"]  = new TH1D("nTrkPVRelDiff","(nTrkPV1-nTrkPV2)/(nTrkPV1+nTrkPV2)",100,-1,1);
64 >    h1["nTrkPVRelDiff"]  = new TH1D("nTrkPVRelDiff","(nTrkPV1-nTrkPV2)/(nTrkPV1+nTrkPV2)",100,-1,1);  
65 >    h1["ndofPVDiff"]     = new TH1D("ndofPVDiff","ndofPV1-ndofPV2",100,-10,10);
66 >    h1["ndofPVRelDiff"]  = new TH1D("ndofPVRelDiff","(ndofPV1-ndofPV2)/(ndofPV1+ndofPV2)",100,-1,1);  
67 >    h1["twovtxzsign"]     = new TH1D("twovtxzsign", "two vtx z signficance",300,-20,20);
68      // Histograms on comparing the multi-vertices
69      // Difference in reconstructed vtx position
70      h1["min_xsep"]       = new TH1D("min_xsep", "min x diff of primary and secondary pvtx",300,0,0.1);
# Line 86 | Line 76 | void PVHistograms::Init(TString type, TS
76      // Difference in reconstructed vtx position
77      h1["min_ntrksep"]    = new TH1D("min_ntrksep", "min nTrk diff of primary and secondary pvtx",201,-50.5,150.5);
78      h1["min_sumpt2sep"]  = new TH1D("min_sumpt2sep", "min sumpt2 diff of primary and secondary pvtx",300,0,10000);
79 +
80    }
81    else if (type == "summary") {
82 <    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual pvtx"+suffix1, 800,-0.04,0.04);
83 <    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual pvtx"+suffix1, 800,-0.04,0.04);
84 <    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual pvtx"+suffix1, 800,-0.04,0.04);
85 <    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull pvtx"+suffix1, 800,-10,10);
86 <    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull pvtx"+suffix1, 800,-10,10);
87 <    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull pvtx"+suffix1, 800,-10,10);
88 <    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+suffix1+" vertex error", 100,0.,0.02);
89 <    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+suffix1+" vertex error", 100,0.,0.02);
90 <    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+suffix1+" vertex error", 100,0.,0.02);
82 >    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual pvtx"+suffix1, 800,-0.1,0.1);
83 >    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual pvtx"+suffix1, 800,-0.1,0.1);
84 >    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual pvtx"+suffix1, 800,-0.1,0.1);
85 >    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull pvtx"+suffix1, 800,-5,5);
86 >    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull pvtx"+suffix1, 800,-5,5);
87 >    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull pvtx"+suffix1, 800,-5,5);
88 >    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+suffix1+" vertex error", 200,0.,0.1);
89 >    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+suffix1+" vertex error", 200,0.,0.1);
90 >    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+suffix1+" vertex error", 200,0.,0.1);
91    }
92    else if (type == "others") {
93 <    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual of pvtx"+methodName, 100,-0.02,0.02);
93 >    h1["deltax"+suffix1] = new TH1D("deltax"+suffix1, "x-residual of pvtx"+methodName, 200,-0.1,0.1);
94      h1["deltax"+suffix1]->GetXaxis()->SetTitle("cm");
95 <    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual of pvtx"+methodName, 100,-0.02,0.02);
95 >    h1["deltay"+suffix1] = new TH1D("deltay"+suffix1, "y-residual of pvtx"+methodName, 200,-0.1,0.1);
96      h1["deltay"+suffix1]->GetXaxis()->SetTitle("cm");
97 <    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual of pvtx"+methodName, 100,-0.02,0.02);
97 >    h1["deltaz"+suffix1] = new TH1D("deltaz"+suffix1, "z-residual of pvtx"+methodName, 200,-0.1,0.1);
98      h1["deltaz"+suffix1]->GetXaxis()->SetTitle("cm");
99 <    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull of pvtx"+methodName, 100,-10.,10.);
100 <    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull of pvtx"+methodName, 100,-10.,10.);
101 <    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull of pvtx"+methodName, 100,-10.,10.);
102 <    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+methodName+" vertex error", 100,0.,0.02);
103 <    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+methodName+" vertex error", 100,0.,0.02);
104 <    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+methodName+" vertex error", 100,0.,0.02);
99 >    h1["pullx"+suffix1]  = new TH1D("pullx"+suffix1, "x-pull of pvtx"+methodName, 200,-5.,5.);
100 >    h1["pully"+suffix1]  = new TH1D("pully"+suffix1, "y-pull of pvtx"+methodName, 200,-5.,5.);
101 >    h1["pullz"+suffix1]  = new TH1D("pullz"+suffix1, "z-pull of pvtx"+methodName, 200,-5.,5.);
102 >    h1["errPVx"+suffix1] = new TH1D("errPVx"+suffix1, "X"+methodName+" vertex error", 200,0.,0.1);
103 >    h1["errPVy"+suffix1] = new TH1D("errPVy"+suffix1, "Y"+methodName+" vertex error", 200,0.,0.1);
104 >    h1["errPVz"+suffix1] = new TH1D("errPVz"+suffix1, "Z"+methodName+" vertex error", 200,0.,0.1);
105    }
106  
107   }
# Line 119 | Line 110 | void PVHistograms::InitA(TString type, T
110  
111    TString methodName = suffix1;
112    if (suffix2 != "") suffix1 += "_" + suffix2;
122  //std::cout << "suffix1 = " << suffix1 << std::endl;
113  
114    if (type == "analysis") {
115 <    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);
115 >    h2["resx"+suffix1]= new TH2D("resx"+suffix1, "x-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,400,0.,500);
116      h2["resx"+suffix1]->SetMarkerStyle(21);
117      h2["resx"+suffix1]->SetMarkerColor(4);
118      h2["resx"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
119      h2["resx"+suffix1]->GetYaxis()->SetTitle("#mum");
120 <    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);
120 >    h2["resy"+suffix1]= new TH2D("resy"+suffix1, "y-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,400,0.,500);
121      h2["resy"+suffix1]->SetMarkerStyle(21);
122      h2["resy"+suffix1]->SetMarkerColor(4);
123      h2["resy"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
124      h2["resy"+suffix1]->GetYaxis()->SetTitle("#mum");
125 <    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);
125 >    h2["resz"+suffix1]= new TH2D("resz"+suffix1, "z-resolution vs number of tracks in pvtx"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,400,0.,500);
126      h2["resz"+suffix1]->SetMarkerStyle(21);
127      h2["resz"+suffix1]->SetMarkerColor(4);
128      h2["resz"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
129      h2["resz"+suffix1]->GetYaxis()->SetTitle("#mum");
130 <    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.);
130 >    h2["pullx"+suffix1]= new TH2D("pullx"+suffix1, "x-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,100,0.,2.);
131      h2["pullx"+suffix1]->SetMarkerStyle(21);
132      h2["pullx"+suffix1]->SetMarkerColor(4);
133      h2["pullx"+suffix1]->SetBit(TH1::kCanRebin);
134      h2["pullx"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
135 <    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.);
135 >    h2["pully"+suffix1]= new TH2D("pully"+suffix1, "y-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,100,0.,2.);
136      h2["pully"+suffix1]->SetMarkerStyle(21);
137      h2["pully"+suffix1]->SetMarkerColor(4);
138      h2["pully"+suffix1]->SetBit(TH1::kCanRebin);
139      h2["pully"+suffix1]->GetXaxis()->SetTitle("Num of tracks");
140 <    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.);
140 >    h2["pullz"+suffix1]= new TH2D("pullz"+suffix1, "z-pull vs number of tracks"+methodName, nTrkMax_-nTrkMin_,nTrkMin_,nTrkMax_,100,0.,2.);
141      h2["pullz"+suffix1]->SetMarkerStyle(21);
142      h2["pullz"+suffix1]->SetMarkerColor(4);
143      h2["pullz"+suffix1]->SetBit(TH1::kCanRebin);
# Line 157 | Line 147 | void PVHistograms::InitA(TString type, T
147  
148   }
149  
160
161 //_______________________________________________________________
162 void PVHistograms::Counter(TString name) {
163
164  h1["counter"]->Fill(name, 1);
165 }
166
150   //_______________________________________________________________
151   void PVHistograms::Fill1d(TString name, Double_t x, Double_t weight) {
152  
# Line 174 | Line 157 | void PVHistograms::Fill1d(TString name,
157   void PVHistograms::Fill2d(TString name, Double_t x, Double_t y, Double_t weight) {
158  
159    h2[name]->Fill(x,y,weight);
177        
160   }
161  
162   //_______________________________________________________________
# Line 187 | Line 169 | void PVHistograms::Print(TString extensi
169      TString tmpname = icv->first;
170      TCanvas *acv = icv->second;
171      acv->Print(TString(tmpname+tag+"."+extension));
172 <  }              
172 >  }
173  
174   }
175 +
176   //_______________________________________________________________
177   void PVHistograms::Save() {
178          
# Line 215 | Line 198 | void PVHistograms::SaveToFile(TString fi
198      TH2D *htemp = (TH2D*) ih->second;
199      htemp->Write();
200    }
201 <                
201 >  
202    foutfile->Write();
203    foutfile->Close();
204 <        
204 >  
205   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines