Exemplo n.º 1
0
void DumpPlots_Digis(){
gStyle->SetOptStat(0);
//gStyle->SetOptTitle(0);

  TCanvas *c1 = new TCanvas("c1", "c1", 600, 600);
  c1->Range(0, 0, 1, 1);
  c1->SetFillColor(0);
  c1->SetBorderMode(0);
  c1->SetBorderSize(2);
  c1->SetFrameBorderMode(0);


char filename[200], dirname[200], histname[200];
int run = 1;
int adcs= 2;
const int layers = 4;
const int sensorsize = 128;
const int Sensor_Iu = 0;
const int Sensor_Iv = 0;

HGCalTBTopology IsCellValid;
TFile *F;

for(int iii=1; iii<=run; iii++){
	for(int kkk=1; kkk<= layers; kkk++){   
		
		for(int jjj=0;jjj<adcs;jjj++){
			sprintf(filename,"test_DigiAndRechitPlotter_TB_Run%i.root",iii);
			F = TFile::Open(filename);
			F->cd("hgcaltbdigisplotter");

			sprintf(histname,"FullLayer_ADC%i_Layer%i",jjj,kkk);
			TH2Poly* Overview_Digis_Layer  = (TH2Poly*) F->FindObjectAny(histname);
                        Overview_Digis_Layer->Scale(1./512,"");
			Overview_Digis_Layer->GetYaxis()->SetTitle("Y[cm]");
			Overview_Digis_Layer->GetYaxis()->CenterTitle(1);
                        Overview_Digis_Layer->Draw("colztext");
			ReverseXAxis(Overview_Digis_Layer);
                	sprintf(dirname,"/home/rchatter/shervinTest/CMSSW_7_6_3_patch2/src/HGCal/Digis/Run%i/FullLayer_Digis_ADC%i_Layer%i.png",iii,jjj,kkk);
                        c1->SaveAs(dirname);
 
                        sprintf(histname,"FullLayer_ADC%i_Layer%i_summed",jjj,kkk);
			TH1F* Overview_Digis_Layer_Summed  = (TH1F*) F->FindObjectAny(histname);
                        Overview_Digis_Layer_Summed->Draw();
                        sprintf(dirname,"/home/rchatter/shervinTest/CMSSW_7_6_3_patch2/src/HGCal/Digis/Run%i/FullLayer_Digis_ADC%i_Layer%i_Summed.png",iii,jjj,kkk);
                        c1->SaveAs(dirname);
                        sprintf(histname,"FullLayer_ADC%i_Layer%i_profile",jjj,kkk);
                        TProfile* Overview_Digis_Layer_Profile  = (TProfile*) F->FindObjectAny(histname);
                        Overview_Digis_Layer_Profile->Draw();
                        sprintf(dirname,"/home/rchatter/shervinTest/CMSSW_7_6_3_patch2/src/HGCal/Digis/Run%i/FullLayer_Digis_ADC%i_Layer%i_Profile.png",iii,jjj,kkk);
                        c1->SaveAs(dirname);  
	            }// loop over adcs ends here

		for(int iv = -7; iv < 8; iv++){
			for(int iu = -7; iu < 8; iu++){
				for(int jjj=0;jjj<adcs;jjj++){
					if(!IsCellValid.iu_iv_valid(layers, Sensor_Iu, Sensor_Iv, iu, iv, sensorsize)) continue;
					sprintf(histname,"Cell_u_%i_v_%i_ADC%i_Layer%i",iu,iv,jjj,kkk);
					TH1F* Cell_Hist_U_V  = (TH1F*) F->FindObjectAny(histname);
					sprintf(dirname,"/home/rchatter/shervinTest/CMSSW_7_6_3_patch2/src/HGCal/Digis/Run%i/Detailed/Cell_u_%i_v_%i_ADC%i_Layer_%i.png",iii,iu,iv,jjj,kkk);
					Cell_Hist_U_V->Draw();
					c1->SaveAs(dirname);
                                    } 
                            }//loop over iu ends here
                   }//loop over iv ends here

	}//loop over layer ends here
   }//loop over run ends her

}
Exemplo n.º 2
0
void DrawEff_DS(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
//bool isweight=kFALSE;
bool isweight=kTRUE;
bool isHF=kTRUE;
//bool isHF=kFALSE;
if(isweight)
TString dir="weight";
else
TString dir="noweight";
const int Nhist=4;	const int NGen=1; const int Ncent=6;
//const double HFbin[]={0,0.1,0.2,0.4,0.6,0.8,1,2,4,6,9,12,15,20,30,50,75,100};
const double xerr[Ncent]={0,0,0,0,0,0};
/*
const double HFbin_cent[Nhist][Ncent+1]={
{0,2.92,10.1,19.3,23.7,30.2,100},
{0,1.03,5.00,11.6,15.0,20.3,100},
{0,2.7,12.6,28.6,36.9,49.6,100}};
*/
const double HFbin_cent[Nhist][Ncent+1]={
{0,2.725,10.065,19.565,23.975,30.455,100},
{0,0.975,5.005,11.775,15.285,20.725,100},
{0,2.515,12.465,28.855,37.235,50.085,100}};
const double cent[Ncent]={95,75,45,25,15,5};
const int nHFbin=sizeof(HFbin)/sizeof(double)-1;
//double color[NGen][Nhist]={{2,1,4},{2,1,4}};
//double Style[NGen][Nhist]={{20,24,28},{20,24,28}};
double color[NGen][Nhist]={{2,1,4}};
double Style[NGen][Nhist]={{20,24,28}};
//TString Gen[NGen]={"Hijing","Epos"};
TString Gen[NGen]={"Hijing"};
TString histoname[Nhist]={"HFEnergy4","HFEnergyPlus4","HFEnergyPlus","Ntrk"};
TString etarange[Nhist]={" HF E_{T} |#eta|>4"," HF E_{T} #eta>4"," HF E_{T} #eta>0",""};
TString filename[NGen];
TFile* f[NGen];
TH1F* h_or[NGen][Nhist];	TH1F* reh_or[NGen][Nhist];
TH1F* h_tr[NGen][Nhist];	TH1F* reh_tr[NGen][Nhist];
TH1F* h_ds[NGen][Nhist];	TH1F* reh_ds[NGen][Nhist];
TH1F* h_eff[NGen][Nhist];	TH1F* reh_eff[NGen][Nhist];

TLatex* T1[Nhist];	TLatex* T2;	TLatex* T3[NGen];
TF1 *fitEff[NGen][Nhist];
//TGraphAsymmErrors *gEff[NGen][Nhist];
TGraph *gEff[NGen][Nhist];
c1 = new TCanvas("c1"," ",800,500);
c2 = new TCanvas("c2"," ",800,700);
makeMultiPanelCanvas(c1,NGen,1,0.03,0.03,0.14,0.14,0.03);
makeMultiPanelCanvas(c2,1,1,0.03,0.03,0.03,0.03,0.03);

//for |eta|>4 HFEnergy:
/*
for(int k=0;k<NGen;k++)
for(int j=0;j<Nhist;j++)
fitEff[k][j]= new TF1(Form("fitEff_%s%s",Gen[k].Data(),histoname[j]),"[0]-[1]*exp([2]*x)-[3]*exp(-[4]*x)",0,300);

fitEff[0][0]->SetParameters(0.999876,0.44648,-1.78911,0.242036,0.549932);
fitEff[0][1]->SetParameters(1.,0.367894,-3.36629,0.104605,0.690272);
fitEff[0][2]->SetParameters(0.99981,0.697501,-2.59569,0.15323,0.411757);
fitEff[1][0]->SetParameters(0.999918,0.691843,-0.785042,0.0352768,0.449521);
fitEff[1][1]->SetParameters(0.999929,0.284,-2.25636,0.264114,0.951221);
fitEff[1][2]->SetParameters(0.999887,0.5,-2.39395,0.373215,0.550851);
*/

for(int k=0;k<NGen;k++){
T3[k]=new TLatex(0.45,0.93,Gen[k]);
T3[k]->SetNDC();
T3[k]->SetTextAlign(12);
T3[k]->SetTextSize(0.05);
T3[k]->SetTextColor(1);
T3[k]->SetTextFont(42);
}
for(int j=0;j<Nhist;j++){
T1[j]=new TLatex(0.4,0.85,etarange[j]);
T1[j]->SetNDC();
T1[j]->SetTextAlign(12);
T1[j]->SetTextSize(0.05);
T1[j]->SetTextColor(1);
T1[j]->SetTextFont(42);
}
T2=new TLatex(0.2,0.25,"Double Side");
T2->SetNDC();
T2->SetTextAlign(12);
T2->SetTextSize(0.06);
T2->SetTextColor(1);
T2->SetTextFont(42);
j=3;
for(int k=0;k<NGen;k++){
//for(int j=0;j<Nhist;j++){
filename[k]=Form("output/%s/pPbHist_%s_DS",dir.Data(),Gen[k].Data());
f[k]=TFile::Open(Form("%s.root",filename[k].Data()));
h_or[k][j]=(TH1F*)f[k]->Get(Form("h%s",histoname[j].Data()));
h_tr[k][j]=(TH1F*)f[k]->Get(Form("h%s_tr",histoname[j].Data()));
h_ds[k][j]=(TH1F*)f[k]->Get(Form("h%s_DS",histoname[j].Data()));
h_eff[k][j]=(TH1F*)f[k]->Get(Form("hEff_%s",histoname[j].Data()));
fixedFontHist(h_or[k][j],1.8,2);
fixedFontHist(h_tr[k][j],1.8,2);
fixedFontHist(h_ds[k][j],1.8,2);
//reh_or[k][j]=(TH1F*)h_or[k][j]->Clone(Form("re%s%s",Gen[k].Data(),histoname[j].Data()));
//reh_tr[k][j]=(TH1F*)h_tr[k][j]->Clone(Form("re%s%s_tr",Gen[k].Data(),histoname[j].Data()));
//reh_ds[k][j]=(TH1F*)h_ds[k][j]->Clone(Form("re%s%s_ds",Gen[k].Data(),histoname[j].Data()));

//reh_or[k][j]=(TH1F*)h_or[k][j]->Rebin(Ncent,Form("re%s%s",Gen[k].Data(),histoname[j].Data()),HFbin_cent[j]);
//reh_tr[k][j]=(TH1F*)h_tr[k][j]->Rebin(Ncent,Form("re%s%s_tr",Gen[k].Data(),histoname[j].Data()),HFbin_cent[j]);
//reh_ds[k][j]=(TH1F*)h_ds[k][j]->Rebin(Ncent,Form("re%s%s_ds",Gen[k].Data(),histoname[j].Data()),HFbin_cent[j]);
reh_or[k][j]=(TH1F*)h_or[k][j]->Rebin(nHFbin,Form("re%s%s",Gen[k].Data(),histoname[j].Data()),HFbin);
reh_tr[k][j]=(TH1F*)h_tr[k][j]->Rebin(nHFbin,Form("re%s%s_tr",Gen[k].Data(),histoname[j].Data()),HFbin);
reh_ds[k][j]=(TH1F*)h_ds[k][j]->Rebin(nHFbin,Form("re%s%s_ds",Gen[k].Data(),histoname[j].Data()),HFbin);
//normalizeByBinWidth(reh_or[k][j]);
//normalizeByBinWidth(reh_tr[k][j]);
//normalizeByBinWidth(reh_ds[k][j]);

//gEff[k][j]=new TGraphAsymmErrors();
gEff[k][j]=new TGraph(h_eff[k][j]);
gEff[k][j]->SetPoint(0,0,1);
gEff[k][j]->SetName(Form("gEff_%s%s",Gen[k].Data(),histoname[j].Data()));
//gEff[k][j]->BayesDivide(reh_tr[k][j],reh_ds[k][j]);
gEff[k][j]->SetMarkerColor(color[k][j]);
gEff[k][j]->SetLineColor(color[k][j]);
gEff[k][j]->SetMarkerStyle(Style[k][j]);
gEff[k][j]->SetMarkerSize(1.2);
gEff[k][j]->GetXaxis()->SetLimits(0.01,99.9);
gEff[k][j]->SetTitle("");
//}
}

TH1D * hFrame = new TH1D("","",100,0,100.);
if(!isHF){
   hFrame->GetXaxis()->SetLabelOffset(999);
   hFrame->GetXaxis()->SetTickLength(0);}
   hFrame->GetYaxis()->SetTitle("Event Selection Efficiency");
	hFrame->SetMaximum(1.09);
	hFrame->SetMinimum(0);
if(isHF)
hFrame->GetXaxis()->SetTitle("HF E_{T} (GeV/c)");
if(j==3)
hFrame->GetXaxis()->SetTitle("track Mult");
   hFrame->GetYaxis()->SetTitleSize(0.05);
        fixedFontHist(hFrame);
  hFrame->GetYaxis()->SetTitleOffset(1.5);

for(k=0;k<NGen;k++){
if(isHF)
c1->cd(k+1)->SetLogx();
else
c1->cd(k+1);
TLegend *leg=new TLegend(0.60,0.2,0.75,0.4);
if(k!=0){
hFrame->GetYaxis()->SetTitle("");
hFrame->GetYaxis()->SetLabelSize(0);
}
hFrame->DrawCopy();
//for(j=0;j<Nhist;j++){
if(isHF)
gEff[k][j]->Draw("Psame");
else{
ReverseXAxis(gEff[k][j],0.05);
ReverseXGraph(gEff[k][j]);
}
//fitEff[k][j]->SetLineStyle(color[k][j]);
//fitEff[k][j]->SetLineColor(color[k][j]);
//fitEff[k][j]->Draw("same");
leg->AddEntry(gEff[k][j],etarange[j],"lp");
//}
leg->SetTextSize(0.05);
leg->SetBorderSize(0);
leg->SetFillColor(0);
TLine *l=new TLine(0,1,100,1);
l->SetLineStyle(2);

l->Draw("same");
leg->Draw("same");
T3[k]->Draw("same");
}
if(isHF)
c1->Print(Form("pic/OwnBinning/pPbHist_%s_DS_HF.png",dir.Data()));
else
c1->Print(Form("pic/OwnBinning/pPbHist_%s_DS_cent.png",dir.Data()));


//------------------------------------------------------------------------------------------

if(isHF)
//c2->cd()->SetLogx();
//else
c2->cd();
TLegend *leg=new TLegend(0.7,0.2,0.85,0.4);
hFrame->GetYaxis()->SetTitle("Event Selection Efficiency");
hFrame->GetYaxis()->SetLabelSize(18);
hFrame->GetYaxis()->SetTitleOffset(1);
hFrame->DrawCopy();
for(k=0;k<NGen;k++){
if(k==0){
gEff[k][j]->SetMarkerColor(1);
gEff[k][j]->SetLineColor(1);
gEff[k][j]->SetMarkerStyle(20);
gEff[k][j]->SetMarkerSize(1.6);
}
else{
gEff[k][j]->SetMarkerColor(2);
gEff[k][j]->SetLineColor(2);
gEff[k][j]->SetMarkerStyle(24);
gEff[k][j]->SetMarkerSize(1.6);
}
if(isHF)
gEff[k][j]->Draw("Psame");
else{
ReverseXAxis(gEff[k][j],0.05);
ReverseXGraph(gEff[k][j]);
}
leg->SetTextSize(0.05);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->AddEntry(gEff[k][j],Gen[k],"p");
TLine *l=new TLine(0,1,100,1);
l->SetLineStyle(2);
}
T1[j]->Draw("same");
leg->Draw("same");
l->Draw("same");

if(isHF)
c2->Print(Form("pic/OwnBinning/pPbHist_%s_DS_%s_HF.png",dir.Data(),histoname[j].Data()));
else
c2->Print(Form("pic/OwnBinning/pPbHist_%s_DS_%s_cent.png",dir.Data(),histoname[j].Data()));

}
Exemplo n.º 3
0
void DumpPlotsReco(TString inputFileName, TString outputFolder, Int_t runNumber, Int_t nSpills) {

  std::cout << "DumpPlotsReco called for inputFileName: " << inputFileName << ", outputFolder: " << outputFolder << ", runNumber: " << runNumber << ", nSpills: " << nSpills << std::endl;

  gStyle->SetOptStat(0);
  //gStyle->SetOptTitle(0);

  TCanvas *plotCanvas = new TCanvas("plotCanvas", "plotCanvas", 600, 600);
  plotCanvas->Range(0, 0, 1, 1);
  plotCanvas->SetFillColor(0);
  plotCanvas->SetBorderMode(0);
  plotCanvas->SetBorderSize(2);
  plotCanvas->SetFrameBorderMode(0);

  const int nLayers = 8;
  int nSkirocs = nLayers*2;
  // const int nChannels = 64;

  int nEvents = nSpills*EVENTSPERSPILL*nLayers;

  TFile *inputFile = TFile::Open(inputFileName);
  inputFile->cd("hgcaltbrechitsplotter_highgain_correlation_cm");
  TString outputPlotFullPath, plotName;

  plotName = Form("Noise_2D_Profile_Layer");
  TH2F* h_Noise_2D_Profile_Layer  = (TH2F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_Noise_2D_Profile_Layer)) {
    h_Noise_2D_Profile_Layer->Draw("colz");
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_Noise_2D_Profile_Layer;

  plotName = Form("AllCells_Ped");
  TH1F* h_AllCells_Ped  = (TH1F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_AllCells_Ped)) {
    h_AllCells_Ped->Draw();
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_AllCells_Ped;

  plotName = Form("AllCells_CM");
  TH1F* h_AllCells_CM  = (TH1F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_AllCells_CM)) {
    h_AllCells_CM->Draw();
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_AllCells_CM;

  for(int layerCounter=0; layerCounter < nLayers; ++layerCounter){
    plotName = Form("Full_Cell_Layer_%d", layerCounter);
    TH1F* h_Full_Cell  = (TH1F*) inputFile->FindObjectAny(plotName);
    if (not(NULL == h_Full_Cell)) {
      h_Full_Cell->Draw();
      outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
      plotCanvas->SaveAs(outputPlotFullPath);
    }
    delete h_Full_Cell;

    plotName = Form("Half_Cell_Layer_%d", layerCounter);
    TH1F* h_Half_Cell  = (TH1F*) inputFile->FindObjectAny(plotName);
    if (not(NULL == h_Half_Cell)) {
      h_Half_Cell->Draw();
      outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
      plotCanvas->SaveAs(outputPlotFullPath);
    }
    delete h_Half_Cell;

    plotName = Form("MB_Cell_Layer_%d", layerCounter);
    TH1F* h_MB_Cell  = (TH1F*) inputFile->FindObjectAny(plotName);
    if (not(NULL == h_MB_Cell)) {
      h_MB_Cell->Draw();
      outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
      plotCanvas->SaveAs(outputPlotFullPath);
    }
    delete h_MB_Cell;

    plotName = Form("Calib_Pads_Layer_%d", layerCounter);
    TH1F* h_Calib_Pads  = (TH1F*) inputFile->FindObjectAny(plotName);
    if (not(NULL == h_Calib_Pads)) {
      h_Calib_Pads->Draw();
      outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
      plotCanvas->SaveAs(outputPlotFullPath);
    }
    delete h_Calib_Pads;

    plotName = Form("Merged_Cell_Layer_%d", layerCounter);
    TH1F* h_Merged_Cell  = (TH1F*) inputFile->FindObjectAny(plotName);
    if (not(NULL == h_Merged_Cell)) {
      h_Merged_Cell->Draw();
      outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
      plotCanvas->SaveAs(outputPlotFullPath);
    }
    delete h_Merged_Cell;

    // for (int skirocCounter = 1; skirocCounter <= nSkirocs; ++skirocCounter) {
    //   for (int channelCounter = 0; channelCounter <= nChannels; ++channelCounter) {
    //     plotName = Form("Ski_%d_Channel_%d_Layer_%d", skirocCounter, channelCounter, layerCounter);
    //     TH1F* h_Ski  = (TH1F*) inputFile->FindObjectAny(plotName);
    //     if (not(NULL == h_Ski)) {
    //       h_Ski->Draw();
    //       outputPlotFullPath = (outputFolder + Form("/Detailed/")) + plotName + Form("_%06d.png", runNumber);
    //       plotCanvas->SaveAs(outputPlotFullPath);
    //     }
    //     delete h_Ski;
    //   } // ends loop over channels
    // } // ends loop over skirocs

  } //loop over layers ends here

  inputFile->cd("hgcaltbrechitsplotter_highgain_new");

  plotName = Form("Covar_hist");
  TH2F* h_Covar_hist  = (TH2F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_Covar_hist)) {
    h_Covar_hist->Draw("colz");
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_Covar_hist;

  plotName = Form("Correl_hist");
  TH2F* h_Correl_hist  = (TH2F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_Correl_hist)) {
    h_Correl_hist->Draw("colz");
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_Correl_hist;

  plotName = Form("DiffIJ_hist");
  TH2F* h_DiffIJ_hist  = (TH2F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_DiffIJ_hist)) {
    h_DiffIJ_hist->Draw("colz");
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_DiffIJ_hist;

  plotName = Form("CG_X");
  TH1F* h_CG_X  = (TH1F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_CG_X)) {
    h_CG_X->Draw();
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_CG_X;

  plotName = Form("CG_Y");
  TH1F* h_CG_Y  = (TH1F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_CG_Y)) {
    h_CG_Y->Draw();
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_CG_Y;

  // plotName = Form("AllCells_Ped");
  // TH1F* h_AllCells_Ped  = (TH1F*) inputFile->FindObjectAny(plotName);
  // if (not(NULL == h_AllCells_Ped)) {
  //   h_AllCells_Ped->Draw();
  //   outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
  //   plotCanvas->SaveAs(outputPlotFullPath);
  // }
  // delete h_AllCells_Ped;

  // plotName = Form("AllCells_CM");
  // TH1F* h_AllCells_CM  = (TH1F*) inputFile->FindObjectAny(plotName);
  // if (not(NULL == h_AllCells_CM)) {
  //   h_AllCells_CM->Draw();
  //   outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
  //   plotCanvas->SaveAs(outputPlotFullPath);
  // }
  // delete h_AllCells_CM;

  plotName = Form("Sum_Cluster_ADC");
  TH1F* h_Sum_Cluster_ADC  = (TH1F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_Sum_Cluster_ADC)) {
    h_Sum_Cluster_ADC->Draw();
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_Sum_Cluster_ADC;

  plotName = Form("Sum_Cluster_Max");
  TH1F* h_Sum_Cluster_Max  = (TH1F*) inputFile->FindObjectAny(plotName);
  if (not(NULL == h_Sum_Cluster_Max)) {
    h_Sum_Cluster_Max->Draw();
    outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    plotCanvas->SaveAs(outputPlotFullPath);
  }
  delete h_Sum_Cluster_Max;

  for(int layerCounter=1; layerCounter <= nLayers; ++layerCounter){
    plotName = Form("FullLayer_RecHits_Layer%d_Summed", layerCounter);
    TH1F* h_FullLayer_RecHits  = (TH1F*) inputFile->FindObjectAny(plotName);
    if (not(NULL == h_FullLayer_RecHits)) {
      h_FullLayer_RecHits->Draw();
      outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
      plotCanvas->SaveAs(outputPlotFullPath);
    }
    delete h_FullLayer_RecHits;
  } //loop over layers ends here

  for (int eventCenturyCounter = 0; eventCenturyCounter < int(nEvents/100); ++eventCenturyCounter) {
    int eventNumber = eventCenturyCounter*100;
    int layerNumber = 1+((int(eventNumber/EVENTSPERSPILL))%nLayers);
    plotName = Form("FullLayer_ADC0_Layer%d_Event%d", layerNumber, eventNumber);
    TH2Poly* h_EventDisplay  = (TH2Poly*) inputFile->FindObjectAny(plotName);
    if (not(NULL == h_EventDisplay)) {
      h_EventDisplay->GetYaxis()->SetTitle("Y[cm]");
      h_EventDisplay->GetYaxis()->CenterTitle(1);
      h_EventDisplay->Draw("colztext");
      ReverseXAxis(h_EventDisplay);
      eventNumber = EVENTSPERSPILL*int(eventNumber/(EVENTSPERSPILL*nLayers)) + eventNumber%EVENTSPERSPILL;
      plotName = Form("EventDisplay_Event%d_Layer%d", eventNumber, layerNumber);
      outputPlotFullPath = (outputFolder + Form("/Detailed/")) + plotName + Form("_%06d.png", runNumber);
      plotCanvas->SaveAs(outputPlotFullPath);
    }
    delete h_EventDisplay;
  } // loop over events ends here
  
  delete inputFile;

  delete plotCanvas;
  //   }//loop over spill ends here
  // }//loop over run ends here

  // OLD:

  // char filename[50], dirname[100], histname[50];
  // int run = 2;
  // int spill = 3;

  // for(int iii=0; iii<=run; iii++){
  //   for(int jjj=1; jjj<=spill;jjj++){   
  // if(iii != 0) sprintf(filename,"test_DigiAndRechitPlotter_TB_Run%i_Spill%i.root",iii,jjj);
  // else sprintf(filename,"test_DigiAndRechitPlotter_TB_Cumulative.root");

  // const int sensorsize = 128;
  // const int Sensor_Iu = 0;
  // const int Sensor_Iv = 0;

  // HGCalTBTopology IsCellValid;
  // plotName = Form("FullLayer_RecHits_Layer%i",layerCounter);
    // // sprintf(histname,"FullLayer_RecHits_Layer%i",layerCounter);
    // TH2Poly* Overview_Rechits_Layer  = (TH2Poly*) inputFile->FindObjectAny(plotName);
    // Overview_Rechits_Layer->GetYaxis()->SetTitle("Y[cm]");
    // Overview_Rechits_Layer->GetYaxis()->CenterTitle(1);
    // Overview_Rechits_Layer->Draw("colztext");
    // ReverseXAxis(Overview_Rechits_Layer);
    // // if(iii != 0) sprintf(dirname,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Run%i/Spill%i/Overview/FullLayer_RecHits_Layer%i.png",iii,jjj,layerCounter);
    // // else sprintf(dirname,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Cumulative/Overview/FullLayer_RecHits_Layer%i.png",layerCounter);
    // outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    // plotCanvas->SaveAs(outputPlotFullPath);
    // delete Overview_Rechits_Layer;

    // plotName = Form("FullLayer_Occupancy_Layer%i", layerCounter);
    // TH2Poly* Overview_Occupancy_Layer  = (TH2Poly*) inputFile->FindObjectAny(plotName);
    // Overview_Occupancy_Layer->GetYaxis()->SetTitle("Y[cm]");
    // Overview_Occupancy_Layer->GetYaxis()->CenterTitle(1);
    // Overview_Occupancy_Layer->Draw("colztext");
    // ReverseXAxis(Overview_Occupancy_Layer);
    // // if(iii != 0) sprintf(dirname,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Run%i/Spill%i/Overview/FullLayer_Occupancy_Layer%i.png",iii,jjj,layerCounter);
    // // else sprintf(dirname,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Cumulative/Overview/FullLayer_Occupancy_Layer%i.png",layerCounter);
    // outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    // plotCanvas->SaveAs(outputPlotFullPath);
    // delete Overview_Occupancy_Layer;
    
    // // plotName = Form("FullLayer_RecHits_Layer%i_Summed",layerCounter);
    // // TH1F* Overview_Rechits_Layer_Summed  = (TH1F*) inputFile->FindObjectAny(plotName);
    // // Overview_Rechits_Layer_Summed->Draw();
    // // // if(iii != 0) sprintf(outputPlotFullPath,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Run%i/Spill%i/Overview/FullLayer_RecHits_Layer%i_Summed.png",iii,jjj,layerCounter);
    // // // else sprintf(outputPlotFullPath,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Cumulative/Overview/FullLayer_RecHits_Layer%i_Summed.png",layerCounter);
    // // outputPlotFullPath = (outputFolder + Form("/")) + plotName + Form("_%06d.png", runNumber);
    // // plotCanvas->SaveAs(outputPlotFullPath);
    // // delete Overview_Rechits_Layer_Summed;
    
    // // // for(int iv = -7; iv < 8; iv++){
    // // //   for(int iu = -7; iu < 8; iu++){
    // // //     if(!IsCellValid.iu_iv_valid(nLayers, Sensor_Iu, Sensor_Iv, iu, iv, sensorsize)) continue;
    // // //     plotName = Form("Cell_RecHits_u_%i_v_%i_Layer%i",iu,iv,layerCounter);
    // // //     TH1F* Cell_Hist_U_V  = (TH1F*) inputFile->FindObjectAny(plotName);
    // // //     // if(iii != 0) sprintf(outputPlotFullPath,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Run%i/Spill%i/Detailed/Cell_RecHits_u_%i_v_%i_Layer_%i.png",iii,jjj,iu,iv,layerCounter);
    // // //     // else sprintf(outputPlotFullPath,"/afs/cern.ch/work/r/rchatter/CMSSW_7_6_3_patch2/src/HGCal/DQM_Plots/Cumulative/Detailed/Cell_RecHits_u_%i_v_%i_Layer_%i.png",iu,iv,layerCounter);
    // // //     outputPlotFullPath = (outputFolder + Form("/Detailed/")) + plotName + Form("_%06d.png", runNumber);
    // // //     Cell_Hist_U_V->Draw();
    // // //     plotCanvas->SaveAs(outputPlotFullPath);
    // // //     delete Cell_Hist_U_V;
    // // //   }//loop over iu ends here
    // // // }//loop over iv ends here
}