Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:34:38

0001 //
0002 // Overlay RecHits plots from a pair of DQM validation files
0003 //  Strips and Phase 0 or Phase 1 pixels
0004 // Loosely based on Validation/TrackerRecHits/test/SiStripRecHitsCompare.C
0005 //  Bill Ford  10 Oct 2017
0006 //
0007 #include "TStyle.h"
0008 #include "TROOT.h"
0009 #include "TH1F.h"
0010 #include "TCanvas.h"
0011 #include "TFile.h"
0012 #include "TText.h"
0013 
0014 #define _CRT_SECURE_NO_WARNINGS
0015 
0016 #include <iostream>
0017 using std::cout;
0018 using std::endl;
0019 
0020 #include <fstream>
0021 using std::ifstream;
0022 
0023 #include <cstring>
0024 
0025 #include "HistoCompare.C"
0026 
0027 // static const char* outfiletype = "pdf";
0028 static const char* outfiletype = "gif";
0029 
0030 void SetUpHistograms(TH1F* h1, TH1F* h2, float bincorr=1.0)
0031 {
0032   float scale1 = -9999.9;
0033   float scale2 = -9999.9;
0034 
0035   if ( h1->Integral() != 0 && h2->Integral() != 0 ) {
0036     if (bincorr > 0.0) {
0037       scale1 = 1.0/(float)h1->Integral();
0038     // In case the bin width is different between reference and new files:
0039       scale2 = bincorr/(float)h2->Integral();
0040 //     scale2 = scale1;
0041 //     scale2 *= 1000.0/936.0;
0042       h1->Sumw2();
0043       h2->Sumw2();
0044       h1->Scale(scale1);
0045       h2->Scale(scale2);
0046     } else {
0047       h1->SetLineStyle(3);
0048     }
0049 
0050     h1->SetLineWidth(1);
0051     h2->SetLineWidth(1);
0052     h1->SetLineColor(4);
0053     h2->SetLineColor(2);
0054   }
0055 }  // -----------------------------------------------------------
0056 
0057 void TIBcompare(HistoCompare* myPV, TDirectory* rdir, TDirectory* sdir, const char* varname,
0058         const char* historoot, const Int_t logy, const float bincorr = 1.0) {
0059   TH1F* refplotsTIB[6];
0060   TH1F* newplotsTIB[6];
0061   char objname[80], histoname[80];
0062   Int_t layer, plotidx;
0063   TText* te = new TText;
0064 
0065   plotidx = 0;
0066   for (layer = 1; layer < 5; ++layer) {
0067     sprintf(objname, "TIB/layer_%1d/%s_rphi__TIB__layer__%1d", layer, varname, layer);
0068     rdir->GetObject(objname, refplotsTIB[plotidx]);
0069     sdir->GetObject(objname, newplotsTIB[plotidx]);
0070     plotidx++;
0071   }
0072   for (layer = 1; layer < 3; ++layer) {
0073     sprintf(objname, "TIB/layer_%1d/%s_stereo__TIB__layer__%1d", layer, varname, layer);
0074     rdir->GetObject(objname, refplotsTIB[plotidx]);
0075     sdir->GetObject(objname, newplotsTIB[plotidx]);
0076     plotidx++;
0077   }
0078 
0079   TCanvas* Strip_TIB = new TCanvas("Strip_TIB","Strip_TIB",1000,1000);
0080   Strip_TIB->Divide(2,3);
0081   for (Int_t i=0; i<6; ++i) {
0082     if (refplotsTIB[i]->GetEntries() == 0 || newplotsTIB[i]->GetEntries() == 0) continue;
0083     Strip_TIB->cd(i+1);
0084     SetUpHistograms(refplotsTIB[i], newplotsTIB[i], bincorr);
0085     refplotsTIB[i]->Draw();
0086     newplotsTIB[i]->Draw("sames");
0087     myPV->PVCompute(refplotsTIB[i], newplotsTIB[i], te);
0088     gPad->SetLogy(logy);
0089   }
0090 
0091   sprintf(histoname, "%sTIBCompare.%s", historoot, outfiletype);  Strip_TIB->Print(histoname);
0092 
0093 }  // ------------------------------------------------------------------------
0094 
0095 void TOBcompare(HistoCompare* myPV, TDirectory* rdir, TDirectory* sdir, const char* varname,
0096         const char* historoot, const Int_t logy, const float bincorr = 1.0) {
0097   TH1F* refplotsTOB[8];
0098   TH1F* newplotsTOB[8];
0099   char objname[80], histoname[80];
0100   Int_t layer, plotidx;
0101   TText* te = new TText;
0102 
0103   plotidx = 0;
0104   for (layer = 1; layer < 7; ++layer) {
0105     sprintf(objname, "TOB/layer_%1d/%s_rphi__TOB__layer__%1d", layer, varname, layer);
0106     rdir->GetObject(objname, refplotsTOB[plotidx]);
0107     sdir->GetObject(objname, newplotsTOB[plotidx]);
0108     plotidx++;
0109   }
0110   for (layer = 1; layer < 3; ++layer) {
0111     sprintf(objname, "TOB/layer_%1d/%s_stereo__TOB__layer__%1d", layer, varname, layer);
0112     rdir->GetObject(objname, refplotsTOB[plotidx]);
0113     sdir->GetObject(objname, newplotsTOB[plotidx]);
0114     plotidx++;
0115   }
0116 
0117   TCanvas* Strip_TOB = new TCanvas("Strip_TOB","Strip_TOB",1000,1000);
0118   Strip_TOB->Divide(3,3);
0119   for (Int_t i=0; i<8; ++i) {
0120     if (refplotsTOB[i]->GetEntries() == 0 || newplotsTOB[i]->GetEntries() == 0) continue;
0121     Strip_TOB->cd(i+1);
0122     SetUpHistograms(refplotsTOB[i],newplotsTOB[i], bincorr);
0123     refplotsTOB[i]->Draw();
0124     newplotsTOB[i]->Draw("sames");
0125     myPV->PVCompute(refplotsTOB[i], newplotsTOB[i], te);
0126     gPad->SetLogy(logy);
0127   }
0128 
0129   sprintf(histoname, "%sTOBCompare.%s", historoot, outfiletype);  Strip_TOB->Print(histoname);
0130 
0131 }  // ------------------------------------------------------------------------
0132 
0133 void TIDcompare(HistoCompare* myPV, TDirectory* rdir, TDirectory* sdir, const char* varname,
0134         const char* historoot, const Int_t logy, const float bincorr = 1.0) {
0135   TH1F* refplotsTID[5];
0136   TH1F* newplotsTID[5];
0137   char objname[80], histoname[80];
0138   Int_t layer, plotidx;
0139   TText* te = new TText;
0140 
0141   plotidx = 0;
0142   for (layer = 1; layer < 4; ++layer) {
0143     sprintf(objname, "TID/MINUS/ring_%1d/%s_rphi__TID__MINUS__ring__%1d", layer, varname, layer);
0144     rdir->GetObject(objname, refplotsTID[plotidx]);
0145      sdir->GetObject(objname, newplotsTID[plotidx]);
0146    plotidx++;
0147   }
0148   for (layer = 1; layer < 3; ++layer) {
0149     sprintf(objname, "TID/MINUS/ring_%1d/%s_stereo__TID__MINUS__ring__%1d", layer, varname, layer);
0150     rdir->GetObject(objname, refplotsTID[plotidx]);
0151     sdir->GetObject(objname, newplotsTID[plotidx]);
0152     plotidx++;
0153   }
0154 
0155   TCanvas* Strip_TID = new TCanvas("Strip_TID","Strip_TID",1000,1000);
0156   Strip_TID->Divide(2,3);
0157   for (Int_t i=0; i<5; ++i) {
0158     if (refplotsTID[i]->GetEntries() == 0 || newplotsTID[i]->GetEntries() == 0) continue;
0159     Strip_TID->cd(i+1);
0160     SetUpHistograms(refplotsTID[i],newplotsTID[i], bincorr);
0161     refplotsTID[i]->Draw();
0162     newplotsTID[i]->Draw("sames");
0163     myPV->PVCompute(refplotsTID[i], newplotsTID[i], te);
0164     gPad->SetLogy(logy);
0165   }
0166 
0167   sprintf(histoname, "%sTIDCompare.%s", historoot, outfiletype);  Strip_TID->Print(histoname);
0168 
0169 }  // ------------------------------------------------------------------------
0170 
0171 void TECcompare(HistoCompare* myPV, TDirectory* rdir, TDirectory* sdir, const char* varname,
0172         const char* historoot, const Int_t logy, const float bincorr = 1.0) {
0173   TH1F* refplotsTEC[10];
0174   TH1F* newplotsTEC[10];
0175   char objname[80], histoname[80];
0176   Int_t layer[3] = {1, 2, 5}, lidx, plotidx;
0177   TText* te = new TText;
0178 
0179   plotidx = 0;
0180   for (lidx = 1; lidx < 8; ++lidx) {
0181     sprintf(objname, "TEC/MINUS/ring_%1d/%s_rphi__TEC__MINUS__ring__%1d", lidx, varname, lidx);
0182     rdir->GetObject(objname, refplotsTEC[plotidx]);
0183     sdir->GetObject(objname, newplotsTEC[plotidx]);
0184     plotidx++;
0185   }
0186   for (lidx = 1; lidx < 3; ++lidx) {
0187     sprintf(objname, "TEC/MINUS/ring_%1d/%s_stereo__TEC__MINUS__ring__%1d",
0188         layer[lidx], varname, layer[lidx]);
0189     rdir->GetObject(objname, refplotsTEC[plotidx]);
0190     sdir->GetObject(objname, newplotsTEC[plotidx]);
0191     plotidx++;
0192   }
0193 
0194   TCanvas* Strip_TEC = new TCanvas("Strip_TEC","Strip_TEC",1000,1000);
0195   Strip_TEC->Divide(2,3);
0196   for (Int_t i=0; i<5; ++i) {
0197     if (refplotsTEC[i]->GetEntries() == 0 || newplotsTEC[i]->GetEntries() == 0) continue;
0198     Strip_TEC->cd(i+1);
0199     SetUpHistograms(refplotsTEC[i],newplotsTEC[i], bincorr);
0200     refplotsTEC[i]->Draw();
0201     newplotsTEC[i]->Draw("sames");
0202     myPV->PVCompute(refplotsTEC[i], newplotsTEC[i], te);
0203     gPad->SetLogy(logy);
0204   }
0205 
0206   sprintf(histoname, "%sTECCompare.%s", historoot, outfiletype);  Strip_TEC->Print(histoname);
0207 
0208 }  // ------------------------------------------------------------------------
0209 
0210 void BPIXcompare(HistoCompare* myPV, TDirectory* rdir, TDirectory* sdir, const char* varname, int layer, const char* historoot) {
0211 
0212   TH1F* refplotsBPIX[11];
0213   TH1F* newplotsBPIX[11];
0214   char objname[80], histoname[80];
0215   std::string dirroot("");
0216   Int_t module, plotidx;
0217   TText* te = new TText;
0218 
0219   if (strstr(varname, "Pull")) dirroot = "Pulls";
0220 
0221   plotidx = 0;
0222   sprintf(objname, "recHit%sBPIX/RecHit_NsimHit_Layer%1d", "", layer);
0223   rdir->GetObject(objname, refplotsBPIX[plotidx]);
0224   sdir->GetObject(objname, newplotsBPIX[plotidx]);
0225   plotidx++;
0226   sprintf(objname, "recHit%sBPIX/RecHit_X%s_FlippedLadder_Layer%1d", dirroot.c_str(), varname, layer);
0227   rdir->GetObject(objname, refplotsBPIX[plotidx]);
0228   sdir->GetObject(objname, newplotsBPIX[plotidx]);
0229   plotidx++;
0230   sprintf(objname, "recHit%sBPIX/RecHit_X%s_UnFlippedLadder_Layer%1d", dirroot.c_str(), varname, layer);
0231   rdir->GetObject(objname, refplotsBPIX[plotidx]);
0232   sdir->GetObject(objname, newplotsBPIX[plotidx]);
0233   plotidx++;
0234   for (module = 0; module < 8; ++module) {
0235     sprintf(objname, "recHit%sBPIX/RecHit_Y%s_Layer%1d_Module%1d", dirroot.c_str(), varname, layer, module+1);
0236     rdir->GetObject(objname, refplotsBPIX[plotidx]);
0237     sdir->GetObject(objname, newplotsBPIX[plotidx]);
0238     plotidx++;
0239   }
0240   int nplots = plotidx;
0241 
0242   TCanvas* Pixel = new TCanvas("Pixel", "Pixel", 1000, 1000);
0243   Pixel->Divide(3,4);
0244   for (Int_t i=0; i<nplots; ++i) {
0245     if (refplotsBPIX[i]->GetEntries() == 0 || newplotsBPIX[i]->GetEntries() == 0) continue;
0246     Pixel->cd(i+1);
0247     SetUpHistograms(refplotsBPIX[i],newplotsBPIX[i]);
0248     refplotsBPIX[i]->Draw();
0249     newplotsBPIX[i]->Draw("sames");
0250     myPV->PVCompute(refplotsBPIX[i], newplotsBPIX[i], te);
0251   }
0252   TPad *p1 = (TPad *)(Pixel->cd(1));  p1->SetLogy(1);
0253   sprintf(histoname, "%sBPIX_Layer_%1dCompare.%s", historoot, layer, outfiletype);  Pixel->Print(histoname);
0254 
0255 }  // ------------------------------------------------------------------------
0256 
0257 void FPIXcompare(HistoCompare* myPV, TDirectory* rdir, TDirectory* sdir, const char* varname, int disk, const char* historoot) {
0258 
0259   TH1F* refplotsFPIX[8];
0260   TH1F* newplotsFPIX[8];
0261   char objname[80], histoname[80];
0262   std::string dirroot("");
0263   Int_t plaquette, plotidx;
0264   TText* te = new TText;
0265 
0266   if (strstr(varname, "Pull")) dirroot = "Pulls";
0267 
0268   plotidx = 0;
0269   sprintf(objname, "recHit%sFPIX/RecHit_NsimHit_Disk%1d", "", disk);
0270   rdir->GetObject(objname, refplotsFPIX[plotidx]);
0271   sdir->GetObject(objname, newplotsFPIX[plotidx]);
0272   plotidx++;
0273   for (plaquette = 0; plaquette < 7; ++plaquette) {
0274     sprintf(objname, "recHit%sFPIX/RecHit_Y%s_Disk%1d_Plaquette%1d", dirroot.c_str(), varname, disk, plaquette+1);
0275     rdir->GetObject(objname, refplotsFPIX[plotidx]);
0276     sdir->GetObject(objname, newplotsFPIX[plotidx]);
0277     plotidx++;
0278   }
0279   int nplots = plotidx;
0280 
0281   TCanvas* Pixel = new TCanvas("Pixel","Pixel",1000,1000);
0282   Pixel->Divide(3,3);
0283   for (Int_t i=0; i<nplots; ++i) {
0284     if (refplotsFPIX[i]->GetEntries() == 0 || newplotsFPIX[i]->GetEntries() == 0) continue;
0285     Pixel->cd(i+1);
0286     SetUpHistograms(refplotsFPIX[i],newplotsFPIX[i]);
0287     refplotsFPIX[i]->Draw();
0288     newplotsFPIX[i]->Draw("sames");
0289     myPV->PVCompute(refplotsFPIX[i], newplotsFPIX[i], te);
0290   }
0291 
0292   TPad *p1 = (TPad *)(Pixel->cd(1));  p1->SetLogy(1);
0293   sprintf(histoname, "%sFPIX_Disk_%1dCompare.%s", historoot, disk, outfiletype);  Pixel->Print(histoname);
0294 
0295 }  // ------------------------------------------------------------------------
0296 
0297 void Phase1PIXcompare(HistoCompare* myPV, TDirectory* rdir, TDirectory* sdir, const Int_t side, const Int_t layerdisk) {
0298 
0299   TH1F* refplots[6];
0300   TH1F* newplots[6];
0301   char objname[80], histoname[80];
0302   std::string subdir(""), LayerDisk(""), Side("");
0303   Int_t abslayerdisk, plotidx;
0304   TText* te = new TText;
0305   if (side == 0) {
0306     subdir = "PXBarrel";
0307     LayerDisk = "Layer";
0308     abslayerdisk = layerdisk;
0309     Side = "";
0310   } else {
0311     subdir = "PXForward";
0312     LayerDisk = "Disk";
0313     abslayerdisk = layerdisk > 0 ? layerdisk : -layerdisk;
0314     Side = side > 0 ? "+" : "-";
0315   }
0316 
0317   plotidx = 0;
0318   sprintf(objname, "%s/res_x_PX%s_%s%1d", subdir.c_str(), LayerDisk.c_str(), Side.c_str(), abslayerdisk);
0319   rdir->GetObject(objname, refplots[plotidx]);
0320   sdir->GetObject(objname, newplots[plotidx]);
0321   plotidx++;
0322   sprintf(objname, "%s/res_y_PX%s_%s%1d", subdir.c_str(), LayerDisk.c_str(), Side.c_str(), abslayerdisk);
0323   rdir->GetObject(objname, refplots[plotidx]);
0324   sdir->GetObject(objname, newplots[plotidx]);
0325   plotidx++;
0326   sprintf(objname, "%s/pull_x_PX%s_%s%1d", subdir.c_str(), LayerDisk.c_str(), Side.c_str(), abslayerdisk);
0327   rdir->GetObject(objname, refplots[plotidx]);
0328   sdir->GetObject(objname, newplots[plotidx]);
0329   plotidx++;
0330   sprintf(objname, "%s/pull_y_PX%s_%s%1d", subdir.c_str(), LayerDisk.c_str(), Side.c_str(), abslayerdisk);
0331   rdir->GetObject(objname, refplots[plotidx]);
0332   sdir->GetObject(objname, newplots[plotidx]);
0333   plotidx++;
0334   sprintf(objname, "%s/nsimhits_PX%s_%s%1d", subdir.c_str(), LayerDisk.c_str(), Side.c_str(), abslayerdisk);
0335   rdir->GetObject(objname, refplots[plotidx]);
0336   sdir->GetObject(objname, newplots[plotidx]);
0337   plotidx++;
0338   int nplots = plotidx;
0339 
0340   TCanvas* Phase1Pix = new TCanvas("Phase1Pix", "Phase1Pix", 1000, 1000);
0341   Phase1Pix->Divide(2,3);
0342   for (Int_t i=0; i<nplots; ++i) {
0343     if (refplots[i]->GetEntries() == 0 || newplots[i]->GetEntries() == 0) continue;
0344     Phase1Pix->cd(i+1);
0345     SetUpHistograms(refplots[i],newplots[i]);
0346     refplots[i]->Draw();
0347     newplots[i]->Draw("sames");
0348     myPV->PVCompute(refplots[i], newplots[i], te);
0349   }
0350   TPad *p5 = (TPad *)(Phase1Pix->cd(5));  p5->SetLogy(1);
0351   sprintf(histoname, "%s_%s_%s%1d_Compare.%s", subdir.c_str(), LayerDisk.c_str(), Side.c_str(), abslayerdisk, outfiletype);
0352   Phase1Pix->Print(histoname);
0353 
0354 }  // ------------------------------------------------------------------------
0355 
0356 void RecHitsCompare(
0357             const char* rfilename = "DQM_V0001_R000000001__my__relVal__tracker.root",
0358             const char* sfilename = "DQM_V0001_R000000001__my__relVal__tracker.root"
0359             )
0360 {
0361   //  color 2 = red  = sfile = new file
0362   //  color 4 = blue = rfile = reference file
0363 
0364   gROOT ->Reset();
0365   // gROOT->ProcessLine(".L ../HistoCompare.C");
0366 
0367   delete gROOT->GetListOfFiles()->FindObject(rfilename);
0368   delete gROOT->GetListOfFiles()->FindObject(sfilename);;
0369   TFile * rfile = new TFile(rfilename);
0370   TFile * sfile = new TFile(sfilename);
0371   TDirectory * rdir=gDirectory;
0372   TDirectory * sdir=gDirectory;
0373 
0374   HistoCompare * myPV = new HistoCompare();
0375   TText* te = new TText();
0376   char histoname[80];
0377  
0378   // Strips
0379 
0380   if (rfile->cd("DQMData/Run 1/SiStrip/Run summary/RecHitsValidation/StiffTrackingRecHits/MechanicalView")) {
0381     rdir = gDirectory;
0382     if (sfile->cd("DQMData/Run 1/SiStrip/Run summary/RecHitsValidation/StiffTrackingRecHits/MechanicalView")) {
0383       sdir=gDirectory;
0384 
0385       //=============================================================== 
0386       // TIB
0387 
0388       // rphi, stereo layers
0389       TIBcompare(myPV, rdir, sdir, "Pull_LF", "PullLF", 0);
0390       TIBcompare(myPV, rdir, sdir, "Pull_MF", "PullMF", 0);
0391       TIBcompare(myPV, rdir, sdir, "Resolx",  "Resolx", 0);
0392       TIBcompare(myPV, rdir, sdir, "Wclus", "Wclus", 0);
0393       TIBcompare(myPV, rdir, sdir, "Adc", "Adc", 0);
0394       TIBcompare(myPV, rdir, sdir, "Posx", "Pos", 0);
0395       TIBcompare(myPV, rdir, sdir, "Res", "Res", 0);
0396       TIBcompare(myPV, rdir, sdir, "Chi2", "Chi2", 0);
0397       TIBcompare(myPV, rdir, sdir, "NsimHit", "NsimHit", 1, -1.0);
0398  
0399       // matched layers
0400       TH1F* matchedtib[16];
0401       TH1F* newmatchedtib[16];
0402 
0403       rdir->GetObject("TIB/layer_1/Posx_matched__TIB__layer__1",matchedtib[0]);
0404       rdir->GetObject("TIB/layer_1/Posy_matched__TIB__layer__1",matchedtib[1]);
0405       rdir->GetObject("TIB/layer_2/Posx_matched__TIB__layer__2",matchedtib[2]);
0406       rdir->GetObject("TIB/layer_2/Posy_matched__TIB__layer__2",matchedtib[3]);
0407       rdir->GetObject("TIB/layer_1/Resolx_matched__TIB__layer__1",matchedtib[4]);
0408       rdir->GetObject("TIB/layer_1/Resoly_matched__TIB__layer__1",matchedtib[5]);
0409       rdir->GetObject("TIB/layer_2/Resolx_matched__TIB__layer__2",matchedtib[6]);
0410       rdir->GetObject("TIB/layer_2/Resoly_matched__TIB__layer__2",matchedtib[7]);
0411       rdir->GetObject("TIB/layer_1/Resx_matched__TIB__layer__1",matchedtib[8]);
0412       rdir->GetObject("TIB/layer_1/Resy_matched__TIB__layer__1",matchedtib[9]);
0413       rdir->GetObject("TIB/layer_2/Resx_matched__TIB__layer__2",matchedtib[10]);
0414       rdir->GetObject("TIB/layer_2/Resy_matched__TIB__layer__2",matchedtib[11]);
0415       rdir->GetObject("TIB/layer_1/Chi2_matched__TIB__layer__1",matchedtib[12]);
0416       rdir->GetObject("TIB/layer_2/Chi2_matched__TIB__layer__2",matchedtib[13]);
0417       rdir->GetObject("TIB/layer_1/NsimHit_matched__TIB__layer__1",matchedtib[14]);
0418       rdir->GetObject("TIB/layer_2/NsimHit_matched__TIB__layer__2",matchedtib[15]);
0419 
0420       sdir->GetObject("TIB/layer_1/Posx_matched__TIB__layer__1",newmatchedtib[0]);
0421       sdir->GetObject("TIB/layer_1/Posy_matched__TIB__layer__1",newmatchedtib[1]);
0422       sdir->GetObject("TIB/layer_2/Posx_matched__TIB__layer__2",newmatchedtib[2]);
0423       sdir->GetObject("TIB/layer_2/Posy_matched__TIB__layer__2",newmatchedtib[3]);
0424       sdir->GetObject("TIB/layer_1/Resolx_matched__TIB__layer__1",newmatchedtib[4]);
0425       sdir->GetObject("TIB/layer_1/Resoly_matched__TIB__layer__1",newmatchedtib[5]);
0426       sdir->GetObject("TIB/layer_2/Resolx_matched__TIB__layer__2",newmatchedtib[6]);
0427       sdir->GetObject("TIB/layer_2/Resoly_matched__TIB__layer__2",newmatchedtib[7]);
0428       sdir->GetObject("TIB/layer_1/Resx_matched__TIB__layer__1",newmatchedtib[8]);
0429       sdir->GetObject("TIB/layer_1/Resy_matched__TIB__layer__1",newmatchedtib[9]);
0430       sdir->GetObject("TIB/layer_2/Resx_matched__TIB__layer__2",newmatchedtib[10]);
0431       sdir->GetObject("TIB/layer_2/Resy_matched__TIB__layer__2",newmatchedtib[11]);
0432       sdir->GetObject("TIB/layer_1/Chi2_matched__TIB__layer__1",newmatchedtib[12]);
0433       sdir->GetObject("TIB/layer_2/Chi2_matched__TIB__layer__2",newmatchedtib[13]);
0434       sdir->GetObject("TIB/layer_1/NsimHit_matched__TIB__layer__1",newmatchedtib[14]);
0435       sdir->GetObject("TIB/layer_2/NsimHit_matched__TIB__layer__2",newmatchedtib[15]);
0436 
0437       TCanvas* Strip_TIB_matched = new TCanvas("Strip_TIB_matched","Strip_TIB_matched",1000,1000);
0438       Strip_TIB_matched->Divide(4,4);
0439       for (Int_t i=0; i<16; ++i) {
0440         if (matchedtib[i]->GetEntries() == 0 || newmatchedtib[i]->GetEntries() == 0) continue;
0441         Strip_TIB_matched->cd(i+1);
0442         if (i == 14 || i == 15) SetUpHistograms(matchedtib[i],newmatchedtib[i], -1.0);
0443         else SetUpHistograms(matchedtib[i],newmatchedtib[i]);
0444         matchedtib[i]->Draw();
0445         newmatchedtib[i]->Draw("sames");
0446         myPV->PVCompute(matchedtib[i] , newmatchedtib[i] , te );
0447       }
0448       // TPad *p15 = (TPad *)(Strip_TIB_matched->cd(15));  p15->SetLogy(1);
0449       // TPad *p16 = (TPad *)(Strip_TIB_matched->cd(16));  p16->SetLogy(1);
0450 
0451       sprintf(histoname, "MatchedTIBCompare.%s", outfiletype);  Strip_TIB_matched->Print(histoname);
0452 
0453       //======================================================================================================
0454       // TOB
0455 
0456       // rphi, stereo layers
0457       TOBcompare(myPV, rdir, sdir, "Pull_LF", "PullLF", 0);
0458       TOBcompare(myPV, rdir, sdir, "Pull_MF", "PullMF", 0);
0459       TOBcompare(myPV, rdir, sdir, "Resolx",  "Resolx", 0);
0460       TOBcompare(myPV, rdir, sdir, "Wclus", "Wclus", 0);
0461       TOBcompare(myPV, rdir, sdir, "Adc", "Adc", 0);
0462       TOBcompare(myPV, rdir, sdir, "Posx", "Pos", 0);
0463       TOBcompare(myPV, rdir, sdir, "Res", "Res", 0);
0464       TOBcompare(myPV, rdir, sdir, "Chi2", "Chi2", 0);
0465       TOBcompare(myPV, rdir, sdir, "NsimHit", "NsimHit", 1, -1.0);
0466 
0467       // matched layers
0468       TH1F* matchedtob[16];
0469       TH1F* newmatchedtob[16];
0470 
0471       rdir->GetObject("TOB/layer_1/Posx_matched__TOB__layer__1",matchedtob[0]);
0472       rdir->GetObject("TOB/layer_1/Posy_matched__TOB__layer__1",matchedtob[1]);
0473       rdir->GetObject("TOB/layer_2/Posx_matched__TOB__layer__2",matchedtob[2]);
0474       rdir->GetObject("TOB/layer_2/Posy_matched__TOB__layer__2",matchedtob[3]);
0475       rdir->GetObject("TOB/layer_1/Resolx_matched__TOB__layer__1",matchedtob[4]);
0476       rdir->GetObject("TOB/layer_1/Resoly_matched__TOB__layer__1",matchedtob[5]);
0477       rdir->GetObject("TOB/layer_2/Resolx_matched__TOB__layer__2",matchedtob[6]);
0478       rdir->GetObject("TOB/layer_2/Resoly_matched__TOB__layer__2",matchedtob[7]);
0479       rdir->GetObject("TOB/layer_1/Resx_matched__TOB__layer__1",matchedtob[8]);
0480       rdir->GetObject("TOB/layer_1/Resy_matched__TOB__layer__1",matchedtob[9]);
0481       rdir->GetObject("TOB/layer_2/Resx_matched__TOB__layer__2",matchedtob[10]);
0482       rdir->GetObject("TOB/layer_2/Resy_matched__TOB__layer__2",matchedtob[11]);
0483       rdir->GetObject("TOB/layer_1/Chi2_matched__TOB__layer__1",matchedtob[12]);
0484       rdir->GetObject("TOB/layer_2/Chi2_matched__TOB__layer__2",matchedtob[13]);
0485       rdir->GetObject("TOB/layer_1/NsimHit_matched__TOB__layer__1",matchedtob[14]);
0486       rdir->GetObject("TOB/layer_2/NsimHit_matched__TOB__layer__2",matchedtob[15]);
0487 
0488       sdir->GetObject("TOB/layer_1/Posx_matched__TOB__layer__1",newmatchedtob[0]);
0489       sdir->GetObject("TOB/layer_1/Posy_matched__TOB__layer__1",newmatchedtob[1]);
0490       sdir->GetObject("TOB/layer_2/Posx_matched__TOB__layer__2",newmatchedtob[2]);
0491       sdir->GetObject("TOB/layer_2/Posy_matched__TOB__layer__2",newmatchedtob[3]);
0492       sdir->GetObject("TOB/layer_1/Resolx_matched__TOB__layer__1",newmatchedtob[4]);
0493       sdir->GetObject("TOB/layer_1/Resoly_matched__TOB__layer__1",newmatchedtob[5]);
0494       sdir->GetObject("TOB/layer_2/Resolx_matched__TOB__layer__2",newmatchedtob[6]);
0495       sdir->GetObject("TOB/layer_2/Resoly_matched__TOB__layer__2",newmatchedtob[7]);
0496       sdir->GetObject("TOB/layer_1/Resx_matched__TOB__layer__1",newmatchedtob[8]);
0497       sdir->GetObject("TOB/layer_1/Resy_matched__TOB__layer__1",newmatchedtob[9]);
0498       sdir->GetObject("TOB/layer_2/Resx_matched__TOB__layer__2",newmatchedtob[10]);
0499       sdir->GetObject("TOB/layer_2/Resy_matched__TOB__layer__2",newmatchedtob[11]);
0500       sdir->GetObject("TOB/layer_1/Chi2_matched__TOB__layer__1",newmatchedtob[12]);
0501       sdir->GetObject("TOB/layer_2/Chi2_matched__TOB__layer__2",newmatchedtob[13]);
0502       sdir->GetObject("TOB/layer_1/NsimHit_matched__TOB__layer__1",newmatchedtob[14]);
0503       sdir->GetObject("TOB/layer_2/NsimHit_matched__TOB__layer__2",newmatchedtob[15]);
0504 
0505       TCanvas* Strip_TOB_matched = new TCanvas("Strip_TOB_matched","Strip_TOB_matched",1000,1000);
0506       Strip_TOB_matched->Divide(4,4);
0507       for (Int_t i=0; i<16; ++i) {
0508         if (matchedtob[i]->GetEntries() == 0 || newmatchedtob[i]->GetEntries() == 0) continue;
0509         Strip_TOB_matched->cd(i+1);
0510         if (i == 14 || i == 15) SetUpHistograms(matchedtob[i],newmatchedtob[i], -1.0);
0511         else SetUpHistograms(matchedtob[i],newmatchedtob[i]);
0512         matchedtob[i]->Draw();
0513         newmatchedtob[i]->Draw("sames");
0514         myPV->PVCompute(matchedtob[i] , newmatchedtob[i] , te );
0515       }
0516       // TPad *p15 = (TPad *)(Strip_TOB_matched->cd(15));  p15->SetLogy(1);
0517       // TPad *p16 = (TPad *)(Strip_TOB_matched->cd(16));  p16->SetLogy(1);
0518  
0519       sprintf(histoname, "MatchedTOBCompare.%s", outfiletype);  Strip_TOB_matched->Print(histoname);
0520 
0521       //=============================================================== 
0522       // TID
0523 
0524       // rphi, stereo layers
0525       TIDcompare(myPV, rdir, sdir, "Pull_LF", "PullLF", 0);
0526       TIDcompare(myPV, rdir, sdir, "Pull_MF", "PullMF", 0);
0527       TIDcompare(myPV, rdir, sdir, "Resolx",  "Resolx", 0);
0528       TIDcompare(myPV, rdir, sdir, "Wclus", "Wclus", 0);
0529       TIDcompare(myPV, rdir, sdir, "Adc", "Adc", 0);
0530       TIDcompare(myPV, rdir, sdir, "Posx", "Pos", 0);
0531       TIDcompare(myPV, rdir, sdir, "Res", "Res", 0);
0532       TIDcompare(myPV, rdir, sdir, "Chi2", "Chi2", 0);
0533       TIDcompare(myPV, rdir, sdir, "NsimHit", "NsimHit", 1, -1.0);
0534 
0535       // matched layers
0536       TH1F* matchedtid[16];
0537       TH1F* newmatchedtid[16];
0538 
0539       rdir->GetObject("TID/MINUS/ring_1/Posx_matched__TID__MINUS__ring__1",matchedtid[0]);
0540       rdir->GetObject("TID/MINUS/ring_1/Posy_matched__TID__MINUS__ring__1",matchedtid[1]);
0541       rdir->GetObject("TID/MINUS/ring_2/Posx_matched__TID__MINUS__ring__2",matchedtid[2]);
0542       rdir->GetObject("TID/MINUS/ring_2/Posy_matched__TID__MINUS__ring__2",matchedtid[3]);
0543       rdir->GetObject("TID/MINUS/ring_1/Resolx_matched__TID__MINUS__ring__1",matchedtid[4]);
0544       rdir->GetObject("TID/MINUS/ring_1/Resoly_matched__TID__MINUS__ring__1",matchedtid[5]);
0545       rdir->GetObject("TID/MINUS/ring_2/Resolx_matched__TID__MINUS__ring__2",matchedtid[6]);
0546       rdir->GetObject("TID/MINUS/ring_2/Resoly_matched__TID__MINUS__ring__2",matchedtid[7]);
0547       rdir->GetObject("TID/MINUS/ring_1/Resx_matched__TID__MINUS__ring__1",matchedtid[8]);
0548       rdir->GetObject("TID/MINUS/ring_1/Resy_matched__TID__MINUS__ring__1",matchedtid[9]);
0549       rdir->GetObject("TID/MINUS/ring_2/Resx_matched__TID__MINUS__ring__2",matchedtid[10]);
0550       rdir->GetObject("TID/MINUS/ring_2/Resy_matched__TID__MINUS__ring__2",matchedtid[11]);
0551       rdir->GetObject("TID/MINUS/ring_1/Chi2_matched__TID__MINUS__ring__1",matchedtid[12]);
0552       rdir->GetObject("TID/MINUS/ring_1/Chi2_matched__TID__MINUS__ring__1",matchedtid[13]);
0553       rdir->GetObject("TID/MINUS/ring_2/NsimHit_matched__TID__MINUS__ring__2",matchedtid[14]);
0554       rdir->GetObject("TID/MINUS/ring_2/NsimHit_matched__TID__MINUS__ring__2",matchedtid[15]);
0555 
0556       sdir->GetObject("TID/MINUS/ring_1/Posx_matched__TID__MINUS__ring__1",newmatchedtid[0]);
0557       sdir->GetObject("TID/MINUS/ring_1/Posy_matched__TID__MINUS__ring__1",newmatchedtid[1]);
0558       sdir->GetObject("TID/MINUS/ring_2/Posx_matched__TID__MINUS__ring__2",newmatchedtid[2]);
0559       sdir->GetObject("TID/MINUS/ring_2/Posy_matched__TID__MINUS__ring__2",newmatchedtid[3]);
0560       sdir->GetObject("TID/MINUS/ring_1/Resolx_matched__TID__MINUS__ring__1",newmatchedtid[4]);
0561       sdir->GetObject("TID/MINUS/ring_1/Resoly_matched__TID__MINUS__ring__1",newmatchedtid[5]);
0562       sdir->GetObject("TID/MINUS/ring_2/Resolx_matched__TID__MINUS__ring__2",newmatchedtid[6]);
0563       sdir->GetObject("TID/MINUS/ring_2/Resoly_matched__TID__MINUS__ring__2",newmatchedtid[7]);
0564       sdir->GetObject("TID/MINUS/ring_1/Resx_matched__TID__MINUS__ring__1",newmatchedtid[8]);
0565       sdir->GetObject("TID/MINUS/ring_1/Resy_matched__TID__MINUS__ring__1",newmatchedtid[9]);
0566       sdir->GetObject("TID/MINUS/ring_2/Resx_matched__TID__MINUS__ring__2",newmatchedtid[10]);
0567       sdir->GetObject("TID/MINUS/ring_2/Resy_matched__TID__MINUS__ring__2",newmatchedtid[11]);
0568       sdir->GetObject("TID/MINUS/ring_1/Chi2_matched__TID__MINUS__ring__1",newmatchedtid[12]);
0569       sdir->GetObject("TID/MINUS/ring_2/Chi2_matched__TID__MINUS__ring__2",newmatchedtid[13]);
0570       sdir->GetObject("TID/MINUS/ring_1/NsimHit_matched__TID__MINUS__ring__1",newmatchedtid[14]);
0571       sdir->GetObject("TID/MINUS/ring_2/NsimHit_matched__TID__MINUS__ring__2",newmatchedtid[15]);
0572 
0573       TCanvas* Strip_TID_matched = new TCanvas("Strip_TID_matched","Strip_TID_matched",1000,1000);
0574       Strip_TID_matched->Divide(4,4);
0575       for (Int_t i=0; i<16; ++i) {
0576         if (matchedtid[i]->GetEntries() == 0 || newmatchedtid[i]->GetEntries() == 0) continue;
0577         Strip_TID_matched->cd(i+1);
0578         if (i == 14 || i == 15) SetUpHistograms(matchedtid[i],newmatchedtid[i], -1.0);
0579         else SetUpHistograms(matchedtid[i],newmatchedtid[i]);
0580         matchedtid[i]->Draw();
0581         newmatchedtid[i]->Draw("sames");
0582         myPV->PVCompute(matchedtid[i] , newmatchedtid[i] , te );
0583       }
0584       // TPad *p15 = (TPad *)(Strip_TID_matched->cd(15));  p15->SetLogy(1);
0585       // TPad *p16 = (TPad *)(Strip_TID_matched->cd(16));  p16->SetLogy(1);
0586  
0587       sprintf(histoname, "MatchedTIDCompare.%s", outfiletype);  Strip_TID_matched->Print(histoname);
0588 
0589       //======================================================================================================
0590       // TEC
0591 
0592       // rphi, stereo layers
0593       TECcompare(myPV, rdir, sdir, "Pull_LF", "PullLF", 0);
0594       TECcompare(myPV, rdir, sdir, "Pull_MF", "PullMF", 0);
0595       TECcompare(myPV, rdir, sdir, "Resolx",  "Resolx", 0);
0596       TECcompare(myPV, rdir, sdir, "Wclus", "Wclus", 0);
0597       TECcompare(myPV, rdir, sdir, "Adc", "Adc", 0);
0598       TECcompare(myPV, rdir, sdir, "Posx", "Pos", 0);
0599       TECcompare(myPV, rdir, sdir, "Res", "Res", 0);
0600       TECcompare(myPV, rdir, sdir, "Chi2", "Chi2", 0);
0601       TECcompare(myPV, rdir, sdir, "NsimHit", "NsimHit", 1, -1.0);
0602 
0603       // matched layers
0604       TH1F* matchedtec[24];
0605       TH1F* newmatchedtec[24];
0606 
0607       rdir->GetObject("TEC/MINUS/ring_1/Posx_matched__TEC__MINUS__ring__1",matchedtec[0]);
0608       rdir->GetObject("TEC/MINUS/ring_1/Posy_matched__TEC__MINUS__ring__1",matchedtec[1]);
0609       rdir->GetObject("TEC/MINUS/ring_2/Posx_matched__TEC__MINUS__ring__2",matchedtec[2]);
0610       rdir->GetObject("TEC/MINUS/ring_2/Posy_matched__TEC__MINUS__ring__2",matchedtec[3]);
0611       rdir->GetObject("TEC/MINUS/ring_5/Posx_matched__TEC__MINUS__ring__5",matchedtec[4]);
0612       rdir->GetObject("TEC/MINUS/ring_5/Posy_matched__TEC__MINUS__ring__5",matchedtec[5]);
0613       rdir->GetObject("TEC/MINUS/ring_1/Resolx_matched__TEC__MINUS__ring__1",matchedtec[6]);
0614       rdir->GetObject("TEC/MINUS/ring_1/Resoly_matched__TEC__MINUS__ring__1",matchedtec[7]);
0615       rdir->GetObject("TEC/MINUS/ring_2/Resolx_matched__TEC__MINUS__ring__2",matchedtec[8]);
0616       rdir->GetObject("TEC/MINUS/ring_2/Resoly_matched__TEC__MINUS__ring__2",matchedtec[9]);
0617       rdir->GetObject("TEC/MINUS/ring_5/Resolx_matched__TEC__MINUS__ring__5",matchedtec[10]);
0618       rdir->GetObject("TEC/MINUS/ring_5/Resoly_matched__TEC__MINUS__ring__5",matchedtec[11]);
0619       rdir->GetObject("TEC/MINUS/ring_1/Resx_matched__TEC__MINUS__ring__1",matchedtec[12]);
0620       rdir->GetObject("TEC/MINUS/ring_1/Resy_matched__TEC__MINUS__ring__1",matchedtec[13]);
0621       rdir->GetObject("TEC/MINUS/ring_2/Resx_matched__TEC__MINUS__ring__2",matchedtec[14]);
0622       rdir->GetObject("TEC/MINUS/ring_2/Resy_matched__TEC__MINUS__ring__2",matchedtec[15]);
0623       rdir->GetObject("TEC/MINUS/ring_5/Resx_matched__TEC__MINUS__ring__5",matchedtec[16]);
0624       rdir->GetObject("TEC/MINUS/ring_5/Resy_matched__TEC__MINUS__ring__5",matchedtec[17]);
0625       rdir->GetObject("TEC/MINUS/ring_1/Chi2_matched__TEC__MINUS__ring__1",matchedtec[18]);
0626       rdir->GetObject("TEC/MINUS/ring_2/Chi2_matched__TEC__MINUS__ring__2",matchedtec[19]);
0627       rdir->GetObject("TEC/MINUS/ring_5/Chi2_matched__TEC__MINUS__ring__5",matchedtec[20]);
0628       rdir->GetObject("TEC/MINUS/ring_1/NsimHit_matched__TEC__MINUS__ring__1",matchedtec[21]);
0629       rdir->GetObject("TEC/MINUS/ring_2/NsimHit_matched__TEC__MINUS__ring__2",matchedtec[22]);
0630       rdir->GetObject("TEC/MINUS/ring_5/NsimHit_matched__TEC__MINUS__ring__5",matchedtec[23]);
0631 
0632       sdir->GetObject("TEC/MINUS/ring_1/Posx_matched__TEC__MINUS__ring__1",newmatchedtec[0]);
0633       sdir->GetObject("TEC/MINUS/ring_1/Posy_matched__TEC__MINUS__ring__1",newmatchedtec[1]);
0634       sdir->GetObject("TEC/MINUS/ring_2/Posx_matched__TEC__MINUS__ring__2",newmatchedtec[2]);
0635       sdir->GetObject("TEC/MINUS/ring_2/Posy_matched__TEC__MINUS__ring__2",newmatchedtec[3]);
0636       sdir->GetObject("TEC/MINUS/ring_5/Posx_matched__TEC__MINUS__ring__5",newmatchedtec[4]);
0637       sdir->GetObject("TEC/MINUS/ring_5/Posy_matched__TEC__MINUS__ring__5",newmatchedtec[5]);
0638       sdir->GetObject("TEC/MINUS/ring_1/Resolx_matched__TEC__MINUS__ring__1",newmatchedtec[6]);
0639       sdir->GetObject("TEC/MINUS/ring_1/Resoly_matched__TEC__MINUS__ring__1",newmatchedtec[7]);
0640       sdir->GetObject("TEC/MINUS/ring_2/Resolx_matched__TEC__MINUS__ring__2",newmatchedtec[8]);
0641       sdir->GetObject("TEC/MINUS/ring_2/Resoly_matched__TEC__MINUS__ring__2",newmatchedtec[9]);
0642       sdir->GetObject("TEC/MINUS/ring_5/Resolx_matched__TEC__MINUS__ring__5",newmatchedtec[10]);
0643       sdir->GetObject("TEC/MINUS/ring_5/Resoly_matched__TEC__MINUS__ring__5",newmatchedtec[11]);
0644       sdir->GetObject("TEC/MINUS/ring_1/Resx_matched__TEC__MINUS__ring__1",newmatchedtec[12]);
0645       sdir->GetObject("TEC/MINUS/ring_1/Resy_matched__TEC__MINUS__ring__1",newmatchedtec[13]);
0646       sdir->GetObject("TEC/MINUS/ring_2/Resx_matched__TEC__MINUS__ring__2",newmatchedtec[14]);
0647       sdir->GetObject("TEC/MINUS/ring_2/Resy_matched__TEC__MINUS__ring__2",newmatchedtec[15]);
0648       sdir->GetObject("TEC/MINUS/ring_5/Resx_matched__TEC__MINUS__ring__5",newmatchedtec[16]);
0649       sdir->GetObject("TEC/MINUS/ring_5/Resy_matched__TEC__MINUS__ring__5",newmatchedtec[17]);
0650       sdir->GetObject("TEC/MINUS/ring_1/Chi2_matched__TEC__MINUS__ring__1",newmatchedtec[18]);
0651       sdir->GetObject("TEC/MINUS/ring_2/Chi2_matched__TEC__MINUS__ring__2",newmatchedtec[19]);
0652       sdir->GetObject("TEC/MINUS/ring_5/Chi2_matched__TEC__MINUS__ring__5",newmatchedtec[20]);
0653       sdir->GetObject("TEC/MINUS/ring_1/NsimHit_matched__TEC__MINUS__ring__1",newmatchedtec[21]);
0654       sdir->GetObject("TEC/MINUS/ring_2/NsimHit_matched__TEC__MINUS__ring__2",newmatchedtec[22]);
0655       sdir->GetObject("TEC/MINUS/ring_5/NsimHit_matched__TEC__MINUS__ring__5",newmatchedtec[23]);
0656 
0657       TCanvas* Strip_TEC_matched = new TCanvas("Strip_TEC_matched","Strip_TEC_matched",1000,1000);
0658       Strip_TEC_matched->Divide(5,5);
0659       for (Int_t i=0; i<24; ++i) {
0660         if (matchedtec[i]->GetEntries() == 0 || newmatchedtec[i]->GetEntries() == 0) continue;
0661         Strip_TEC_matched->cd(i+1);
0662         if (i == 21 || i == 22 || i == 23) SetUpHistograms(matchedtec[i],newmatchedtec[i], -1.0);
0663         else SetUpHistograms(matchedtec[i],newmatchedtec[i]);
0664         matchedtec[i]->Draw();
0665         newmatchedtec[i]->Draw("sames");
0666         myPV->PVCompute(matchedtec[i] , newmatchedtec[i] , te );
0667       }
0668       // TPad *p22 = (TPad *)(Strip_TEC_matched->cd(22));  p22->SetLogy(1);
0669       // TPad *p23 = (TPad *)(Strip_TEC_matched->cd(23));  p23->SetLogy(1);
0670       // TPad *p24 = (TPad *)(Strip_TEC_matched->cd(24));  p24->SetLogy(1);
0671  
0672       sprintf(histoname, "MatchedTECCompare.%s", outfiletype);  Strip_TEC_matched->Print(histoname);
0673     }
0674   }
0675 
0676   //===============================================================
0677   // Phase 0 pixels 
0678 
0679   if (rfile->cd("DQMData/Run 1/TrackerRecHitsV/Run summary/TrackerRecHits/Pixel")) {
0680     rdir = gDirectory;
0681     if (sfile->cd("DQMData/Run 1/TrackerRecHitsV/Run summary/TrackerRecHits/Pixel")) {
0682       sdir = gDirectory;
0683 
0684       // BPIX
0685       for (int layer=1; layer<=3; ++layer) {
0686     BPIXcompare(myPV, rdir, sdir, "Res", layer, "Res");
0687     BPIXcompare(myPV, rdir, sdir, "Pull", layer, "Pull");
0688       }
0689 
0690       // FPIX
0691       for (int disk=1; disk<=2; ++disk) {
0692     FPIXcompare(myPV, rdir, sdir, "Res", disk, "Res");
0693     FPIXcompare(myPV, rdir, sdir, "Pull", disk, "Pull");
0694       }
0695     }
0696   }
0697 
0698   //===============================================================
0699   // Phase 1 pixels 
0700 
0701   if (rfile->cd("DQMData/Run 1/PixelPhase1V/Run summary/RecHits")) {
0702     rdir = gDirectory;
0703     if (sfile->cd("DQMData/Run 1/PixelPhase1V/Run summary/RecHits")) {
0704       sdir = gDirectory;
0705 
0706       // BPIX by layer
0707       for (int layer=1; layer<=4; ++layer) {
0708     Phase1PIXcompare(myPV, rdir, sdir, 0, layer);
0709       }
0710 
0711       // FPIX by disk
0712       for (int disk=1; disk<=3; ++disk) {
0713     Phase1PIXcompare(myPV, rdir, sdir, 1, disk);
0714     Phase1PIXcompare(myPV, rdir, sdir, -1, disk);
0715       }
0716 
0717       // Combined layers
0718       TH1F* refplots[6];
0719       TH1F* newplots[6];
0720       Int_t plotidx = 0;
0721       rdir->GetObject("res_x_PXBarrel", refplots[plotidx]);
0722       sdir->GetObject("res_x_PXBarrel", newplots[plotidx]);
0723       plotidx++;
0724       rdir->GetObject("res_y_PXBarrel", refplots[plotidx]);
0725       sdir->GetObject("res_y_PXBarrel", newplots[plotidx]);
0726       plotidx++;
0727       rdir->GetObject("res_x_PXForward", refplots[plotidx]);
0728       sdir->GetObject("res_x_PXForward", newplots[plotidx]);
0729       plotidx++;
0730       rdir->GetObject("res_y_PXForward", refplots[plotidx]);
0731       sdir->GetObject("res_y_PXForward", newplots[plotidx]);
0732       plotidx++;
0733       rdir->GetObject("rechiterror_x", refplots[plotidx]);
0734       sdir->GetObject("rechiterror_x", newplots[plotidx]);
0735       plotidx++;
0736       rdir->GetObject("rechiterror_y", refplots[plotidx]);
0737       sdir->GetObject("rechiterror_y", newplots[plotidx]);
0738       plotidx++;
0739       int nplots = plotidx;
0740 
0741       TCanvas* Phase1Pix = new TCanvas("Phase1Pix", "Phase1Pix", 1000, 1000);
0742       Phase1Pix->Divide(2,3);
0743       for (Int_t i=0; i<nplots; ++i) {
0744     if (refplots[i]->GetEntries() == 0 || newplots[i]->GetEntries() == 0) continue;
0745     Phase1Pix->cd(i+1);
0746     SetUpHistograms(refplots[i],newplots[i]);
0747     refplots[i]->Draw();
0748     newplots[i]->Draw("sames");
0749     myPV->PVCompute(refplots[i], newplots[i], te);
0750       }
0751       sprintf(histoname, "PX_Compare.%s", outfiletype);
0752       Phase1Pix->Print(histoname);
0753     }
0754   }
0755 }  // ------------------------------------------------------------------------