Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:21

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // Macro to compare histograms from the GlobalDigisProducer for validation
0003 //
0004 // root -b -q MakeValidation.C
0005 ///////////////////////////////////////////////////////////////////////////////
0006 #include "TFile.h"
0007 #include "TTree.h"
0008 #include "TBranch.h"
0009 #include "TString.h"
0010 
0011 void MakeValidation(TString sfilename = "GlobalDigisHistogramsAnalyze.root",
0012             TString rfilename = "GlobalDigisHistogramsAnalyze.root",
0013             TString filename = "GlobalDigisHistogramsCompare")
0014 {
0015   gROOT->Reset();
0016 
0017   // zoom in on x-axis of plots
0018   bool zoomx = false;
0019 
0020   // create new histograms for comparison
0021   //gROOT->LoadMacro("MakeHistograms.C");
0022   //MakeHistograms();
0023 
0024   // setup names
0025   //TString sfilename = "GlobalDigisHistograms.root";
0026   //TString rfilename = "GlobalDigisHistograms-reference.root";
0027 
0028   // clear memory of file names
0029   delete gROOT->GetListOfFiles()->FindObject(sfilename);
0030   delete gROOT->GetListOfFiles()->FindObject(rfilename);
0031 
0032   // open reference file
0033   TFile *sfile = new TFile(sfilename);
0034   TFile *rfile = new TFile(rfilename);
0035 
0036   // create canvas
0037   Int_t cWidth = 928, cHeight = 1218;
0038   TCanvas *myCanvas = new TCanvas("globaldigis","globaldigis");
0039 
0040   // open output ps file
0041   //TString filename = "GlobalHitsHistogramsCompare";
0042   TString psfile = filename+".ps";
0043   TString psfileopen = filename+".ps[";
0044   TString psfileclose = filename+".ps]";
0045   myCanvas->Print(psfileopen);
0046 
0047   // create label
0048   TLatex *label = new TLatex();
0049   label->SetNDC();
0050   label->SetTextSize(0.03);
0051   label->SetTextAlign(22);
0052   TString labeltitle;
0053 
0054   // ceate text
0055   TText* te = new TText();
0056   te->SetTextSize(0.075);
0057 
0058   // create attributes
0059   Int_t rcolor = kBlue;
0060   Int_t rtype = kSolid;
0061   Int_t stype = kSolid;
0062   Int_t scolor = kBlack;
0063   Int_t rlinewidth = 6;
0064   Int_t slinewidth = 2;
0065   vector<Int_t> histnames;
0066 
0067   vector<string> eehistname;
0068   eehistname.push_back("hEcaln_EE");
0069   eehistname.push_back("hEcalAEE_EE");
0070   eehistname.push_back("hEcalSHE_EE");
0071   eehistname.push_back("hEcalMaxPos_EE");
0072   eehistname.push_back("hEcalMultvAEE_EE");
0073   eehistname.push_back("hEcalSHEvAEESHE_EE");
0074   histnames.push_back(0);
0075 
0076   vector<string> ebhistname;
0077   ebhistname.push_back("hEcaln_EB");
0078   ebhistname.push_back("hEcalAEE_EB");
0079   ebhistname.push_back("hEcalSHE_EB");
0080   ebhistname.push_back("hEcalMaxPos_EB");
0081   ebhistname.push_back("hEcalMultvAEE_EB");
0082   ebhistname.push_back("hEcalSHEvAEESHE_EB");
0083   histnames.push_back(1);
0084 
0085   vector<string> eshistname;
0086   eshistname.push_back("hEcaln_ES");
0087   eshistname.push_back("hEcalADC0_ES");
0088   eshistname.push_back("hEcalADC1_ES");
0089   eshistname.push_back("hEcalADC2_ES");
0090   histnames.push_back(2);
0091 
0092   vector<string> hbhistname;
0093   hbhistname.push_back("hHcaln_HB");
0094   hbhistname.push_back("hHcalAEE_HB");
0095   hbhistname.push_back("hHcalSHE_HB");
0096   hbhistname.push_back("hHcalAEESHE_HB");
0097   hbhistname.push_back("hHcalSHEvAEE_HE");
0098   histnames.push_back(3);
0099 
0100   vector<string> hehistname;
0101   hehistname.push_back("hHcaln_HE");
0102   hehistname.push_back("hHcalAEE_HE");
0103   hehistname.push_back("hHcalSHE_HE");
0104   hehistname.push_back("hHcalAEESHE_HE");
0105   hehistname.push_back("hHcalSHEvAEE_HE");
0106   histnames.push_back(4);
0107 
0108   vector<string> hohistname;
0109   hohistname.push_back("hHcaln_HO");
0110   hohistname.push_back("hHcalAEE_HO");
0111   hohistname.push_back("hHcalSHE_HO");
0112   hohistname.push_back("hHcalAEESHE_HO");
0113   hohistname.push_back("hHcalSHEvAEE_HO");
0114   histnames.push_back(5);
0115 
0116   vector<string> hfhistname;
0117   hfhistname.push_back("hHcaln_HF");
0118   hfhistname.push_back("hHcalAEE_HF");
0119   hfhistname.push_back("hHcalSHE_HF");
0120   hfhistname.push_back("hHcalAEESHE_HF");
0121   hfhistname.push_back("hHcalSHEvAEE_HF");
0122   histnames.push_back(6);
0123 
0124   vector<string> tibl1histname;
0125   tibl1histname.push_back("hSiStripn_TIBL1");
0126   tibl1histname.push_back("hSiStripADC_TIBL1");
0127   tibl1histname.push_back("hSiStripStripADC_TIBL1");
0128   histnames.push_back(7);
0129 
0130   vector<string> tibl2histname;
0131   tibl2histname.push_back("hSiStripn_TIBL2");
0132   tibl2histname.push_back("hSiStripADC_TIBL2");
0133   tibl2histname.push_back("hSiStripStripADC_TIBL2");
0134   histnames.push_back(8);
0135 
0136   vector<string> tibl3histname;
0137   tibl3histname.push_back("hSiStripn_TIBL3");
0138   tibl3histname.push_back("hSiStripADC_TIBL3");
0139   tibl3histname.push_back("hSiStripStripADC_TIBL3");
0140   histnames.push_back(9);
0141 
0142   vector<string> tibl4histname;
0143   tibl4histname.push_back("hSiStripn_TIBL4");
0144   tibl4histname.push_back("hSiStripADC_TIBL4");
0145   tibl4histname.push_back("hSiStripStripADC_TIBL4");
0146   histnames.push_back(10);
0147 
0148   vector<string> tobl1histname;
0149   tobl1histname.push_back("hSiStripn_TOBL1");
0150   tobl1histname.push_back("hSiStripADC_TOBL1");
0151   tobl1histname.push_back("hSiStripStripADC_TOBL1");
0152   histnames.push_back(11);
0153 
0154   vector<string> tobl2histname;
0155   tobl2histname.push_back("hSiStripn_TOBL2");
0156   tobl2histname.push_back("hSiStripADC_TOBL2");
0157   tobl2histname.push_back("hSiStripStripADC_TOBL2");
0158   histnames.push_back(12);
0159 
0160   vector<string> tobl3histname;
0161   tobl3histname.push_back("hSiStripn_TOBL3");
0162   tobl3histname.push_back("hSiStripADC_TOBL3");
0163   tobl3histname.push_back("hSiStripStripADC_TOBL3");
0164   histnames.push_back(13);
0165 
0166   vector<string> tobl4histname;
0167   tobl4histname.push_back("hSiStripn_TOBL4");
0168   tobl4histname.push_back("hSiStripADC_TOBL4");
0169   tobl4histname.push_back("hSiStripStripADC_TOBL4");
0170   histnames.push_back(14);
0171 
0172   vector<string> tidw1histname;
0173   tidw1histname.push_back("hSiStripn_TIDW1");
0174   tidw1histname.push_back("hSiStripADC_TIDW1");
0175   tidw1histname.push_back("hSiStripStripADC_TIDW1");
0176   histnames.push_back(15);
0177 
0178   vector<string> tidw2histname;
0179   tidw2histname.push_back("hSiStripn_TIDW2");
0180   tidw2histname.push_back("hSiStripADC_TIDW2");
0181   tidw2histname.push_back("hSiStripStripADC_TIDW2");
0182   histnames.push_back(16);
0183 
0184   vector<string> tidw3histname;
0185   tidw3histname.push_back("hSiStripn_TIDW3");
0186   tidw3histname.push_back("hSiStripADC_TIDW3");
0187   tidw3histname.push_back("hSiStripStripADC_TIDW3");
0188   histnames.push_back(17);
0189 
0190   vector<string> tecw1histname;
0191   tecw1histname.push_back("hSiStripn_TECW1");
0192   tecw1histname.push_back("hSiStripADC_TECW1");
0193   tecw1histname.push_back("hSiStripStripADC_TECW1");
0194   histnames.push_back(18);
0195 
0196   vector<string> tecw2histname;
0197   tecw2histname.push_back("hSiStripn_TECW2");
0198   tecw2histname.push_back("hSiStripADC_TECW2");
0199   tecw2histname.push_back("hSiStripStripADC_TECW2");
0200   histnames.push_back(19);
0201 
0202   vector<string> tecw3histname;
0203   tecw3histname.push_back("hSiStripn_TECW3");
0204   tecw3histname.push_back("hSiStripADC_TECW3");
0205   tecw3histname.push_back("hSiStripStripADC_TECW3");
0206   histnames.push_back(20);
0207 
0208   vector<string> tecw4histname;
0209   tecw4histname.push_back("hSiStripn_TECW4");
0210   tecw4histname.push_back("hSiStripADC_TECW4");
0211   tecw4histname.push_back("hSiStripStripADC_TECW4");
0212   histnames.push_back(21);
0213 
0214   vector<string> tecw5histname;
0215   tecw5histname.push_back("hSiStripn_TECW5");
0216   tecw5histname.push_back("hSiStripADC_TECW5");
0217   tecw5histname.push_back("hSiStripStripADC_TECW5");
0218   histnames.push_back(22);
0219 
0220   vector<string> tecw6histname;
0221   tecw6histname.push_back("hSiStripn_TECW6");
0222   tecw6histname.push_back("hSiStripADC_TECW6");
0223   tecw6histname.push_back("hSiStripStripADC_TECW6");
0224   histnames.push_back(23);
0225 
0226   vector<string> tecw7histname;
0227   tecw7histname.push_back("hSiStripn_TECW7");
0228   tecw7histname.push_back("hSiStripADC_TECW7");
0229   tecw7histname.push_back("hSiStripStripADC_TECW7");
0230   histnames.push_back(24);
0231 
0232   vector<string> tecw8histname;
0233   tecw8histname.push_back("hSiStripn_TECW8");
0234   tecw8histname.push_back("hSiStripADC_TECW8");
0235   tecw8histname.push_back("hSiStripStripADC_TECW8");
0236   histnames.push_back(25);
0237 
0238   vector<string> brl1histname;
0239   brl1histname.push_back("hSiPixeln_BRL1");
0240   brl1histname.push_back("hSiPixelADC_BRL1");
0241   brl1histname.push_back("hSiPixelRow_BRL1");
0242   brl1histname.push_back("hSiPixelColumn_BRL1");
0243   histnames.push_back(26);
0244 
0245   vector<string> brl2histname;
0246   brl2histname.push_back("hSiPixeln_BRL2");
0247   brl2histname.push_back("hSiPixelADC_BRL2");
0248   brl2histname.push_back("hSiPixelRow_BRL2");
0249   brl2histname.push_back("hSiPixelColumn_BRL2");
0250   histnames.push_back(27);
0251 
0252   vector<string> brl3histname;
0253   brl3histname.push_back("hSiPixeln_BRL3");
0254   brl3histname.push_back("hSiPixelADC_BRL3");
0255   brl3histname.push_back("hSiPixelRow_BRL3");
0256   brl3histname.push_back("hSiPixelColumn_BRL3");
0257   histnames.push_back(28);
0258 
0259   vector<string> fwd1phistname;
0260   fwd1phistname.push_back("hSiPixeln_FWD1p");
0261   fwd1phistname.push_back("hSiPixelADC_FWD1p");
0262   fwd1phistname.push_back("hSiPixelRow_FWD1p");
0263   fwd1phistname.push_back("hSiPixelColumn_FWD1p");
0264   histnames.push_back(29);
0265 
0266   vector<string> fwd1nhistname;
0267   fwd1nhistname.push_back("hSiPixeln_FWD1n");
0268   fwd1nhistname.push_back("hSiPixelADC_FWD1n");
0269   fwd1nhistname.push_back("hSiPixelRow_FWD1n");
0270   fwd1nhistname.push_back("hSiPixelColumn_FWD1n");
0271   histnames.push_back(30);
0272 
0273   vector<string> fwd2phistname;
0274   fwd2phistname.push_back("hSiPixeln_FWD2p");
0275   fwd2phistname.push_back("hSiPixelADC_FWD2p");
0276   fwd2phistname.push_back("hSiPixelRow_FWD2p");
0277   fwd2phistname.push_back("hSiPixelColumn_FWD2p");
0278   histnames.push_back(31);
0279 
0280   vector<string> fwd2nhistname;
0281   fwd2nhistname.push_back("hSiPixeln_FWD2n");
0282   fwd2nhistname.push_back("hSiPixelADC_FWD2n");
0283   fwd2nhistname.push_back("hSiPixelRow_FWD2n");
0284   fwd2nhistname.push_back("hSiPixelColumn_FWD2n");
0285   histnames.push_back(32);
0286 
0287   vector<string> mb1histname;
0288   mb1histname.push_back("hDtMuonn_MB1");
0289   mb1histname.push_back("hDtLayer_MB1");
0290   mb1histname.push_back("hDtMuonTime_MB1");
0291   mb1histname.push_back("hDtMuonTimevLayer_MB1");
0292   histnames.push_back(33);
0293 
0294   vector<string> mb2histname;
0295   mb2histname.push_back("hDtMuonn_MB2");
0296   mb2histname.push_back("hDtLayer_MB2");
0297   mb2histname.push_back("hDtMuonTime_MB2");
0298   mb2histname.push_back("hDtMuonTimevLayer_MB2");
0299   histnames.push_back(34);
0300 
0301   vector<string> mb3histname;
0302   mb3histname.push_back("hDtMuonn_MB3");
0303   mb3histname.push_back("hDtLayer_MB3");
0304   mb3histname.push_back("hDtMuonTime_MB3");
0305   mb3histname.push_back("hDtMuonTimevLayer_MB3");
0306   histnames.push_back(35);
0307 
0308   vector<string> mb4histname;
0309   mb4histname.push_back("hDtMuonn_MB4");
0310   mb4histname.push_back("hDtLayer_MB4");
0311   mb4histname.push_back("hDtMuonTime_MB4");
0312   mb4histname.push_back("hDtMuonTimevLayer_MB4");
0313   histnames.push_back(36);
0314 
0315   vector<string> cscstriphistname;
0316   cscstriphistname.push_back("hCSCStripn");
0317   cscstriphistname.push_back("hCSCStripADC");
0318   histnames.push_back(37);
0319 
0320   vector<string> cscwirehistname;
0321   cscwirehistname.push_back("hCSCWiren");
0322   cscwirehistname.push_back("hCSCWireTime");
0323   histnames.push_back(38);
0324 
0325   //loop through histograms to prepare output
0326   for (Int_t i = 0; i < histnames.size(); ++i) {
0327 
0328     Int_t page = histnames[i];
0329 
0330     vector<string> names;
0331     bool logy3 = kFALSE;
0332     bool logy2 = kFALSE;
0333 
0334     // setup canvas depending on group of plots
0335     TCanvas *Canvas;
0336 
0337     if (page == 0) {
0338       logy3 = kTRUE;
0339       names = eehistname;
0340       //Canvas = new TCanvas("eecal","eecal",cWidth,cHeight);
0341       Canvas = new TCanvas("eecal", "eecal");
0342       Canvas->Divide(2,3);
0343       myCanvas = Canvas;
0344       myCanvas->cd(0);
0345     }
0346     if (page == 1) {
0347       logy3 = kTRUE;
0348       names = ebhistname;
0349       Canvas = new TCanvas("ebcal","ebcal");
0350       Canvas->Divide(2,3);
0351       myCanvas = Canvas;
0352       myCanvas->cd(0);
0353 
0354     }
0355     if (page == 2) {
0356       names = eshistname;
0357       Canvas = new TCanvas("escal","escal");
0358       Canvas->Divide(2,2);
0359       myCanvas = Canvas;
0360       myCanvas->cd(0);
0361 
0362     }
0363     if (page == 3) {
0364       logy3 = kTRUE;
0365       names = hbhistname;
0366       Canvas = new TCanvas("hbcal","hbcal");
0367       Canvas->Divide(2,3);
0368       myCanvas = Canvas;
0369       myCanvas->cd(0);
0370 
0371     }
0372     if (page == 4) {
0373       logy3 = kTRUE;
0374       names = hehistname;
0375       Canvas = new TCanvas("hecal","hecal");
0376       Canvas->Divide(2,3);
0377       myCanvas = Canvas;
0378       myCanvas->cd(0);
0379 
0380     }
0381     if (page == 5) {
0382       logy3 = kTRUE;
0383       names = hohistname;
0384       Canvas = new TCanvas("hocal","hocal");
0385       Canvas->Divide(2,3);
0386       myCanvas = Canvas;
0387       myCanvas->cd(0);
0388 
0389     }
0390     if (page == 6) {
0391       logy3 = kTRUE;
0392       names = hfhistname;
0393       Canvas = new TCanvas("hfcal","hfcal");
0394       Canvas->Divide(2,3);
0395       myCanvas = Canvas;
0396       myCanvas->cd(0);
0397 
0398     }
0399     if (page == 7) {
0400       names = tibl1histname;
0401       Canvas = new TCanvas("tibl1","tibl1");
0402       Canvas->Divide(2,2);
0403       myCanvas = Canvas;
0404       myCanvas->cd(0);
0405 
0406     }
0407     if (page == 8) {
0408       names = tibl2histname;
0409       Canvas = new TCanvas("tibl2","tibl2");
0410       Canvas->Divide(2,2);
0411       myCanvas = Canvas; myCanvas->cd(0);
0412     }
0413     if (page == 9) {
0414       names = tibl3histname;
0415       Canvas = new TCanvas("tibl3","tibl3");
0416       Canvas->Divide(2,2);
0417       myCanvas = Canvas; myCanvas->cd(0);
0418     }
0419     if (page == 10) {
0420       names = tibl4histname;
0421       Canvas = new TCanvas("tibl4","tibl4");
0422       Canvas->Divide(2,2);
0423       myCanvas = Canvas; myCanvas->cd(0);
0424     }
0425     if (page == 11) {
0426       names = tobl1histname;
0427       Canvas = new TCanvas("tobl1","tobl1");
0428       Canvas->Divide(2,2);
0429       myCanvas = Canvas; myCanvas->cd(0);
0430     }
0431     if (page == 12) {
0432       names = tobl2histname;
0433       Canvas = new TCanvas("tobl2","tobl2" );
0434       Canvas->Divide(2,2);
0435       myCanvas = Canvas; myCanvas->cd(0);
0436     }
0437     if (page == 13) {
0438       names = tobl3histname;
0439       Canvas = new TCanvas("tobl3","tobl3" );
0440       Canvas->Divide(2,2);
0441       myCanvas = Canvas; myCanvas->cd(0);
0442     }
0443     if (page == 14) {
0444       names = tobl4histname;
0445       Canvas = new TCanvas("tobl4","tobl4" );
0446       Canvas->Divide(2,2);
0447       myCanvas = Canvas; myCanvas->cd(0);
0448     }
0449     if (page == 15) {
0450       names = tidw1histname;
0451       Canvas = new TCanvas("tidw1","tidw1" );
0452       Canvas->Divide(2,2);
0453       myCanvas = Canvas; myCanvas->cd(0);
0454     }
0455     if (page == 16) {
0456       names = tidw2histname;
0457       Canvas = new TCanvas("tidw2","tidw2" );
0458       Canvas->Divide(2,2);
0459       myCanvas = Canvas; myCanvas->cd(0);
0460     }
0461     if (page == 17) {
0462       names = tidw3histname;
0463       Canvas = new TCanvas("tidw3","tidw3" );
0464       Canvas->Divide(2,2);
0465       myCanvas = Canvas; myCanvas->cd(0);
0466     }
0467     if (page == 18) {
0468       names = tecw1histname;
0469       Canvas = new TCanvas("tecw1","tecw1" );
0470       Canvas->Divide(2,2);
0471       myCanvas = Canvas; myCanvas->cd(0);
0472     }
0473     if (page == 19) {
0474       names = tecw2histname;
0475       Canvas = new TCanvas("tecw2","tecw2" );
0476       Canvas->Divide(2,2);
0477       myCanvas = Canvas; myCanvas->cd(0);
0478     }
0479     if (page == 20) {
0480       names = tecw3histname;
0481       Canvas = new TCanvas("tecw3","tecw3" );
0482       Canvas->Divide(2,2);
0483       myCanvas = Canvas; myCanvas->cd(0);
0484     }
0485     if (page == 21) {
0486       names = tecw4histname;
0487       Canvas = new TCanvas("tecw4","tecw4" );
0488       Canvas->Divide(2,2);
0489       myCanvas = Canvas; myCanvas->cd(0);
0490     }
0491     if (page == 22) {
0492       names = tecw5histname;
0493       Canvas = new TCanvas("tecw5","tecw5" );
0494       Canvas->Divide(2,2);
0495       myCanvas = Canvas; myCanvas->cd(0);
0496     }
0497     if (page == 23) {
0498       names = tecw6histname;
0499       Canvas = new TCanvas("tecw6","tecw6" );
0500       Canvas->Divide(2,2);
0501       myCanvas = Canvas; myCanvas->cd(0);
0502     }
0503     if (page == 24) {
0504       names = tecw7histname;
0505       Canvas = new TCanvas("tecw7","tecw7" );
0506       Canvas->Divide(2,2);
0507       myCanvas = Canvas; myCanvas->cd(0);
0508     }
0509     if (page == 25) {
0510       names = tecw8histname;
0511       Canvas = new TCanvas("tecw8","tecw8" );
0512       Canvas->Divide(2,2);
0513       myCanvas = Canvas; myCanvas->cd(0);
0514     }
0515     if (page == 26) {
0516       logy2 = kTRUE;
0517       names = brl1histname;
0518       Canvas = new TCanvas("brl1","brl1" );
0519       Canvas->Divide(2,2);
0520       myCanvas = Canvas; myCanvas->cd(0);
0521     }
0522     if (page == 27) {
0523       logy2 = kTRUE;
0524       names = brl2histname;
0525       Canvas = new TCanvas("brl2","brl2" );
0526       Canvas->Divide(2,2);
0527       myCanvas = Canvas; myCanvas->cd(0);
0528     }
0529     if (page == 28) {
0530       logy2 = kTRUE;
0531       names = brl3histname;
0532       Canvas = new TCanvas("brl3","brl3" );
0533       Canvas->Divide(2,2);
0534       myCanvas = Canvas; myCanvas->cd(0);
0535     }
0536     if (page == 29) {
0537       logy2 = kTRUE;
0538       names = fwd1phistname;
0539       Canvas = new TCanvas("fwd1p","fwd1p" );
0540       Canvas->Divide(2,2);
0541       myCanvas = Canvas; myCanvas->cd(0);
0542     }
0543     if (page == 30) {
0544       logy2 = kTRUE;
0545       names = fwd1nhistname;
0546       Canvas = new TCanvas("fwd1n","fwd1n" );
0547       Canvas->Divide(2,2);
0548       myCanvas = Canvas; myCanvas->cd(0);
0549     }
0550     if (page == 31) {
0551       logy2 = kTRUE;
0552       names = fwd2phistname;
0553       Canvas = new TCanvas("fwd2p","fwd2p" );
0554       Canvas->Divide(2,2);
0555       myCanvas = Canvas; myCanvas->cd(0);
0556     }
0557     if (page == 32) {
0558       logy2 = kTRUE;
0559       names = fwd2nhistname;
0560       Canvas = new TCanvas("fwd2n","fwd2n" );
0561       Canvas->Divide(2,2);
0562       myCanvas = Canvas; myCanvas->cd(0);
0563     }
0564     if (page == 33) {
0565       names = mb1histname;
0566       Canvas = new TCanvas("mb1","mb1" );
0567       Canvas->Divide(2,2);
0568       myCanvas = Canvas; myCanvas->cd(0);
0569     }
0570     if (page == 34) {
0571       names = mb2histname;
0572       Canvas = new TCanvas("mb2","mb2" );
0573       Canvas->Divide(2,2);
0574       myCanvas = Canvas; myCanvas->cd(0);
0575     }
0576     if (page == 35) {
0577       names = mb3histname;
0578       Canvas = new TCanvas("mb3","mb3" );
0579       Canvas->Divide(2,2);
0580       myCanvas = Canvas; myCanvas->cd(0);
0581     }
0582     if (page == 36) {
0583       names = mb4histname;
0584       Canvas = new TCanvas("mb4","mb4" );
0585       Canvas->Divide(2,2);
0586       myCanvas = Canvas; myCanvas->cd(0);
0587     }
0588     if (page == 37) {
0589       names = cscstriphistname;
0590       Canvas = new TCanvas("cscstrip","cscstrip" );
0591       Canvas->Divide(2,2);
0592       myCanvas = Canvas; myCanvas->cd(0);
0593     }
0594     if (page == 38) {
0595       names = cscwirehistname;
0596       Canvas = new TCanvas("cscwire","cscwire" );
0597       Canvas->Divide(2,2);
0598       myCanvas = Canvas; myCanvas->cd(0);
0599     }
0600 
0601     // loop through plots
0602     for (Int_t j = 0; j < names.size(); ++j) {
0603 
0604       // extract plot from both files
0605       //TH1F *sh = (TH1F*)sfile->Get(names[j].c_str());
0606       TH1F *sh; TH1F *rh;
0607       if(page >= 0 && page < 3)
0608     {
0609       TString hpath = "DQMData/GlobalDigisV/ECals/"+names[j];
0610     }
0611       if(page >= 3 && page < 7)
0612     {
0613       TString hpath = "DQMData/GlobalDigisV/HCals/"+names[j];
0614     }
0615       if(page >=7 && page < 26)
0616     {
0617       TString hpath = "DQMData/GlobalDigisV/SiStrips/"+names[j];
0618     }
0619       if(page >= 26 && page < 33)
0620     {
0621       TString hpath = "DQMData/GlobalDigisV/SiPixels/"+names[j];
0622     }
0623       if(page >= 33 && page < 39)
0624     {
0625       TString hpath = "DQMData/GlobalDigisV/Muons/"+names[j];
0626     }
0627     sh = (TH1F*)sfile->Get(hpath);
0628     rh = (TH1F*)rfile->Get(hpath);
0629 
0630       
0631 
0632       if (!sh) cout << names[j].c_str() << "doesn't exist" << endl;
0633       sh->SetLineColor(scolor);
0634       sh->SetLineWidth(slinewidth);
0635       sh->SetLineStyle(stype);
0636       Double_t smax = sh->GetMaximum();
0637       //TH1F *rh = (TH1F*)rfile->Get(names[j].c_str());
0638       rh->SetLineColor(rcolor);
0639       rh->SetLineWidth(rlinewidth);
0640       rh->SetLineStyle(rtype);
0641       Double_t rmax = rh->GetMaximum();
0642 
0643       // find the probability value for the two plots being from the same
0644       // source
0645       //double pv = rh->Chi2Test(sh,"OU");
0646       double pv = rh->KolmogorovTest(sh);
0647       std::strstream buf;
0648       std::string value;
0649       buf << "PV=" << pv <<std::endl;
0650       buf >> value;
0651 
0652       // set maximum of y axis
0653       Double_t max = smax;
0654       if (rmax > smax) max = rmax;
0655       max *= 1.10;
0656       rh->SetMaximum(max);
0657 
0658       // zoom in on x axis
0659       if (zoomx) {
0660     Int_t nbins = rh->GetNbinsX();
0661     Int_t rlbin, slbin;
0662     Int_t rfbin = -1, sfbin = -1;
0663     for (Int_t k = 1; k < nbins; ++k) {
0664       Int_t rbincont = rh->GetBinContent(k);
0665       if (rbincont != 0) {
0666         rlbin = k;
0667         if (rfbin == -1) rfbin = k;
0668       }
0669       Int_t sbincont = sh->GetBinContent(k);
0670       if (sbincont != 0) {
0671         slbin = k;
0672         if (sfbin == -1) sfbin = k;
0673       }
0674     }
0675     Int_t binmin = rfbin, binmax = rlbin+1;
0676     if (sfbin < binmin) binmin = sfbin;
0677     if (slbin > binmax) binmax = slbin+1;
0678     rh->SetAxisRange(rh->GetBinLowEdge(binmin),rh->GetBinLowEdge(binmax));
0679       }
0680 
0681       // make plots
0682       myCanvas->cd(j+1);
0683       //if (j == 0) gPad->SetLogy();
0684       //if (logy2 && j == 1) gPad->SetLogy();
0685       //if (logy3 && j == 2) gPad->SetLogy();
0686       rh->Draw();
0687       sh->Draw("sames");
0688 
0689       te->DrawTextNDC(0.15,0.8, value.c_str());
0690       std::cout << "[OVAL] " << rh->GetName() 
0691         << " PV = " << pv << std::endl;
0692     }
0693     myCanvas->Print(psfile);
0694 
0695   } 
0696 
0697   // close output ps file
0698   myCanvas->Print(psfileclose);
0699 
0700   // close root files
0701   rfile->Close();
0702   sfile->Close();
0703 
0704   TString cmnd;
0705   cmnd = "ps2pdf "+psfile+" "+filename+".pdf";
0706   gSystem->Exec(cmnd);
0707   cmnd = "rm "+psfile;
0708   gSystem->Exec(cmnd); 
0709 
0710   return;
0711 }