Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "TFile.h"
0002 #include "TTree.h"
0003 #include "TText.h"
0004 
0005 void EcalMixingModulePlotCompare( TString currentfile = "EcalDigisValidation_new.root",
0006                            TString referencefile = "EcalDigisValidation_old.root" )
0007 {
0008 
0009  gROOT ->Reset();
0010  char*  rfilename = referencefile ;
0011  char*  sfilename = currentfile ;
0012 
0013  int rcolor = 2;
0014  int scolor = 4;
0015 
0016  delete gROOT->GetListOfFiles()->FindObject(rfilename);
0017  delete gROOT->GetListOfFiles()->FindObject(sfilename);
0018 
0019  TText* te = new TText();
0020  te->SetTextSize(0.1);
0021  TFile * rfile = new TFile(rfilename);
0022  TFile * sfile = new TFile(sfilename);
0023 
0024  rfile->cd("DQMData/EcalDigisV/EcalDigiTask");
0025  gDirectory->ls();
0026 
0027  sfile->cd("DQMData/EcalDigisV/EcalDigiTask");
0028  gDirectory->ls();
0029 
0030  Char_t histo[200];
0031 
0032  gStyle->SetOptStat("n");
0033 
0034  gROOT->ProcessLine(".x HistoCompare.C");
0035  HistoCompare * myPV = new HistoCompare();
0036 
0037 //////////////////////////////////////////////////////////////
0038 
0039  // maximum Digi over Sim ratio
0040 
0041  if (1) {
0042    TCanvas * Ecal = new TCanvas("Ecal","Ecal",800,1000);
0043    Ecal->Divide(1,2);
0044 
0045    TH1 * meEBDigiMixRatiogt100ADC_;
0046    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC;1",meEBDigiMixRatiogt100ADC_);
0047    meEBDigiMixRatiogt100ADC_;
0048    meEBDigiMixRatiogt100ADC_->SetLineColor(rcolor);
0049 
0050    TH1 * meEEDigiMixRatiogt100ADC_;
0051    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC;1",meEEDigiMixRatiogt100ADC_);
0052    meEEDigiMixRatiogt100ADC_;
0053    meEEDigiMixRatiogt100ADC_->SetLineColor(rcolor);
0054 
0055    TH1 * newmeEBDigiMixRatiogt100ADC_;
0056    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel maximum Digi over sim signal ratio gt 100 ADC;1",newmeEBDigiMixRatiogt100ADC_);
0057    newmeEBDigiMixRatiogt100ADC_;
0058    newmeEBDigiMixRatiogt100ADC_->SetLineColor(scolor);
0059 
0060    TH1 * newmeEEDigiMixRatiogt100ADC_;
0061    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap maximum Digi over sim signal ratio gt 100 ADC;1",newmeEEDigiMixRatiogt100ADC_);
0062    newmeEEDigiMixRatiogt100ADC_;
0063    newmeEEDigiMixRatiogt100ADC_->SetLineColor(scolor);
0064 
0065    Ecal->cd(1);
0066    gPad->SetLogy(0);
0067    if ( meEBDigiMixRatiogt100ADC_ && newmeEBDigiMixRatiogt100ADC_ ) {
0068      meEBDigiMixRatiogt100ADC_->Draw();
0069      newmeEBDigiMixRatiogt100ADC_->Draw("same");
0070      myPV->PVCompute(meEBDigiMixRatiogt100ADC_ , newmeEBDigiMixRatiogt100ADC_ , te );
0071    }
0072    gPad->SetLogy(1);
0073    Ecal->cd(2);
0074    gPad->SetLogy(0);
0075    if ( meEEDigiMixRatiogt100ADC_ && newmeEEDigiMixRatiogt100ADC_ ) {
0076      meEEDigiMixRatiogt100ADC_->Draw();
0077      newmeEEDigiMixRatiogt100ADC_->Draw("same");
0078      myPV->PVCompute(meEEDigiMixRatiogt100ADC_ , newmeEEDigiMixRatiogt100ADC_ , te );
0079    }
0080    gPad->SetLogy(1);
0081    Ecal->Print("MaxADC_over_SimSignal_Ratio_gt100ADC_compare.eps");
0082  } 
0083 
0084  if (1) {
0085    TCanvas * Ecal = new TCanvas("Ecal","Ecal",800,1000);
0086    Ecal->Divide(1,2);
0087 
0088    TH1 * meEBDigiMixRatioOriggt50pc_;
0089    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun;1",meEBDigiMixRatioOriggt50pc_);
0090    meEBDigiMixRatioOriggt50pc_;
0091    meEBDigiMixRatioOriggt50pc_->SetLineColor(rcolor);
0092 
0093    TH1 * meEEDigiMixRatioOriggt40pc_;
0094    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun;1",meEEDigiMixRatioOriggt40pc_);
0095    meEEDigiMixRatioOriggt40pc_;
0096    meEEDigiMixRatioOriggt40pc_->SetLineColor(rcolor);
0097 
0098    TH1 * newmeEBDigiMixRatioOriggt50pc_;
0099    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel maximum Digi over sim signal ratio signal gt 50pc gun;1",newmeEBDigiMixRatioOriggt50pc_);
0100    newmeEBDigiMixRatioOriggt50pc_;
0101    newmeEBDigiMixRatioOriggt50pc_->SetLineColor(scolor);
0102 
0103    TH1 * newmeEEDigiMixRatioOriggt40pc_;
0104    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap maximum Digi over sim signal ratio signal gt 40pc gun;1",newmeEEDigiMixRatioOriggt40pc_);
0105    newmeEEDigiMixRatioOriggt40pc_;
0106    newmeEEDigiMixRatioOriggt40pc_->SetLineColor(scolor);
0107 
0108    Ecal->cd(1);
0109    gPad->SetLogy(0);
0110    if ( meEBDigiMixRatioOriggt50pc_ && newmeEBDigiMixRatioOriggt50pc_ ) {
0111      meEBDigiMixRatioOriggt50pc_->Draw();
0112      newmeEBDigiMixRatioOriggt50pc_->Draw("same");
0113      myPV->PVCompute(meEBDigiMixRatioOriggt50pc_ , newmeEBDigiMixRatioOriggt50pc_ , te );
0114    }
0115    gPad->SetLogy(1);
0116    Ecal->cd(2);
0117    gPad->SetLogy(0);
0118    if ( meEEDigiMixRatioOriggt40pc_ && newmeEEDigiMixRatioOriggt40pc_ ) {
0119      meEEDigiMixRatioOriggt40pc_->Draw();
0120      newmeEEDigiMixRatioOriggt40pc_->Draw("same");
0121      myPV->PVCompute(meEEDigiMixRatioOriggt40pc_ , newmeEEDigiMixRatioOriggt40pc_ , te );
0122    }
0123    gPad->SetLogy(1);
0124    Ecal->Print("MaxADC_over_SimSignal_Ratio_Origgt50pc_compare.eps");
0125  } 
0126 
0127  // Bunch crossing distribution
0128 
0129  if (1) {
0130    TCanvas * Ecal = new TCanvas("Ecal","Ecal",800,1000);
0131    Ecal->Divide(1,3);
0132 
0133    TH1 * meEBbunchCrossing_;
0134    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel bunch crossing;1",meEBbunchCrossing_);
0135    meEBbunchCrossing_;
0136    meEBbunchCrossing_->SetLineColor(rcolor);
0137 
0138    TH1 * meEEbunchCrossing_;
0139    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap bunch crossing;1",meEEbunchCrossing_);
0140    meEEbunchCrossing_;
0141    meEEbunchCrossing_->SetLineColor(rcolor);
0142 
0143    TH1 * meESbunchCrossing_;
0144    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Preshower bunch crossing;1",meESbunchCrossing_);
0145    meESbunchCrossing_;
0146    meESbunchCrossing_->SetLineColor(rcolor);
0147 
0148    TH1 * newmeEBbunchCrossing_;
0149    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel bunch crossing;1",newmeEBbunchCrossing_);
0150    newmeEBbunchCrossing_;
0151    newmeEBbunchCrossing_->SetLineColor(scolor);
0152 
0153    TH1 * newmeEEbunchCrossing_;
0154    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap bunch crossing;1",newmeEEbunchCrossing_);
0155    newmeEEbunchCrossing_;
0156    newmeEEbunchCrossing_->SetLineColor(scolor);
0157 
0158    TH1 * newmeESbunchCrossing_;
0159    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Preshower bunch crossing;1",newmeESbunchCrossing_);
0160    newmeESbunchCrossing_;
0161    newmeESbunchCrossing_->SetLineColor(scolor);
0162    
0163    Ecal->cd(1); 
0164    if ( meEBbunchCrossing_ && newmeEBbunchCrossing_ ) {
0165      meEBbunchCrossing_->Draw(); 
0166      newmeEBbunchCrossing_->Draw("same"); 
0167      myPV->PVCompute( meEBbunchCrossing_ , newmeEBbunchCrossing_ , te );
0168    }
0169    Ecal->cd(2); 
0170    if ( meEEbunchCrossing_ && newmeEEbunchCrossing_ ) {
0171      meEEbunchCrossing_->Draw(); 
0172      newmeEEbunchCrossing_->Draw("same"); 
0173      myPV->PVCompute( meEEbunchCrossing_ , newmeEEbunchCrossing_ , te );
0174    }
0175    Ecal->cd(3); 
0176    if ( meESbunchCrossing_ && newmeESbunchCrossing_ ) {
0177      meESbunchCrossing_->Draw(); 
0178      newmeESbunchCrossing_->Draw("same"); 
0179      myPV->PVCompute( meESbunchCrossing_ , newmeESbunchCrossing_ , te );
0180    }
0181    Ecal->Print("BunchCrossing_compare.eps");
0182 
0183  }
0184 
0185 
0186  // Global shapes and ratios
0187 
0188  if (1) {
0189    TCanvas * Ecal = new TCanvas("Ecal","Ecal",800,1000);
0190    Ecal->Divide(2,3);
0191    
0192    TProfile * meEBShape_;
0193    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel shape digi;1", meEBShape_);
0194    meEBShape_;
0195    meEBShape_->SetLineColor(rcolor);
0196 
0197    TH1 * meEBShapeRatio_;
0198    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel shape digi ratio;1",  meEBShapeRatio_ );
0199    meEBShapeRatio_;
0200    meEBShapeRatio_->SetLineColor(rcolor);
0201 
0202    TProfile * meEEShape_;
0203    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap shape digi;1", meEEShape_);
0204    meEEShape_;
0205    meEEShape_->SetLineColor(rcolor);
0206 
0207    TH1 * meEEShapeRatio_;
0208    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap shape digi ratio;1",  meEEShapeRatio_ );
0209    meEEShapeRatio_;
0210    meEEShapeRatio_->SetLineColor(rcolor);
0211 
0212    TProfile * meESShape_;
0213    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Preshower shape digi;1", meESShape_);
0214    meESShape_;
0215    meESShape_->SetLineColor(rcolor);
0216 
0217    TH1 * meESShapeRatio_;
0218    rfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Preshower shape digi ratio;1",  meESShapeRatio_ );
0219    meESShapeRatio_;
0220    meESShapeRatio_->SetLineColor(rcolor);
0221    
0222    TProfile * newmeEBShape_;
0223    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel shape digi;1", newmeEBShape_);
0224    newmeEBShape_;
0225    newmeEBShape_->SetLineColor(scolor);
0226 
0227    TH1 * newmeEBShapeRatio_;
0228    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel shape digi ratio;1",  newmeEBShapeRatio_ );
0229    newmeEBShapeRatio_;
0230    newmeEBShapeRatio_->SetLineColor(scolor);
0231 
0232    TProfile * newmeEEShape_;
0233    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap shape digi;1", newmeEEShape_);
0234    newmeEEShape_;
0235    newmeEEShape_->SetLineColor(scolor);
0236 
0237    TH1 * newmeEEShapeRatio_;
0238    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap shape digi ratio;1",  newmeEEShapeRatio_ );
0239    newmeEEShapeRatio_;
0240    newmeEEShapeRatio_->SetLineColor(scolor);
0241 
0242    TProfile * newmeESShape_;
0243    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Preshower shape digi;1", newmeESShape_);
0244    newmeESShape_;
0245    newmeESShape_->SetLineColor(scolor);
0246 
0247    TH1 * newmeESShapeRatio_;
0248    sfile->GetObject("DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Preshower shape digi ratio;1",  newmeESShapeRatio_ );
0249    newmeESShapeRatio_;
0250    newmeESShapeRatio_->SetLineColor(scolor);
0251 
0252    Ecal->cd(1);
0253    if ( meEBShape_ && newmeEBShape_ ) {
0254      meEBShape_->Draw();
0255      newmeEBShape_->Draw("same");
0256      myPV->PVCompute(meEBShape_ , newmeEBShape_ , te );
0257    }
0258    Ecal->cd(2);
0259    if ( meEBShapeRatio_ && newmeEBShapeRatio_ ) {
0260      meEBShapeRatio_->Draw();
0261      newmeEBShapeRatio_->Draw("same");
0262      myPV->PVCompute(meEBShapeRatio_ , newmeEBShapeRatio_ , te );
0263    }
0264    Ecal->cd(3);
0265    if ( meEEShape_ && newmeEEShape_ ) {
0266      meEEShape_->Draw();
0267      newmeEEShape_->Draw("same");
0268      myPV->PVCompute(meEEShape_ , newmeEEShape_ , te );
0269    }
0270    Ecal->cd(4);
0271    if ( meEEShapeRatio_ && newmeEEShapeRatio_ ) {
0272      meEEShapeRatio_->Draw();
0273      newmeEEShapeRatio_->Draw("same");
0274      myPV->PVCompute(meEEShapeRatio_ , newmeEEShapeRatio_ , te );
0275    }
0276    Ecal->cd(5);
0277    if ( meESShape_ && newmeESShape_ ) {
0278      meESShape_->Draw();
0279      newmeESShape_->Draw("same");
0280      myPV->PVCompute(meESShape_ , newmeESShape_ , te );
0281    }
0282    Ecal->cd(6);
0283    if ( meESShapeRatio_ && newmeESShapeRatio_ ) {
0284      meESShapeRatio_->Draw();
0285      newmeESShapeRatio_->Draw("same");
0286      myPV->PVCompute(meESShapeRatio_ , newmeESShapeRatio_ , te );
0287    }
0288    Ecal->Print("MixingModule_shape_and_ratio_compare.eps");
0289 
0290  }
0291 
0292  // Bunch by bunch shapes
0293 
0294  if (1) {
0295    TCanvas * Ecal = new TCanvas("Ecal","Ecal",800,1000);
0296    Ecal->Divide(3,7);
0297 
0298    TProfile * meEBBunchShape_[21];
0299    TProfile * newmeEBBunchShape_[21];
0300    for ( Int_t  i=0 ; i<21; i++ ) {
0301      sprintf (histo, "DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Barrel shape bunch crossing %02d;1", i-10 );
0302      rfile->GetObject(histo,meEBBunchShape_[i]);
0303      meEBBunchShape_[i];
0304      meEBBunchShape_[i]->SetLineColor(rcolor);
0305      sfile->GetObject(histo,newmeEBBunchShape_[i]);
0306      newmeEBBunchShape_[i];
0307      newmeEBBunchShape_[i]->SetLineColor(scolor);
0308    }
0309    for ( Int_t  i=0 ; i<21; i++ ) {
0310      Ecal->cd(i+1);
0311      if ( meEBBunchShape_[i] && newmeEBBunchShape_[i] ) {
0312        meEBBunchShape_[i]->Draw();
0313        newmeEBBunchShape_[i]->Draw("same");
0314        myPV->PVCompute(meEBBunchShape_[i] , newmeEBBunchShape_[i] , te );
0315      }
0316    }
0317    Ecal->Print("Barrel_bunch_by_bunch_shapes_compare.eps");
0318   
0319  }
0320 
0321  if (1) {
0322    TCanvas * Ecal = new TCanvas("Ecal","Ecal",800,1000);
0323    Ecal->Divide(3,7);
0324 
0325    TProfile * meEEBunchShape_[21];
0326    TProfile * newmeEEBunchShape_[21];
0327    for ( Int_t  i=0 ; i<21; i++ ) {
0328      sprintf (histo, "DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Endcap shape bunch crossing %02d;1", i-10 );
0329      rfile->GetObject(histo,meEEBunchShape_[i]);
0330      meEEBunchShape_[i];
0331      meEEBunchShape_[i]->SetLineColor(rcolor);
0332      sfile->GetObject(histo,newmeEEBunchShape_[i]);
0333      newmeEEBunchShape_[i];
0334      newmeEEBunchShape_[i]->SetLineColor(scolor);
0335    }
0336    for ( Int_t  i=0 ; i<21; i++ ) {
0337      Ecal->cd(i+1);
0338      if ( meEEBunchShape_[i] && newmeEEBunchShape_[i] ) {
0339        meEEBunchShape_[i]->Draw();
0340        newmeEEBunchShape_[i]->Draw("same");
0341        myPV->PVCompute(meEEBunchShape_[i] , newmeEEBunchShape_[i] , te );
0342      }
0343    }
0344    Ecal->Print("Endcap_bunch_by_bunch_shapes_compare.eps");
0345   
0346  }
0347 
0348  if (1) {
0349    TCanvas * Ecal = new TCanvas("Ecal","Ecal",800,1000);
0350    Ecal->Divide(3,7);
0351 
0352    TProfile * meESBunchShape_[21];
0353    TProfile * newmeESBunchShape_[21];
0354    for ( Int_t  i=0 ; i<21; i++ ) {
0355      sprintf (histo, "DQMData/EcalDigisV/EcalDigiTask/EcalDigiTask Preshower shape bunch crossing %02d;1", i-10 );
0356      rfile->GetObject(histo,meESBunchShape_[i]);
0357      meESBunchShape_[i];
0358      meESBunchShape_[i]->SetLineColor(rcolor);
0359      sfile->GetObject(histo,newmeESBunchShape_[i]);
0360      newmeESBunchShape_[i];
0361      newmeESBunchShape_[i]->SetLineColor(scolor);
0362    }
0363    for ( Int_t  i=0 ; i<21; i++ ) {
0364      Ecal->cd(i+1);
0365      if ( meESBunchShape_[i] && newmeESBunchShape_[i] ) {
0366        meESBunchShape_[i]->Draw();
0367        newmeESBunchShape_[i]->Draw("same");
0368        myPV->PVCompute(meESBunchShape_[i] , newmeESBunchShape_[i] , te );
0369      }
0370    }
0371    Ecal->Print("Preshower_bunch_by_bunch_shapes_compare.eps");
0372   
0373  }
0374 
0375   
0376 }
0377