File indexing completed on 2024-04-06 12:33:33
0001 void TracksCompare()
0002 {
0003
0004
0005 gROOT->SetBatch();
0006 gROOT->SetStyle("Plain");
0007
0008
0009
0010
0011
0012 char* rfilename = "file1.root";
0013 char* sfilename = "file2.root";
0014
0015 TString dirNamer = "DQMData/RecoTrackV/Track";
0016 TString dirNames = "DQMData/RecoTrackV/Track";
0017
0018 TString collnamerCTF = "general";
0019 TString collnamesCTF = "general";
0020 TString collnamerRS = "cutsRS";
0021 TString collnamesRS = "cutsRS";
0022
0023 TString assocnamerCTF1 = "trackingParticleRecoAsssociation";
0024 TString assocnamesCTF1 = "trackingParticleRecoAsssociation";
0025 TString assocnamerRS1 = "AssociatorByHits";
0026 TString assocnamesRS1 = "AssociatorByHits";
0027 TString assocnamerCTF2 = "AssociatorByChi2";
0028 TString assocnamesCTF2 = "AssociatorByChi2";
0029 TString assocnamerRS2 = "AssociatorByChi2";
0030 TString assocnamesRS2 = "AssociatorByChi2";
0031
0032 bool hit=1;
0033 bool chi2=0;
0034 bool ctf=1;
0035 bool rs=0;
0036
0037
0038 delete gROOT->GetListOfFiles()->FindObject(rfilename);
0039 delete gROOT->GetListOfFiles()->FindObject(sfilename);
0040
0041 TText* te = new TText();
0042 TFile * rfile = new TFile(rfilename);
0043 TDirectory * rdir=gDirectory;
0044 TFile * sfile = new TFile(sfilename);
0045 TDirectory * sdir=gDirectory;
0046
0047 if(rfile->cd(dirNamer))rfile->cd(dirNamer);
0048 else rfile->cd("DQMData/Track");
0049 rdir=gDirectory;
0050
0051 if(sfile->cd(dirNames))sfile->cd(dirNames);
0052 else sfile->cd("DQMData/Track");
0053 sdir=gDirectory;
0054
0055 HistoCompare_Tracks * myPV = new HistoCompare_Tracks();
0056
0057 TCanvas *canvas;
0058
0059 TH1F *sh1,*rh1;
0060 TH1F *sc1,*rc1;
0061 TH1F *sh2,*rh2;
0062 TH1F *sc2,*rc2;
0063 TH1F *sh3,*rh3;
0064 TH1F *sc3,*rc3;
0065
0066
0067
0068
0069 if (ctf){
0070
0071 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/effic",rh1);
0072 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/effic",sh1);
0073 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/effic",rc1);
0074 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/effic",sc1);
0075 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/fakerate",rh2);
0076 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/fakerate",sh2);
0077 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/fakerate",rc2);
0078 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/fakerate",sc2);
0079
0080 canvas = new TCanvas("Tracks1","Tracks: efficiency & fakerate",1000,1000);
0081
0082 if (hit) rh1->GetYaxis()->SetRangeUser(0.7,1.025);
0083 if (hit) sh1->GetYaxis()->SetRangeUser(0.7,1.025);
0084 if (chi2)rc1->GetYaxis()->SetRangeUser(0.7,1.025);
0085 if (chi2)sc1->GetYaxis()->SetRangeUser(0.7,1.025);
0086
0087 if (hit&&chi2) plotHist22(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,myPV,te,"UU",-1);
0088 else if (hit) plotHist12(canvas,sh1,rh1,sh2,rh2,myPV,te,"UU",-1);
0089 else if (chi2) plotHist12(canvas,sc1,rc1,sc2,rc2,myPV,te,"UU",-1);
0090
0091 canvas->Print("ctf_effic_fake.eps");
0092 canvas->Print("ctf_effic_fake.gif");
0093
0094
0095 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/chi2",rh1);
0096 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/chi2",sh1);
0097 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/chi2",rc1);
0098 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/chi2",sc1);
0099 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/chi2_prob",rh2);
0100 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/chi2_prob",sh2);
0101 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/chi2_prob",rc2);
0102 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/chi2_prob",sc2);
0103
0104 canvas = new TCanvas("Tracks2","Tracks: chi2 & chi2 probability",1000,1000);
0105
0106 if (hit) {
0107 NormalizeHistograms(rh1,sh1);
0108 NormalizeHistograms(rh2,sh2);
0109 fixRangeY(rh1,sh1);
0110 fixRangeY(rh2,sh2);
0111 }
0112 if (chi2) {
0113 NormalizeHistograms(rc1,sc1);
0114 NormalizeHistograms(rc2,sc2);
0115 fixRangeY(rc1,sc1);
0116 fixRangeY(rc2,sc2);
0117 }
0118
0119 if (hit&&chi2) plotHist22(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,myPV,te,"UUNORM",0.4,0.7);
0120 else if (hit) plotHist12(canvas,sh1,rh1,sh2,rh2,myPV,te,"UUNORM",0.4,0.7);
0121 else if (chi2) plotHist12(canvas,sc1,rc1,sc2,rc2,myPV,te,"UUNORM",0.4,0.7);
0122
0123 canvas->Print("ctf_chi2_chi2prob.eps");
0124 canvas->Print("ctf_chi2_chi2prob.gif");
0125
0126
0127 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/hits_eta",rh1);
0128 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/hits_eta",sh1);
0129 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/hits_eta",rc1);
0130 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/hits_eta",sc1);
0131 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/chi2mean",rh2);
0132 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/chi2mean",sh2);
0133 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/chi2mean",rc2);
0134 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/chi2mean",sc2);
0135 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/losthits_eta",rh3);
0136 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/losthits_eta",sh3);
0137 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/losthits_eta",rc3);
0138 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/losthits_eta",sc3);
0139
0140 canvas = new TCanvas("Tracks3","Tracks: chi2 and #hits vs eta",1000,1000);
0141
0142
0143
0144 if (hit) fixRangeY(rh2,sh2);
0145 if (chi2) fixRangeY(rc2,sc2);
0146
0147 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te, "UU",-1);
0148 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UU",-1);
0149 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UU",-1);
0150
0151 canvas->Print("ctf_hitseta_chi2mean.eps");
0152 canvas->Print("ctf_hitseta_chi2mean.gif");
0153
0154
0155 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/pullPt",rh1);
0156 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/pullPt",sh1);
0157 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/pullPt",rc1);
0158 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/pullPt",sc1);
0159 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/pullQoverp",rh2);
0160 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/pullQoverp",sh2);
0161 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/pullQoverp",rc2);
0162 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/pullQoverp",sc2);
0163 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/pullPhi",rh3);
0164 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/pullPhi",sh3);
0165 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/pullPhi",rc3);
0166 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/pullPhi",sc3);
0167
0168 canvas = new TCanvas("Tracks4","Tracks: pull of Pt, Qoverp and Phi",1000,1000);
0169
0170 if (hit) {
0171 NormalizeHistograms(rh1,sh1);
0172 NormalizeHistograms(rh2,sh2);
0173 NormalizeHistograms(rh3,sh3);
0174 }
0175 if (chi2) {
0176 NormalizeHistograms(rc1,sc1);
0177 NormalizeHistograms(rc2,sc2);
0178 NormalizeHistograms(rc3,sc3);
0179 }
0180
0181 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0182 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UUNORM",0.4,0.1,true);
0183 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0184
0185 canvas->Print("ctf_pullPt_Qoverp_Phi.eps");
0186 canvas->Print("ctf_pullPt_Qoverp_Phi.gif");
0187
0188
0189 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/pullDxy",rh1);
0190 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/pullDxy",sh1);
0191 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/pullDxy",rc1);
0192 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/pullDxy",sc1);
0193 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/pullDz",rh2);
0194 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/pullDz",sh2);
0195 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/pullDz",rc2);
0196 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/pullDz",sc2);
0197 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/pullTheta",rh3);
0198 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/pullTheta",sh3);
0199 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/pullTheta",rc3);
0200 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/pullTheta",sc3);
0201
0202 canvas = new TCanvas("Tracks5","Tracks: pull of Dxy, Dz, Theta",1000,1000);
0203
0204 if (hit) {
0205 NormalizeHistograms(rh1,sh1);
0206 NormalizeHistograms(rh2,sh2);
0207 NormalizeHistograms(rh3,sh3);
0208 }
0209 if (chi2) {
0210 NormalizeHistograms(rc1,sc1);
0211 NormalizeHistograms(rc2,sc2);
0212 NormalizeHistograms(rc3,sc3);
0213 }
0214
0215 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0216 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UUNORM",0.4,0.1,true);
0217 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0218
0219 canvas->Print("ctf_pullDxy_Dz_Theta.eps");
0220 canvas->Print("ctf_pullDxy_Dz_Theta.gif");
0221
0222
0223 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/sigmapt",rh1);
0224 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/sigmapt",sh1);
0225 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/sigmapt",rc1);
0226 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/sigmapt",sc1);
0227 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/sigmaphi",rh2);
0228 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/sigmaphi",sh2);
0229 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/sigmaphi",rc2);
0230 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/sigmaphi",sc2);
0231
0232 canvas = new TCanvas("Tracks6","Tracks: Pt and Phi resolution",1000,1000);
0233
0234 if (hit&&chi2) plotHist22(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,myPV,te,"UU",-1);
0235 else if (hit) plotHist12(canvas,sh1,rh1,sh2,rh2,myPV,te,"UU",-1);
0236 else if (chi2) plotHist12(canvas,sc1,rc1,sc2,rc2,myPV,te,"UU",-1);
0237
0238 canvas->Print("ctf_resolPt_Phi.eps");
0239 canvas->Print("ctf_resolPt_Phi.gif");
0240
0241
0242 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/sigmadxy",rh1);
0243 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/sigmadxy",sh1);
0244 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/sigmadxy",rc1);
0245 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/sigmadxy",sc1);
0246 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/sigmadz",rh2);
0247 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/sigmadz",sh2);
0248 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/sigmadz",rc2);
0249 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/sigmadz",sc2);
0250 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF1+"/sigmacotTheta",rh3);
0251 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF1+"/sigmacotTheta",sh3);
0252 rdir->GetObject(collnamerCTF+"_"+assocnamerCTF2+"/sigmacotTheta",rc3);
0253 sdir->GetObject(collnamesCTF+"_"+assocnamesCTF2+"/sigmacotTheta",sc3);
0254
0255 canvas = new TCanvas("Tracks7","Tracks: Dxy, Dz, Theta resolution",1000,1000);
0256
0257 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te,"UU",-1);
0258 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UU",-1);
0259 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UU",-1);
0260
0261 canvas->Print("ctf_resolDxy_Dz_Theta.eps");
0262 canvas->Print("ctf_resolDxy_Dz_Theta.gif");
0263 }
0264
0265
0266
0267
0268
0269
0270 if (rs){
0271
0272 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/effic",rh1);
0273 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/effic",sh1);
0274 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/effic",rc1);
0275 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/effic",sc1);
0276 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/fakerate",rh2);
0277 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/fakerate",sh2);
0278 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/fakerate",rc2);
0279 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/fakerate",sc2);
0280
0281 canvas = new TCanvas("Tracks8","Tracks: efficiency & fakerate",1000,1000);
0282
0283 if (hit) rh1->GetYaxis()->SetRangeUser(0.7,1.025);
0284 if (hit) sh1->GetYaxis()->SetRangeUser(0.7,1.025);
0285 if (chi2)rc1->GetYaxis()->SetRangeUser(0.7,1.025);
0286 if (chi2)sc1->GetYaxis()->SetRangeUser(0.7,1.025);
0287
0288 if (hit&&chi2) plotHist22(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,myPV,te,"UU",-1);
0289 else if (hit) plotHist12(canvas,sh1,rh1,sh2,rh2,myPV,te,"UU",-1);
0290 else if (chi2) plotHist12(canvas,sc1,rc1,sc2,rc2,myPV,te,"UU",-1);
0291
0292 canvas->Print("rs_effic_fake.eps");
0293 canvas->Print("rs_effic_fake.gif");
0294
0295
0296 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/chi2",rh1);
0297 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/chi2",sh1);
0298 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/chi2",rc1);
0299 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/chi2",sc1);
0300 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/chi2_prob",rh2);
0301 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/chi2_prob",sh2);
0302 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/chi2_prob",rc2);
0303 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/chi2_prob",sc2);
0304
0305 canvas = new TCanvas("Tracks9","Tracks: chi2 & chi2 probability",1000,1000);
0306
0307 if (hit) {
0308 NormalizeHistograms(rh1,sh1);
0309 NormalizeHistograms(rh2,sh2);
0310 fixRangeY(rh1,sh1);
0311 fixRangeY(rh2,sh2);
0312 }
0313 if (chi2) {
0314 NormalizeHistograms(rc1,sc1);
0315 NormalizeHistograms(rc2,sc2);
0316 fixRangeY(rc1,sc1);
0317 fixRangeY(rc2,sc2);
0318 }
0319
0320 if (hit&&chi2) plotHist22(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,myPV,te,"UUNORM",0.4,0.7);
0321 else if (hit) plotHist12(canvas,sh1,rh1,sh2,rh2,myPV,te,"UUNORM",0.4,0.7);
0322 else if (chi2) plotHist12(canvas,sc1,rc1,sc2,rc2,myPV,te,"UUNORM",0.4,0.7);
0323
0324 canvas->Print("rs_chi2_chi2prob.eps");
0325 canvas->Print("rs_chi2_chi2prob.gif");
0326
0327
0328 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/hits_eta",rh1);
0329 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/hits_eta",sh1);
0330 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/hits_eta",rc1);
0331 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/hits_eta",sc1);
0332 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/chi2mean",rh2);
0333 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/chi2mean",sh2);
0334 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/chi2mean",rc2);
0335 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/chi2mean",sc2);
0336 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/losthits_eta",rh3);
0337 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/losthits_eta",sh3);
0338 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/losthits_eta",rc3);
0339 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/losthits_eta",sc3);
0340
0341 canvas = new TCanvas("Tracks10","Tracks: chi2 and #hits vs eta",1000,1000);
0342
0343 if (hit) fixRangeY(rh2,sh2);
0344 if (chi2) fixRangeY(rc2,sc2);
0345
0346 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te, "UU",-1);
0347 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UU",-1);
0348 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UU",-1);
0349
0350 canvas->Print("rs_hitseta_chi2mean.eps");
0351 canvas->Print("rs_hitseta_chi2mean.gif");
0352
0353
0354 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/pullPt",rh1);
0355 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/pullPt",sh1);
0356 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/pullPt",rc1);
0357 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/pullPt",sc1);
0358 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/pullQoverp",rh2);
0359 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/pullQoverp",sh2);
0360 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/pullQoverp",rc2);
0361 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/pullQoverp",sc2);
0362 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/pullPhi",rh3);
0363 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/pullPhi",sh3);
0364 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/pullPhi",rc3);
0365 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/pullPhi",sc3);
0366
0367 canvas = new TCanvas("Tracks11","Tracks: pull of Pt, Qoverp and Phi",1000,1000);
0368
0369 if (hit) {
0370 NormalizeHistograms(rh1,sh1);
0371 NormalizeHistograms(rh2,sh2);
0372 NormalizeHistograms(rh3,sh3);
0373 }
0374 if (chi2) {
0375 NormalizeHistograms(rc1,sc1);
0376 NormalizeHistograms(rc2,sc2);
0377 NormalizeHistograms(rc3,sc3);
0378 }
0379
0380 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0381 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UUNORM",0.4,0.1,true);
0382 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0383
0384 canvas->Print("rs_pullPt_Qoverp_Phi.eps");
0385 canvas->Print("rs_pullPt_Qoverp_Phi.gif");
0386
0387
0388 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/pullDxy",rh1);
0389 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/pullDxy",sh1);
0390 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/pullDxy",rc1);
0391 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/pullDxy",sc1);
0392 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/pullDz",rh2);
0393 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/pullDz",sh2);
0394 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/pullDz",rc2);
0395 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/pullDz",sc2);
0396 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/pullTheta",rh3);
0397 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/pullTheta",sh3);
0398 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/pullTheta",rc3);
0399 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/pullTheta",sc3);
0400
0401 canvas = new TCanvas("Tracks12","Tracks: pull of Dxy, Dz, Theta",1000,1000);
0402
0403 if (hit) {
0404 NormalizeHistograms(rh1,sh1);
0405 NormalizeHistograms(rh2,sh2);
0406 NormalizeHistograms(rh3,sh3);
0407 }
0408 if (chi2) {
0409 NormalizeHistograms(rc1,sc1);
0410 NormalizeHistograms(rc2,sc2);
0411 NormalizeHistograms(rc3,sc3);
0412 }
0413
0414 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0415 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UUNORM",0.4,0.1,true);
0416 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UUNORM",0.4,0.1,true);
0417
0418 canvas->Print("rs_pullDxy_Dz_Theta.eps");
0419 canvas->Print("rs_pullDxy_Dz_Theta.gif");
0420
0421
0422 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/sigmapt",rh1);
0423 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/sigmapt",sh1);
0424 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/sigmapt",rc1);
0425 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/sigmapt",sc1);
0426 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/sigmaphi",rh2);
0427 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/sigmaphi",sh2);
0428 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/sigmaphi",rc2);
0429 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/sigmaphi",sc2);
0430
0431 canvas = new TCanvas("Tracks13","Tracks: Pt and Phi resolution",1000,1000);
0432
0433 if (hit&&chi2) plotHist22(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,myPV,te,"UU",-1);
0434 else if (hit) plotHist12(canvas,sh1,rh1,sh2,rh2,myPV,te,"UU",-1);
0435 else if (chi2) plotHist12(canvas,sc1,rc1,sc2,rc2,myPV,te,"UU",-1);
0436
0437 canvas->Print("rs_resolPt_Phi.eps");
0438 canvas->Print("rs_resolPt_Phi.gif");
0439
0440
0441 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/sigmadxy",rh1);
0442 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/sigmadxy",sh1);
0443 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/sigmadxy",rc1);
0444 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/sigmadxy",sc1);
0445 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/sigmadz",rh2);
0446 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/sigmadz",sh2);
0447 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/sigmadz",rc2);
0448 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/sigmadz",sc2);
0449 rdir->GetObject(collnamerRS+"_"+assocnamerRS1+"/sigmacotTheta",rh3);
0450 sdir->GetObject(collnamesRS+"_"+assocnamesRS1+"/sigmacotTheta",sh3);
0451 rdir->GetObject(collnamerRS+"_"+assocnamerRS2+"/sigmacotTheta",rc3);
0452 sdir->GetObject(collnamesRS+"_"+assocnamesRS2+"/sigmacotTheta",sc3);
0453
0454 canvas = new TCanvas("Tracks14","Tracks: Dxy, Dz, Theta resolution",1000,1000);
0455
0456 if (hit&&chi2) plotHist23(canvas,sh1,rh1,sc1,rc1,sh2,rh2,sc2,rc2,sh3,rh3,sc3,rc3,myPV,te,"UU",-1);
0457 else if (hit) plotHist13(canvas,sh1,rh1,sh2,rh2,sh3,rh3,myPV,te,"UU",-1);
0458 else if (chi2) plotHist13(canvas,sc1,rc1,sc2,rc2,sc3,rc3,myPV,te,"UU",-1);
0459
0460 canvas->Print("rs_resolDxy_Dz_Theta.eps");
0461 canvas->Print("rs_resolDxy_Dz_Theta.gif");
0462 }
0463 }
0464
0465 void NormalizeHistograms(TH1F* h1, TH1F* h2)
0466 {
0467 if (h1==0 || h2==0) return;
0468 float scale1 = -9999.9;
0469 float scale2 = -9999.9;
0470
0471 if ( h1->Integral() != 0 && h2->Integral() != 0 ){
0472 scale1 = 1.0/(float)h1->Integral();
0473 scale2 = 1.0/(float)h2->Integral();
0474
0475 h1->Sumw2();
0476 h2->Sumw2();
0477 h1->Scale(scale1);
0478 h2->Scale(scale2);
0479 }
0480 }
0481
0482
0483 void plotHist12(TCanvas *canvas,
0484 TH1F *sh1,TH1F *rh1,
0485 TH1F *sh2,TH1F *rh2,
0486 HistoCompare_Tracks * myPV, TText* te,
0487 char * option, double startingY, double startingX = .1,bool fit = false){
0488 canvas->Divide(1,2);
0489
0490 canvas->cd(1);
0491 rh1->SetLineColor(2);
0492 sh1->SetLineColor(4);
0493 sh1->SetLineStyle(2);
0494 setStats(rh1,sh1, startingY, startingX, fit);
0495 rh1->Draw();
0496 sh1->Draw("sames");
0497 myPV->PVCompute(rh1, sh1, te, option );
0498
0499 canvas->cd(2);
0500 rh2->SetLineColor(2);
0501 sh2->SetLineColor(4);
0502 sh2->SetLineStyle(2);
0503 setStats(rh2,sh2, startingY, startingX, fit);
0504 rh2->Draw();
0505 sh2->Draw("sames");
0506 myPV->PVCompute(rh2, sh2, te, option );
0507 }
0508
0509 void plotHist22(TCanvas *canvas,
0510 TH1F *sh1,TH1F *rh1, TH1F *sc1,TH1F *rc1,
0511 TH1F *sh2,TH1F *rh2, TH1F *sc2,TH1F *rc2,
0512 HistoCompare_Tracks * myPV, TText* te,
0513 char * option, double startingY, double startingX = .1,bool fit = false){
0514 canvas->Divide(2,2);
0515
0516 canvas->cd(1);
0517 rh1->SetLineColor(2);
0518 sh1->SetLineColor(4);
0519 sh1->SetLineStyle(1);
0520 setStats(rh1,sh1, startingY, startingX, fit);
0521 rh1->Draw();
0522 sh1->Draw("sames");
0523 myPV->PVCompute(rh1, sh1, te, option );
0524
0525 canvas->cd(2);
0526 rc1->SetLineColor(2);
0527 sc1->SetLineColor(4);
0528 sc1->SetLineStyle(2);
0529 setStats(rc1,sc1, startingY, startingX, fit);
0530 rc1->Draw();
0531 sc1->Draw("sames");
0532 myPV->PVCompute(rc1, sc1, te, option );
0533
0534 canvas->cd(3);
0535 rh2->SetLineColor(2);
0536 sh2->SetLineColor(4);
0537 sh2->SetLineStyle(2);
0538 setStats(rh2,sh2, startingY, startingX, fit);
0539 rh2->Draw();
0540 sh2->Draw("sames");
0541 myPV->PVCompute(rh2, sh2, te, option );
0542
0543 canvas->cd(4);
0544 rc2->SetLineColor(2);
0545 sc2->SetLineColor(4);
0546 sc2->SetLineStyle(2);
0547 setStats(rc2,sc2, startingY, startingX, fit);
0548 rc2->Draw();
0549 sc2->Draw("sames");
0550 myPV->PVCompute(rc2, sc2, te, option );
0551
0552 }
0553
0554 void plotHist13(TCanvas *canvas,
0555 TH1F *sh1,TH1F *rh1,
0556 TH1F *sh2,TH1F *rh2,
0557 TH1F *sh3,TH1F *rh3,
0558 HistoCompare_Tracks * myPV, TText* te,
0559 char * option, double startingY, double startingX = .1,bool fit = false){
0560 canvas->Divide(1,3);
0561
0562 canvas->cd(1);
0563 rh1->SetLineColor(2);
0564 sh1->SetLineColor(4);
0565 sh1->SetLineStyle(2);
0566 setStats(rh1,sh1, startingY, startingX, fit);
0567 rh1->Draw();
0568 sh1->Draw("sames");
0569 myPV->PVCompute(rh1, sh1, te, option );
0570
0571 canvas->cd(2);
0572 rh2->SetLineColor(2);
0573 sh2->SetLineColor(4);
0574 sh2->SetLineStyle(2);
0575 setStats(rh2,sh2, startingY, startingX, fit);
0576 rh2->Draw();
0577 sh2->Draw("sames");
0578 myPV->PVCompute(rh2, sh2, te, option );
0579
0580 canvas->cd(3);
0581 rh3->SetLineColor(2);
0582 sh3->SetLineColor(4);
0583 sh3->SetLineStyle(2);
0584 setStats(rh3,sh3, startingY, startingX, fit);
0585 rh3->Draw();
0586 sh3->Draw("sames");
0587 myPV->PVCompute(rh3, sh3, te, option );
0588 }
0589
0590 void plotHist23(TCanvas *canvas,
0591 TH1F *sh1,TH1F *rh1, TH1F *sc1,TH1F *rc1,
0592 TH1F *sh2,TH1F *rh2, TH1F *sc2,TH1F *rc2,
0593 TH1F *sh3,TH1F *rh3, TH1F *sc3,TH1F *rc3,
0594 HistoCompare_Tracks * myPV, TText* te,
0595 char * option, double startingY, double startingX = .1,bool fit = false){
0596 canvas->Divide(2,3);
0597
0598 canvas->cd(1);
0599 rh1->SetLineColor(2);
0600 sh1->SetLineColor(4);
0601 sh1->SetLineStyle(2);
0602 setStats(rh1,sh1, startingY, startingX, fit);
0603 rh1->Draw();
0604 sh1->Draw("sames");
0605 myPV->PVCompute(rh1, sh1, te, option );
0606
0607 canvas->cd(2);
0608 rc1->SetLineColor(2);
0609 sc1->SetLineColor(4);
0610 sc1->SetLineStyle(2);
0611 setStats(rc1,sc1, startingY, startingX, fit);
0612 rc1->Draw();
0613 sc1->Draw("sames");
0614 myPV->PVCompute(rc1, sc1, te, option );
0615
0616 canvas->cd(3);
0617 rh2->SetLineColor(2);
0618 sh2->SetLineColor(4);
0619 sh2->SetLineStyle(2);
0620 setStats(rh2,sh2, startingY, startingX, fit);
0621 rh2->Draw();
0622 sh2->Draw("sames");
0623 myPV->PVCompute(rh2, sh2, te, option );
0624
0625 canvas->cd(4);
0626 rc2->SetLineColor(2);
0627 sc2->SetLineColor(4);
0628 sc2->SetLineStyle(2);
0629 setStats(rc2,sc2, startingY, startingX, fit);
0630 rc2->Draw();
0631 sc2->Draw("sames");
0632 myPV->PVCompute(rc2, sc2, te, option );
0633
0634 canvas->cd(5);
0635 rh3->SetLineColor(2);
0636 sh3->SetLineColor(4);
0637 sh3->SetLineStyle(2);
0638 setStats(rh3,sh3, startingY, startingX, fit);
0639 rh3->Draw();
0640 sh3->Draw("sames");
0641 myPV->PVCompute(rh3, sh3, te, option );
0642
0643 canvas->cd(6);
0644 rc3->SetLineColor(2);
0645 sc3->SetLineColor(4);
0646 sc3->SetLineStyle(2);
0647 setStats(rc3,sc3, startingY, startingX, fit);
0648 rc3->Draw();
0649 sc3->Draw("sames");
0650 myPV->PVCompute(rc3, sc3, te, option );
0651 }
0652
0653 void setStats(TH1* r,TH1* s, double startingY, double startingX = .1,bool fit){
0654 if (startingY<0){
0655 r->SetStats(0);
0656 s->SetStats(0);
0657 } else {
0658 if (fit){
0659 r->Fit("gaus");
0660 TF1* f1 = (TF1*) r->GetListOfFunctions()->FindObject("gaus");
0661 f1->SetLineColor(2);
0662 f1->SetLineWidth(1);
0663 }
0664 r->Draw();
0665 gPad->Update();
0666 TPaveStats* st1 = (TPaveStats*) r->GetListOfFunctions()->FindObject("stats");
0667 if (fit) st1->SetOptFit();
0668 st1->SetX1NDC(startingX);
0669 st1->SetX2NDC(startingX+0.2);
0670 st1->SetY1NDC(startingY+0.15);
0671 st1->SetY2NDC(startingY+0.3);
0672 st1->SetTextColor(2);
0673 if (fit) {
0674 s->Fit("gaus");
0675 TF1* f2 = (TF1*) s->GetListOfFunctions()->FindObject("gaus");
0676 f2->SetLineColor(4);
0677 f2->SetLineWidth(1);
0678 }
0679 s->Draw();
0680 gPad->Update();
0681 TPaveStats* st2 = (TPaveStats*) s->GetListOfFunctions()->FindObject("stats");
0682 if (fit) st2->SetOptFit();
0683 st2->SetX1NDC(startingX);
0684 st2->SetX2NDC(startingX+0.2);
0685 st2->SetY1NDC(startingY);
0686 st2->SetY2NDC(startingY+0.15);
0687 st2->SetTextColor(4);
0688 }
0689 }
0690
0691 void fixRangeY(TH1* r,TH1* s){
0692 double ymin = (r->GetBinContent(r->GetMinimumBin()) < s->GetBinContent(s->GetMinimumBin())) ?
0693 r->GetBinContent(r->GetMinimumBin()) : s->GetBinContent(s->GetMinimumBin());
0694 double ymax = (r->GetBinContent(r->GetMaximumBin()) > s->GetBinContent(s->GetMaximumBin())) ?
0695 r->GetBinContent(r->GetMaximumBin()) : s->GetBinContent(s->GetMaximumBin());
0696 r->GetYaxis()->SetRangeUser(ymin*0.9,ymax*1.1);
0697 s->GetYaxis()->SetRangeUser(ymin*0.9,ymax*1.1);
0698 }