22 #include <Riostream.h>
31 #include "AliEMCALGeometry.h"
33 #include "AliAODEvent.h"
40 void Plot2DCells(
TString Block,
Int_t runNo, std::vector<Int_t> cellVectorRbR, std::vector<Int_t> cellVectorMerge);
58 Int_t cellColumn=0,cellRow=0;
59 Int_t cellColumnAbs=0,cellRowAbs=0;
63 cout<<
"...................................................."<<endl;
68 cout<<
"Cell Id provided: "<<inputCellID<<endl;
69 cout<<
"This corresponds to absolute row: "<<cellRowAbs<<
" and absolute collumn: "<<cellColumnAbs<<endl;
71 else if(inputRow!=-1 && inputCollumn!=-1 && inputSM!=-1)
73 cout<<
"Supermodule provided: "<<inputSM<<endl;
74 cout<<
"Absolute row provided: "<< inputRow<<
" and absolute collumn provided : "<<inputCollumn<<endl;
75 cellID=geom->GetAbsCellIdFromCellIndexes(inputSM,inputRow,inputCollumn);
76 cout<<
"This corresponds to Cell Id: "<<cellID<<endl;
78 else cout<<
"need more information!"<<endl;
80 cout<<
"...................................................."<<endl;
91 gROOT->ProcessLine(
"gErrorIgnoreLevel = kWarning;");
92 gStyle->SetOptStat(0);
93 gStyle->SetPadLeftMargin(0.13);
94 gStyle->SetPadRightMargin(0.1);
95 gStyle->SetPadBottomMargin(0.13);
96 gStyle->SetPadTopMargin(0.02);
98 Int_t noOfCells=17674;
99 Int_t nBadCellMerged =noOfCells;
100 Int_t nBadCellRbR =noOfCells;
104 std::vector<Int_t> badcellsBlock1;
109 std::vector<Int_t> vOnlyMaskedInMergedA;
110 std::vector<Int_t> vOnlyMaskedInMergedB;
115 cout<<
"** Open file A with merged runlist analysis: "<<endl;
116 TString pathA = Form(
"./AnalysisOutput/%s/Train_%i/Version%i",period.Data(),trainNo,versionA);
117 TString rootFileNameA= Form(
"%s_INT7_Histograms_V%i.root",period.Data(),versionA);
118 TFile* outputRootA = TFile::Open(Form(
"%s/%s",pathA.Data(),rootFileNameA.Data()));
119 if(!outputRootA)cout<<
"File "<<outputRootA->GetName()<<
" does not exist"<<endl;
120 else cout<<
"file A: "<<outputRootA->GetName()<<endl;
123 TH2F* hCellAmplitudeA =(
TH2F*)outputRootA->Get(
"hCellAmplitude");
124 TH1F* hnEventsA =(TH1F*)outputRootA->Get(
"hNEvents");
125 hCellAmplitudeA->Scale(hnEventsA->GetBinContent(1));
126 TH2F* hCellAmplitudeBlockMaskA=(
TH2F*)hCellAmplitudeA->Clone(
"hCellAmplitudeMask");
127 TH1F* hCellFlagA =(TH1F*)outputRootA->Get(
"fhCellFlag");
133 cout<<
"**Open file B with merged runlist analysis: "<<endl;
134 TString pathB = Form(
"./AnalysisOutput/%s/Train_%i/Version%i",period.Data(),trainNo,versionB);
135 TString rootFileNameB= Form(
"%s_INT7_Histograms_V%i.root",period.Data(),versionB);
136 TFile* outputRootB = TFile::Open(Form(
"%s/%s",pathB.Data(),rootFileNameB.Data()));
137 if(!outputRootB)cout<<
"File "<<outputRootB->GetName()<<
" does not exist"<<endl;
138 else cout<<
"file B: "<<outputRootB->GetName()<<endl;
141 TH2F* hCellAmplitudeB =(
TH2F*)outputRootB->Get(
"hCellAmplitude");
142 TH1F* hnEventsB =(TH1F*)outputRootB->Get(
"hNEvents");
143 hCellAmplitudeB->Scale(hnEventsB->GetBinContent(1));
144 TH2F* hCellAmplitudeBlockMaskB=(
TH2F*)hCellAmplitudeB->Clone(
"hCellAmplitudeMask");
145 TH1F* hCellFlagB =(TH1F*)outputRootB->Get(
"fhCellFlag");
153 for(
Int_t ic = 0; ic < noOfCells; ic++)
162 for (
Int_t amp = 1; amp <= hCellAmplitudeBlockMaskA->GetNbinsX(); amp++)
164 if(hCellFlagA->GetBinContent(ic+1)>0 || maskA==1)
166 hCellAmplitudeBlockMaskA->SetBinContent(amp,ic+1,0);
167 if(amp==1)nBadCellMerged--;
178 for (
Int_t amp = 1; amp <= hCellAmplitudeBlockMaskB->GetNbinsX(); amp++)
180 if(hCellFlagB->GetBinContent(ic+1)>0 || maskB==1)
182 hCellAmplitudeBlockMaskB->SetBinContent(amp,ic+1,0);
183 if(amp==1)nBadCellRbR--;
192 if(hCellFlagA->GetBinContent(ic+1)>0 && hCellFlagB->GetBinContent(ic+1)==0)vOnlyMaskedInMergedA.push_back(ic);
193 if(hCellFlagA->GetBinContent(ic+1)==0 && hCellFlagB->GetBinContent(ic+1)>0) vOnlyMaskedInMergedB.push_back(ic);
197 TH1* projMaskedCellsA = hCellAmplitudeBlockMaskA->ProjectionX(
"MaskedCellsMergedBlockA");
198 TH1* projMaskedCellsB = hCellAmplitudeBlockMaskB->ProjectionX(
"MaskedCellsMergedBlockB");
203 TCanvas* C1 =
new TCanvas(
"-1-",
"Projections of A and B",900,900);
205 C1->cd(1)->SetLogy();
206 SetHisto(projMaskedCellsA,
"",
"hits/event",0);
207 projMaskedCellsA->DrawCopy(
"hist");
208 projMaskedCellsB->SetLineColor(8);
209 projMaskedCellsB->DrawCopy(
"same hist");
211 projMaskedCellsA->Divide(projMaskedCellsB);
212 SetHisto(projMaskedCellsA,
"",
"Merged Version A/Merged Version B",0);
213 projMaskedCellsA->DrawCopy(
"hist");
214 projMaskedCellsA->Multiply(projMaskedCellsB);
216 TCanvas* C3 =
new TCanvas(
"-3-",
"2D of A and B",900,900);
218 C3->cd(1)->SetLogz();
219 SetHisto(hCellAmplitudeBlockMaskA,
"",
"cell ID",0);
220 hCellAmplitudeBlockMaskA->DrawCopy(
"colz");
221 C3->cd(2)->SetLogz();
222 SetHisto(hCellAmplitudeBlockMaskB,
"",
"cell ID",0);
223 hCellAmplitudeBlockMaskB->DrawCopy(
"colz");
229 projMaskedCellsA->Scale(1.0/nBadCellMerged);
230 projMaskedCellsB->Scale(1.0/nBadCellRbR);
233 cout<<
" Cells masked in version A and not in version B ("<<vOnlyMaskedInMergedA.size()<<
"):"<<endl;
234 for(
Int_t i=0; i<(
Int_t)vOnlyMaskedInMergedA.size();i++)
236 cout<<vOnlyMaskedInMergedA.at(i)<<
","<<flush;
239 CreateCellCompPDF(hCellAmplitudeBlockMaskB,vOnlyMaskedInMergedA,projMaskedCellsA,projMaskedCellsB,
"./cOnlyMergedBlockA.pdf");
240 cout<<
" Cells masked in version B and not in version A ("<<vOnlyMaskedInMergedB.size()<<
"):"<<endl;
241 for(
Int_t i=0; i<(
Int_t)vOnlyMaskedInMergedB.size();i++)
243 cout<<vOnlyMaskedInMergedB.at(i)<<
","<<flush;
246 CreateCellCompPDF(hCellAmplitudeBlockMaskA,vOnlyMaskedInMergedB,projMaskedCellsA,projMaskedCellsB,
"./cOnlyMergedBlockB.pdf");
252 Plot2DCells(
"A",244917,vOnlyMaskedInMergedB,vOnlyMaskedInMergedA);
274 Int_t fNMaxColsAbs = 2*48;
277 TH2F *plot2D_RbR =
new TH2F(Form(
"Block%s_MaskedRbR",Block.Data()),Form(
"Block%s_MaskedRbR",Block.Data()),fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
278 plot2D_RbR->GetXaxis()->SetTitle(
"cell column (#eta direction)");
279 plot2D_RbR->GetYaxis()->SetTitle(
"cell row (#phi direction)");
280 TH2F *plot2D_Merge =
new TH2F(Form(
"Block%s_MaskedMerge",Block.Data()),Form(
"Block%s_MaskedMerge",Block.Data()),fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
281 plot2D_Merge->GetXaxis()->SetTitle(
"cell column (#eta direction)");
282 plot2D_Merge->GetYaxis()->SetTitle(
"cell row (#phi direction)");
284 Int_t cellColumn=0,cellRow=0;
285 Int_t cellColumnAbs=0,cellRowAbs=0;
288 for(
Int_t i = 0; i < (
Int_t)cellVectorRbR.size(); i++)
290 Int_t cell=cellVectorRbR.at(i);
296 if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
298 cout<<
"Problem! wrong calculated number of max col and max rows"<<endl;
299 cout<<
"current col: "<<cellColumnAbs<<
", max col"<<fNMaxColsAbs<<endl;
300 cout<<
"current row: "<<cellRowAbs<<
", max row"<<fNMaxRowsAbs<<endl;
302 plot2D_RbR->Fill(cellColumnAbs,cellRowAbs);
304 for(
Int_t i = 0; i < (
Int_t)cellVectorMerge.size(); i++)
306 Int_t cell=cellVectorMerge.at(i);
312 if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
314 cout<<
"Problem! wrong calculated number of max col and max rows"<<endl;
315 cout<<
"current col: "<<cellColumnAbs<<
", max col"<<fNMaxColsAbs<<endl;
316 cout<<
"current row: "<<cellRowAbs<<
", max row"<<fNMaxRowsAbs<<endl;
318 plot2D_Merge->Fill(cellColumnAbs,cellRowAbs,1);
321 TCanvas *c1 =
new TCanvas(Form(
"2DMapForBlock%s",Block.Data()),Form(
"2DMapForBlock%s",Block.Data()),900,500);
322 c1->ToggleEventStatus();
325 plot2D_RbR->Draw(
"colz");
327 plot2D_Merge->Draw(
"colz");
335 for(
Int_t i=0; i<(
Int_t)cellVector.size();i++)
337 if(cell==cellVector.at(i))bad=1;
347 Int_t NoOfCells=cellVector.size();
355 for(
Int_t cell=0;cell<NoOfCells;cell++)
361 c1 =
new TCanvas(Form(
"badcells%i",cell),
"badcells",1000,750);
362 if(cellVector.size() > 6) c1->Divide(3,3);
363 else if (cellVector.size() > 3) c1->Divide(3,2);
364 else c1->Divide(3,1);
366 TH1 *hCell = hAmpIDMasked->ProjectionX(Form(
"Cell %d",cellVector.at(cell)),cellVector.at(cell)+1,cellVector.at(cell)+1);
367 TH1 *hCell2 = (
TH1*)hCell->Clone(
"hCell2");
370 hCell->Divide(goodCellsRbR);
371 hCell2->Divide(goodCellsMerged);
373 hCell->SetLineColor(kBlue-8);
374 hCell2->SetLineColor(kRed-9);
375 hCell->GetXaxis()->SetTitle(
"E (GeV)");
376 hCell->GetYaxis()->SetTitle(
"cell/mean of good");
377 hCell->GetXaxis()->SetRangeUser(0.,10.);
378 hCell->SetLineWidth(1) ;
379 hCell->SetTitle(Form(
"Cell No. %d",cellVector.at(cell)));
381 hCell2->DrawCopy(
"same hist");
387 if(cell%9==8 ||cell == NoOfCells-1)
389 if(cell == NoOfCells-1)
392 c1->Print(Form(
"%s)",pdfName.Data()));
394 else if(firstCanvas==0)
396 internal_pdfName +=
"(";
397 c1->Print(internal_pdfName.Data());
402 c1->Print(internal_pdfName.Data());
419 Histo->GetYaxis()->SetTitleOffset(1.4);
420 Histo->GetXaxis()->SetTitleOffset(1.4);
421 Histo->GetXaxis()->SetLabelSize(0.05);
422 Histo->GetYaxis()->SetLabelSize(0.05);
423 Histo->GetXaxis()->SetTitleSize(0.045);
424 Histo->GetYaxis()->SetTitleSize(0.045);
425 Histo->GetXaxis()->SetNdivisions(505);
426 Histo->GetYaxis()->SetNdivisions(505);
431 Histo->GetYaxis()->SetTitleOffset(0.2);
432 Histo->GetXaxis()->SetTitleOffset(1.0);
435 Histo->GetXaxis()->SetLabelSize(0.07);
436 Histo->GetYaxis()->SetLabelSize(0.07);
437 Histo->GetXaxis()->SetTitleSize(0.08);
438 Histo->GetYaxis()->SetTitleSize(0.08);
441 Histo->GetXaxis()->SetNdivisions(520);
442 Histo->GetYaxis()->SetNdivisions(10);
445 Histo->GetXaxis()->SetLabelFont(42);
446 Histo->GetYaxis()->SetLabelFont(42);
447 Histo->GetXaxis()->SetTitleFont(42);
448 Histo->GetYaxis()->SetTitleFont(42);
449 if(Xtitel!=
"")Histo->GetXaxis()->SetTitle(Xtitel);
450 if(Ytitel!=
"")Histo->GetYaxis()->SetTitle(Ytitel);
452 Histo->SetLineColor(1);
453 Histo->SetMarkerColor(1);
454 Histo->SetMarkerStyle(20);
455 Histo->SetMarkerSize(0.5);
void Plot2DCells(TString Block, Int_t runNo, std::vector< Int_t > cellVectorRbR, std::vector< Int_t > cellVectorMerge)
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)
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)