22 #include <Riostream.h>
32 #include "AliEMCALGeometry.h"
34 #include "AliAODEvent.h"
41 void Plot2DCells(
TString Block,
Int_t runNo, std::vector<Int_t> cellVectorMergeB, std::vector<Int_t> cellVectorMergeA);
59 Int_t cellColumn=0,cellRow=0;
60 Int_t cellColumnAbs=0,cellRowAbs=0;
64 cout<<
"...................................................."<<endl;
69 cout<<
"Cell Id provided: "<<inputCellID<<endl;
70 cout<<
"This corresponds to absolute row: "<<cellRowAbs<<
" and absolute collumn: "<<cellColumnAbs<<endl;
72 else if(inputRow!=-1 && inputCollumn!=-1 && inputSM!=-1)
74 cout<<
"Supermodule provided: "<<inputSM<<endl;
75 cout<<
"Absolute row provided: "<< inputRow<<
" and absolute collumn provided : "<<inputCollumn<<endl;
76 cellID=geom->GetAbsCellIdFromCellIndexes(inputSM,inputRow,inputCollumn);
77 cout<<
"This corresponds to Cell Id: "<<cellID<<endl;
79 else cout<<
"need more information!"<<endl;
81 cout<<
"...................................................."<<endl;
92 gROOT->ProcessLine(
"gErrorIgnoreLevel = kWarning;");
93 gStyle->SetOptStat(0);
94 gStyle->SetPadLeftMargin(0.13);
95 gStyle->SetPadRightMargin(0.1);
96 gStyle->SetPadBottomMargin(0.12);
97 gStyle->SetPadTopMargin(0.06);
99 Int_t noOfCells=17674;
100 Int_t nBadCellMerged =noOfCells;
101 Int_t nBadCellRbR =noOfCells;
102 Int_t array_StartCellSM_Value[21] ={0,1152,2304,3456,4608,5760,6912,8064,9216,10368,11520,11904,12288,13056,13824,14592,15360,16128,16896,17280,17664};
106 std::vector<Int_t> badcellsBlock1;
110 std::vector<Int_t> vOnlyMaskedInMergedA;
111 std::vector<Int_t> vOnlyMaskedInMergedB;
116 cout<<
"** Open file A with merged runlist analysis: "<<endl;
117 TString pathA = Form(
"./AnalysisOutput/%s/Train_%i/Version%i",period.Data(),trainNo,versionA);
118 TString rootFileNameA= Form(
"%s_INT7_Histograms_V%i.root",period.Data(),versionA);
119 TFile* outputRootA = TFile::Open(Form(
"%s/%s",pathA.Data(),rootFileNameA.Data()));
120 if(!outputRootA)cout<<
"File "<<outputRootA->GetName()<<
" does not exist"<<endl;
121 else cout<<
"file A: "<<outputRootA->GetName()<<endl;
124 TH2F* hCellAmplitudeA =(
TH2F*)outputRootA->Get(
"hCellAmplitude");
125 TH1F* hnEventsA =(TH1F*)outputRootA->Get(
"hNEvents");
126 hCellAmplitudeA->Scale(hnEventsA->GetBinContent(1));
127 TH2F* hCellAmplitudeBlockMaskA=(
TH2F*)hCellAmplitudeA->Clone(
"hCellAmplitudeMask");
128 TH1F* hCellFlagA =(TH1F*)outputRootA->Get(
"fhCellFlag");
134 cout<<
"**Open file B with merged runlist analysis: "<<endl;
135 TString pathB = Form(
"./AnalysisOutput/%s/Train_%i/Version%i",period.Data(),trainNo,versionB);
136 TString rootFileNameB= Form(
"%s_INT7_Histograms_V%i.root",period.Data(),versionB);
137 TFile* outputRootB = TFile::Open(Form(
"%s/%s",pathB.Data(),rootFileNameB.Data()));
138 if(!outputRootB)cout<<
"File "<<outputRootB->GetName()<<
" does not exist"<<endl;
139 else cout<<
"file B: "<<outputRootB->GetName()<<endl;
142 TH2F* hCellAmplitudeB =(
TH2F*)outputRootB->Get(
"hCellAmplitude");
143 TH1F* hnEventsB =(TH1F*)outputRootB->Get(
"hNEvents");
144 hCellAmplitudeB->Scale(hnEventsB->GetBinContent(1));
145 TH2F* hCellAmplitudeBlockMaskB=(
TH2F*)hCellAmplitudeB->Clone(
"hCellAmplitudeMask");
146 TH1F* hCellFlagB =(TH1F*)outputRootB->Get(
"fhCellFlag");
154 for(
Int_t ic = 0; ic < noOfCells; ic++)
163 for (
Int_t amp = 1; amp <= hCellAmplitudeBlockMaskA->GetNbinsX(); amp++)
165 if(hCellFlagA->GetBinContent(ic+1)>0 || maskA==1)
167 hCellAmplitudeBlockMaskA->SetBinContent(amp,ic+1,0);
168 if(amp==1)nBadCellMerged--;
179 for (
Int_t amp = 1; amp <= hCellAmplitudeBlockMaskB->GetNbinsX(); amp++)
181 if(hCellFlagB->GetBinContent(ic+1)>0 || maskB==1)
183 hCellAmplitudeBlockMaskB->SetBinContent(amp,ic+1,0);
184 if(amp==1)nBadCellRbR--;
193 if(hCellFlagA->GetBinContent(ic+1)>0 && hCellFlagB->GetBinContent(ic+1)==0)vOnlyMaskedInMergedA.push_back(ic);
194 if(hCellFlagA->GetBinContent(ic+1)==0 && hCellFlagB->GetBinContent(ic+1)>0) vOnlyMaskedInMergedB.push_back(ic);
198 TH1* projMaskedCellsA = hCellAmplitudeBlockMaskA->ProjectionX(
"MaskedCellsMergedBlockA");
199 TH1* projMaskedCellsB = hCellAmplitudeBlockMaskB->ProjectionX(
"MaskedCellsMergedBlockB");
204 TCanvas* C1 =
new TCanvas(
"-1-",
"Projections of A and B",900,900);
206 C1->cd(1)->SetLogy();
207 SetHisto(projMaskedCellsA,
"",
"hits/event",0);
208 projMaskedCellsA->DrawCopy(
"hist");
209 projMaskedCellsB->SetLineColor(8);
210 projMaskedCellsB->DrawCopy(
"same hist");
212 projMaskedCellsA->Divide(projMaskedCellsB);
213 SetHisto(projMaskedCellsA,
"",
"Merged Version A/Merged Version B",0);
214 projMaskedCellsA->DrawCopy(
"hist");
215 projMaskedCellsA->Multiply(projMaskedCellsB);
217 TLatex* textSM =
new TLatex(0.1,0.1,
"*test*");
218 textSM->SetTextSize(0.06);
219 textSM->SetTextColor(1);
222 TCanvas *c1_projSM =
new TCanvas(
"-1a-",
"Projections of A and B per SM",1200,900);
223 c1_projSM->Divide(5,4,0.001,0.001);
224 TH1* projEnergyMaskASM[20];
225 TH1* projEnergyMaskBSM[20];
226 for(
Int_t iSM=0;iSM<20;iSM++)
228 c1_projSM->cd(iSM+1)->SetLogy();
229 gPad->SetTopMargin(0.03);
230 gPad->SetBottomMargin(0.11);
231 projEnergyMaskASM[iSM] = hCellAmplitudeBlockMaskA->ProjectionX(Form(
"%sMask_ProjSM%i",hCellAmplitudeBlockMaskA->GetName(),iSM),array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1);
232 projEnergyMaskASM[iSM]->SetTitle(
"");
233 projEnergyMaskASM[iSM]->SetXTitle(Form(
"Cell Energy [GeV], SM%i",iSM));
234 projEnergyMaskASM[iSM]->GetYaxis()->SetTitleOffset(1.6);
235 projEnergyMaskASM[iSM]->GetYaxis()->SetLabelSize(0.06);
236 projEnergyMaskASM[iSM]->GetXaxis()->SetLabelSize(0.06);
237 projEnergyMaskASM[iSM]->GetXaxis()->SetRangeUser(0,20);
238 projEnergyMaskASM[iSM]->GetXaxis()->SetTitleSize(0.06);
239 projEnergyMaskASM[iSM]->SetLineColor(kGreen+1);
240 projEnergyMaskASM[iSM]->DrawCopy(
" hist");
242 projEnergyMaskBSM[iSM] = hCellAmplitudeBlockMaskB->ProjectionX(Form(
"%s_ProjSM%i",hCellAmplitudeBlockMaskB->GetName(),iSM),array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1);
243 projEnergyMaskBSM[iSM]->DrawCopy(
"same hist");
245 textSM->SetTitle(Form(
"Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
246 textSM->DrawLatex(0.2,0.8,Form(
"Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
248 TCanvas *c1_projSMR =
new TCanvas(
"-1b-",
"Ratio of A/B per SM",1200,900);
249 c1_projSMR->Divide(5,4,0.001,0.001);
250 TH1* projEnergyMaskSM[20];
251 TH1* projEnergySM[20];
252 for(
Int_t iSM=0;iSM<20;iSM++)
254 c1_projSMR->cd(iSM+1);
255 gPad->SetTopMargin(0.03);
256 gPad->SetBottomMargin(0.11);
257 projEnergyMaskASM[iSM]->Divide(projEnergyMaskBSM[iSM]);
258 projEnergyMaskASM[iSM]->SetLineColor(kGray+1);
259 projEnergyMaskASM[iSM]->DrawCopy(
" hist");
261 textSM->SetTitle(Form(
"Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
262 textSM->DrawLatex(0.2,0.8,Form(
"Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
265 TCanvas* C3 =
new TCanvas(
"-3-",
"2D of A and B",900,900);
267 C3->cd(1)->SetLogz();
268 SetHisto(hCellAmplitudeBlockMaskA,
"",
"cell ID",0);
269 hCellAmplitudeBlockMaskA->DrawCopy(
"colz");
270 C3->cd(2)->SetLogz();
271 SetHisto(hCellAmplitudeBlockMaskB,
"",
"cell ID",0);
272 hCellAmplitudeBlockMaskB->DrawCopy(
"colz");
278 projMaskedCellsA->Scale(1.0/nBadCellMerged);
279 projMaskedCellsB->Scale(1.0/nBadCellRbR);
282 cout<<
" Cells masked in version A and not in version B ("<<vOnlyMaskedInMergedA.size()<<
"):"<<endl;
283 for(
Int_t i=0; i<(
Int_t)vOnlyMaskedInMergedA.size();i++)
285 cout<<vOnlyMaskedInMergedA.at(i)<<
","<<flush;
288 TString outNameA = Form(
"./AnalysisOutput/%s/Train_%i/cOnlyMergedBlockA.pdf",period.Data(),trainNo);
289 CreateCellCompPDF(hCellAmplitudeBlockMaskB,vOnlyMaskedInMergedA,projMaskedCellsA,projMaskedCellsB,outNameA);
290 cout<<
" Cells masked in version B and not in version A ("<<vOnlyMaskedInMergedB.size()<<
"):"<<endl;
291 for(
Int_t i=0; i<(
Int_t)vOnlyMaskedInMergedB.size();i++)
293 cout<<vOnlyMaskedInMergedB.at(i)<<
","<<flush;
296 TString outNameB = Form(
"./AnalysisOutput/%s/Train_%i/cOnlyMergedBlockB.pdf",period.Data(),trainNo);
297 CreateCellCompPDF(hCellAmplitudeBlockMaskA,vOnlyMaskedInMergedB,projMaskedCellsA,projMaskedCellsB,outNameB);
303 Plot2DCells(
"-",244917,vOnlyMaskedInMergedB,vOnlyMaskedInMergedA);
325 Int_t fNMaxColsAbs = 2*48;
328 TH2F *plot2D_VersionB =
new TH2F(Form(
"Block%s_VersionB",Block.Data()),Form(
"Block%s_VersionB",Block.Data()),fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
329 plot2D_VersionB->GetXaxis()->SetTitle(
"cell column (#eta direction)");
330 plot2D_VersionB->GetYaxis()->SetTitle(
"cell row (#phi direction)");
331 TH2F *plot2D_VersionA =
new TH2F(Form(
"Block%s_VersionA",Block.Data()),Form(
"Block%s_VersionA",Block.Data()),fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
332 plot2D_VersionA->GetXaxis()->SetTitle(
"cell column (#eta direction)");
333 plot2D_VersionA->GetYaxis()->SetTitle(
"cell row (#phi direction)");
335 Int_t cellColumn=0,cellRow=0;
336 Int_t cellColumnAbs=0,cellRowAbs=0;
339 for(
Int_t i = 0; i < (
Int_t)cellVectorMergeB.size(); i++)
341 Int_t cell=cellVectorMergeB.at(i);
347 if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
349 cout<<
"Problem! wrong calculated number of max col and max rows"<<endl;
350 cout<<
"current col: "<<cellColumnAbs<<
", max col"<<fNMaxColsAbs<<endl;
351 cout<<
"current row: "<<cellRowAbs<<
", max row"<<fNMaxRowsAbs<<endl;
353 plot2D_VersionB->Fill(cellColumnAbs,cellRowAbs);
355 for(
Int_t i = 0; i < (
Int_t)cellVectorMergeA.size(); i++)
357 Int_t cell=cellVectorMergeA.at(i);
363 if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
365 cout<<
"Problem! wrong calculated number of max col and max rows"<<endl;
366 cout<<
"current col: "<<cellColumnAbs<<
", max col"<<fNMaxColsAbs<<endl;
367 cout<<
"current row: "<<cellRowAbs<<
", max row"<<fNMaxRowsAbs<<endl;
369 plot2D_VersionA->Fill(cellColumnAbs,cellRowAbs,1);
372 TCanvas *c1 =
new TCanvas(Form(
"2DMapForBlock%s",Block.Data()),Form(
"2DMapForBlock%s",Block.Data()),900,500);
373 c1->ToggleEventStatus();
376 plot2D_VersionB->Draw(
"colz");
378 plot2D_VersionA->Draw(
"colz");
386 for(
Int_t i=0; i<(
Int_t)cellVector.size();i++)
388 if(cell==cellVector.at(i))bad=1;
398 Int_t NoOfCells=cellVector.size();
406 for(
Int_t cell=0;cell<NoOfCells;cell++)
412 c1 =
new TCanvas(Form(
"badcells%i",cell),
"badcells",1000,750);
413 if(cellVector.size() > 6) c1->Divide(3,3);
414 else if (cellVector.size() > 3) c1->Divide(3,2);
415 else c1->Divide(3,1);
417 TH1 *hCell = hAmpIDMasked->ProjectionX(Form(
"Cell %d",cellVector.at(cell)),cellVector.at(cell)+1,cellVector.at(cell)+1);
418 TH1 *hCell2 = (
TH1*)hCell->Clone(
"hCell2");
420 c1->cd(cell%9 + 1)->SetLogy();
421 hCell->Divide(goodCellsRbR);
422 hCell2->Divide(goodCellsMerged);
424 hCell->SetLineColor(kBlue-8);
425 hCell2->SetLineColor(kRed-9);
426 hCell->GetXaxis()->SetTitle(
"E (GeV)");
427 hCell->GetYaxis()->SetTitle(
"cell/mean of good");
428 hCell->GetXaxis()->SetRangeUser(0.,10.);
429 hCell->SetLineWidth(1) ;
430 hCell->SetTitle(Form(
"Cell No. %d",cellVector.at(cell)));
432 hCell2->DrawCopy(
"same hist");
438 if(cell%9==8 ||cell == NoOfCells-1)
440 if(cell == NoOfCells-1)
443 c1->Print(Form(
"%s)",pdfName.Data()));
445 else if(firstCanvas==0)
447 internal_pdfName +=
"(";
448 c1->Print(internal_pdfName.Data());
453 c1->Print(internal_pdfName.Data());
470 Histo->GetYaxis()->SetTitleOffset(1.4);
471 Histo->GetXaxis()->SetTitleOffset(1.4);
472 Histo->GetXaxis()->SetLabelSize(0.05);
473 Histo->GetYaxis()->SetLabelSize(0.05);
474 Histo->GetXaxis()->SetTitleSize(0.045);
475 Histo->GetYaxis()->SetTitleSize(0.045);
476 Histo->GetXaxis()->SetNdivisions(505);
477 Histo->GetYaxis()->SetNdivisions(505);
482 Histo->GetYaxis()->SetTitleOffset(0.2);
483 Histo->GetXaxis()->SetTitleOffset(1.0);
486 Histo->GetXaxis()->SetLabelSize(0.07);
487 Histo->GetYaxis()->SetLabelSize(0.07);
488 Histo->GetXaxis()->SetTitleSize(0.08);
489 Histo->GetYaxis()->SetTitleSize(0.08);
492 Histo->GetXaxis()->SetNdivisions(520);
493 Histo->GetYaxis()->SetNdivisions(10);
496 Histo->GetXaxis()->SetLabelFont(42);
497 Histo->GetYaxis()->SetLabelFont(42);
498 Histo->GetXaxis()->SetTitleFont(42);
499 Histo->GetYaxis()->SetTitleFont(42);
500 if(Xtitel!=
"")Histo->GetXaxis()->SetTitle(Xtitel);
501 if(Ytitel!=
"")Histo->GetYaxis()->SetTitle(Ytitel);
503 Histo->SetLineColor(1);
504 Histo->SetMarkerColor(1);
505 Histo->SetMarkerStyle(20);
506 Histo->SetMarkerSize(0.5);
void SetRunNumber(Int_t run)
Bool_t IsCellMaskedByHand(Int_t cell, std::vector< Int_t > cellVector)
void SetHisto(TH1 *Histo, TString Xtitel, TString Ytitel, Bool_t longhisto)
void Compare2Blocks(TString period="LHC15n", Int_t trainNo=603, Int_t versionA=0, Int_t versionB=1)
AliEMCALGeometry * GetEMCALGeometry() const
void Get_RowCollumnID(Int_t runNum=244411, Int_t inputCellID=-1, Int_t inputRow=-1, Int_t inputCollumn=-1, Int_t inputSM=-1)
void Plot2DCells(TString Block, Int_t runNo, std::vector< Int_t > cellVectorMergeB, std::vector< Int_t > cellVectorMergeA)
Class with utils specific to calorimeter clusters/cells.
void AccessGeometry(AliVEvent *inputEvent)
Int_t GetModuleNumberCellIndexesAbsCaloMap(Int_t absId, Int_t calo, Int_t &icol, Int_t &irow, Int_t &iRCU, Int_t &icolAbs, Int_t &irowAbs) const
void CreateCellCompPDF(TH2F *hAmpIDMasked, std::vector< Int_t > cellVector, TH1 *goodCellsMerged, TH1 *goodCellsRbR, TString pdfName)