23 #include <Riostream.h> 32 #include "AliEMCALGeometry.h" 34 #include "AliAODEvent.h" 35 #include "AliOADBContainer.h" 48 cout<<
"o o o Open .txt file with run indices. Name = " << runList << endl;
49 TString RunPath1 = Form(
"./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList.Data());
50 cout<<
"o o o Open .txt file with run indices = " << RunPath1 << endl;
51 FILE *pFile1 = fopen(RunPath1.Data(),
"r");
54 cout<<
"couldn't open file "<<RunPath1<<
"!"<<endl;
60 std::vector<Int_t> RunIdVec1;
63 ncols1 = fscanf(pFile1,
" %d ",&q1);
65 RunIdVec1.push_back(q1);
69 std::sort (RunIdVec1.begin(), RunIdVec1.end());
71 cout<<
"Runs in Order: "<<endl;
72 for(
Int_t iRun = 0; iRun < (
Int_t)RunIdVec1.size(); iRun++)
74 cout<<RunIdVec1.at(iRun)<<
", "<<flush;
86 gStyle->SetOptStat(0);
92 Int_t cellColumnAbs,cellRowAbs,trash,cellID;
93 TString summaryPDF=Form(
"./AnalysisOutput/%s/Train_%i/OADB_Summary.pdf",period.Data(),trainNo);
97 cout<<
"o o o Open .txt file with run indices. Name = " << runList << endl;
98 TString RunPath = Form(
"./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList.Data());
99 cout<<
"o o o Open .txt file with run indices = " << RunPath << endl;
100 FILE *pFile = fopen(RunPath.Data(),
"r");
103 cout<<
"couldn't open file "<<RunPath<<
"!"<<endl;
110 std::vector<Int_t> RunIdVec;
113 ncols = fscanf(pFile,
" %d ",&q);
116 RunIdVec.push_back(q);
121 std::sort (RunIdVec.begin(), RunIdVec.end());
122 Int_t nRuns=RunIdVec.size();
128 AliOADBContainer *cont=
new AliOADBContainer(
"");
129 cont->InitFromFile(Form(
"%s/EMCALBadChannels.root",fBasePath.Data()),
"AliEMCALBadChannels");
134 TString path = Form(
"./AnalysisOutput/%s/Train_%i/Version%s",period.Data(),trainNo,version.Data());
135 TString rootFileName= Form(
"%s_INT7_Histograms_V%s.root",period.Data(),version.Data());
136 TFile* outputRoot = TFile::Open(Form(
"%s/%s",path.Data(),rootFileName.Data()));
138 if(!outputRoot)cout<<
"File "<<outputRoot->GetName()<<
" does not exist"<<endl;
139 TH2F* h2DChannelMap_FlagBad =(
TH2F*)outputRoot->Get(
"2DChannelMap_Flag2");
140 TH2F* h2DChannelMap_FlagDead=(
TH2F*)outputRoot->Get(
"2DChannelMap_Flag1");
154 Int_t fNMaxCols = 48;
155 Int_t fNMaxRows = 24;
157 Int_t fNMaxColsAbs = 2*fNMaxCols;
160 histoName = Form(
"2DChannelMap_Flag_Bad");
161 TH2F *plot2D_Bad_OADB =
new TH2F(histoName,histoName,fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
163 plot2D_Bad_OADB->GetXaxis()->SetTitle(
"cell column (#eta direction)");
164 plot2D_Bad_OADB->GetYaxis()->SetTitle(
"cell row (#phi direction)");
165 histoName = Form(
"2DChannelMap_Flag_Dead");
166 TH2F *plot2D_Dead_OADB =
new TH2F(histoName,histoName,fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
168 plot2D_Dead_OADB->GetXaxis()->SetTitle(
"cell column (#eta direction)");
169 plot2D_Dead_OADB->GetYaxis()->SetTitle(
"cell row (#phi direction)");
173 TCanvas* C2 =
new TCanvas(
"CompareCanvas",
"Compare OADB to LocalFile",1400,800);
175 TLatex* textA =
new TLatex(0.5,0.8,
"If empty -> good!");
176 textA->SetTextSize(0.04);
177 textA->SetTextColor(1);
180 cout<<
"Checking "<<nRuns<<
" runs: "<<endl;
181 std::vector<Int_t> RunsWithoutMap;
182 std::vector<Int_t> RunsWithMap;
184 for(
Int_t iRun = 0; iRun < nRuns; iRun++)
187 if(iRun%5==0)cout<<
"."<<flush;
188 if(iRun%20==0)cout<<
"Run No."<<iRun<<endl;
192 cout<<
"Error - No bad map for run Number "<<RunIdVec.at(iRun)<<
" online!!"<<endl;
193 RunsWithoutMap.push_back(RunIdVec.at(iRun));
196 RunsWithMap.push_back(RunIdVec.at(iRun));
198 plot2D_Bad_OADB ->Reset();
199 plot2D_Dead_OADB->Reset();
200 for(
Int_t iSM = 0; iSM < nSM; iSM++)
203 h[iSM]=(TH1C *)recal->FindObject(Form(
"EMCALBadChannelMap_Mod%d",iSM));
205 for(
Int_t column=0;column<48;column++)
207 for(
Int_t row=0;row<24;row++)
211 cellID=geom->GetAbsCellIdFromCellIndexes(iSM,inRow,inCol);
213 if(h[iSM]->GetBinContent(column,row)>1)
215 plot2D_Bad_OADB->SetBinContent(cellColumnAbs,cellRowAbs,1);
217 if(h[iSM]->GetBinContent(column,row)==1)
219 plot2D_Dead_OADB->SetBinContent(cellColumnAbs,cellRowAbs,1);
225 TLatex*
text=
new TLatex(0.15,0.85,Form(
"Run Number %i",RunIdVec.at(iRun)));
226 text->SetTextSize(0.05);
228 text->SetTextColor(1);
229 text->SetTextAngle(0);
233 plot2D_Dead_OADB->SetTitle(
"Dead Cells OADB");
234 plot2D_Dead_OADB->DrawCopy(
"colz");
237 plot2D_Bad_OADB->SetTitle(
"Bad Cells OADB");
238 plot2D_Bad_OADB->DrawCopy(
"colz");
240 h2DChannelMap_FlagDead->SetTitle(
"Dead Cells LocalFile");
241 h2DChannelMap_FlagDead->DrawCopy(
"colz");
243 h2DChannelMap_FlagBad->SetTitle(
"Bad Cells LocalFile");
244 h2DChannelMap_FlagBad->DrawCopy(
"colz");
248 plot2D_Dead_OADB->SetTitle(
"OADB-Local File (Dead)");
249 plot2D_Dead_OADB->Add(h2DChannelMap_FlagDead,-1);
250 plot2D_Dead_OADB->DrawCopy(
"colz");
251 plot2D_Dead_OADB->Add(h2DChannelMap_FlagDead,+1);
254 plot2D_Bad_OADB->SetTitle(
"OADB-Local File (Bad)");
255 plot2D_Bad_OADB->Add(h2DChannelMap_FlagBad,-1);
256 plot2D_Bad_OADB->DrawCopy(
"colz");
257 plot2D_Bad_OADB->Add(h2DChannelMap_FlagBad,+1);
260 plot2D_Dead_OADB->SetTitle(
"OADB/Local File (Dead)");
261 plot2D_Dead_OADB->Divide(h2DChannelMap_FlagDead);
262 plot2D_Dead_OADB->DrawCopy(
"colz");
264 plot2D_Bad_OADB->SetTitle(
"OADB/Local File (Bad)");
265 plot2D_Bad_OADB->Divide(h2DChannelMap_FlagBad);
266 plot2D_Bad_OADB->DrawCopy(
"colz");
271 if(iRun==0) C2 ->Print(Form(
"%s(",summaryPDF.Data()));
272 else if (iRun==nRuns-1) C2 ->Print(Form(
"%s)",summaryPDF.Data()));
273 else C2 ->Print(Form(
"%s",summaryPDF.Data()));
275 cout<<
"==Total Summary=="<<endl;
277 cout<<
"Runs with a bad map ("<<RunsWithMap.size()<<
"): "<<flush;
278 for(
Int_t i=0;i<(
Int_t)RunsWithMap.size();i++)
280 cout<<RunsWithMap.at(i)<<
","<<flush;
283 cout<<
"Runs without a bad map ("<<RunsWithoutMap.size()<<
"): "<<flush;
284 for(
Int_t i=0;i<(
Int_t)RunsWithoutMap.size();i++)
286 cout<<RunsWithoutMap.at(i)<<
","<<flush;
297 gStyle->SetPadTopMargin(0.05);
298 gStyle->SetPadBottomMargin(0.18);
299 gStyle->SetPadRightMargin(0.05);
300 gStyle->SetPadLeftMargin(0.17);
301 gStyle->SetFrameFillColor(10);
306 const Int_t nBlocks=1;
319 TString ListName = Form(
"./AnalysisOutput/%s/Train_%i/%s",period.Data(),trainNo,cellList.Data());
320 cout<<
"o o o Open .txt suggested cell IDs. Name = " << ListName << endl;
321 FILE *pFile = fopen(ListName.Data(),
"r");
324 cout<<
"couldn't open file "<<ListName<<
"!"<<endl;
331 std::vector<Int_t> cellIdVec;
334 ncols = fscanf(pFile,
" %d ",&q);
337 cellIdVec.push_back(q);
342 std::sort (cellIdVec.begin(), cellIdVec.end());
343 Int_t nCells=cellIdVec.size();
347 TString path = Form(
"./AnalysisOutput/%s/Train_%i",period.Data(),trainNo);
349 TFile* outputRoot[nBlocks];
350 TH2F* h2DAmp[nBlocks];
351 TH2F* h2DRatio[nBlocks];
352 TH2F* h2DCellTime[nBlocks];
354 for(
Int_t iBlock=0;iBlock<nBlocks;iBlock++)
377 if(iBlock==0)rootFileName[iBlock]= Form(
"Version0/%s_INT7_Histograms_V0.root",period.Data());
379 outputRoot[iBlock] = TFile::Open(Form(
"%s/%s",path.Data(),rootFileName[iBlock].Data()));
380 if(!outputRoot[iBlock])cout<<
"File "<<outputRoot[iBlock]->GetName()<<
" does not exist"<<endl;
381 h2DAmp[iBlock] =(
TH2F*)outputRoot[iBlock]->Get(
"hCellAmplitude");
382 h2DRatio[iBlock] =(
TH2F*)outputRoot[iBlock]->Get(
"ratio2DAmp");
383 h2DCellTime[iBlock]=(
TH2F*)outputRoot[iBlock]->Get(
"hCellTime");
386 TCanvas *c1 =
new TCanvas(1);
390 h2DAmp[0]->Draw(
"colz");
393 h2DRatio[0]->Draw(
"colz");
398 Int_t totalperCv = 8;
399 Int_t nPad = TMath::Sqrt(totalperCv);
400 Int_t nCv = nCells/totalperCv+1;
403 cout<<
" o create: "<<nCv<<
" Canvases with "<<nPad*nPad<<
" pads"<<endl;
405 TCanvas **cCompAll =
new TCanvas*[nCv];
406 TCanvas **cCompTimeAll =
new TCanvas*[nCv];
407 for(
Int_t i=0;i<nCv;i++)
409 cCompAll[i] =
new TCanvas(TString::Format(
"CompareGoodAll%d", i), TString::Format(
"V) Both (%d/%d)", i+1, nCv), 1000,750);
411 cCompTimeAll[i] =
new TCanvas(TString::Format(
"CompareGoodTimeAll%d", i), TString::Format(
"V) Time (%d/%d)", i+1, nCv), 1000,750);
412 cCompTimeAll[i]->Divide(4,4,0.001,0.001);
415 TLegend *leg2 =
new TLegend(0.60,0.60,0.9,0.85);
416 cout<<
" o Fill Canvases with bad cells histograms"<<endl;
418 TH1D *htmpCellAllRuns[nBlocks];
419 TH1D *htmpCellTimeRuns[nBlocks];
420 TH1D *htmpCellRatioAllRuns[nBlocks];
421 cout<<
"cell number: "<<endl;
422 for(
Int_t icell = 0; icell < nCells; icell++)
424 Int_t cellID=cellIdVec.at(icell);
425 cout<<cellID<<
", "<<flush;
427 for(
Int_t iBlock=0;iBlock<nBlocks;iBlock++)
429 htmpCellAllRuns[iBlock] =h2DAmp[iBlock] ->ProjectionX(TString::Format(
"hIDProj%i_cell%d",iBlock, cellID), cellID+1, cellID+1);
430 SetHisto(htmpCellAllRuns[iBlock],Form(
"Energy [cell %i]",cellID),
"Number of Hits/Events");
431 htmpCellRatioAllRuns[iBlock] =h2DRatio[iBlock]->ProjectionX(TString::Format(
"hIDRProj%i_cell%d", iBlock, cellID), cellID+1, cellID+1);
432 SetHisto(htmpCellRatioAllRuns[iBlock],Form(
"Energy [cell %i]",cellID),
"No. Hits/av. No. Hits");
434 htmpCellTimeRuns[iBlock] =h2DCellTime[iBlock]->ProjectionX(TString::Format(
"hIDTimeProj%i_cell%d", iBlock, cellID), cellID+1, cellID+1);
435 SetHisto(htmpCellTimeRuns[iBlock],Form(
"Time, ns [cell %i]",cellID),
"Entries/Events");
437 if(((icell)%8)<4) shift=0;
440 cCompAll[(icell)/totalperCv]->cd(((icell)%4)+1+shift)->SetLogy();
441 if(iBlock==0)htmpCellAllRuns[iBlock]->GetXaxis()->SetRangeUser(0,range);
442 if(iBlock==0)htmpCellAllRuns[iBlock]->Draw(
"hist");
443 if(iBlock==1)htmpCellAllRuns[iBlock]->SetLineColor(kBlue-7);
444 if(iBlock==2)htmpCellAllRuns[iBlock]->SetLineColor(kGreen-2);
445 if(iBlock==3)htmpCellAllRuns[iBlock]->SetLineColor(kViolet-1);
446 if(iBlock>0)htmpCellAllRuns[iBlock]->DrawCopy(
"same hist");
450 leg2->AddEntry(htmpCellAllRuns[iBlock],Form(
"Block%i",iBlock),
"l");
451 leg2->SetTextSize(0.07);
452 leg2->SetBorderSize(0);
453 leg2->SetFillColorAlpha(10, 0);
456 else if((icell)%4==0)
462 cCompAll[(icell)/totalperCv]->cd(((icell)%4)+5+shift)->SetLogy();
463 if(iBlock==0)htmpCellRatioAllRuns[iBlock]->GetXaxis()->SetRangeUser(0,range);
464 if(iBlock==0)htmpCellRatioAllRuns[iBlock]->Draw(
"hist");
465 if(iBlock==1)htmpCellRatioAllRuns[iBlock]->SetLineColor(kBlue-7);
466 if(iBlock==2)htmpCellRatioAllRuns[iBlock]->SetLineColor(kGreen-2);
467 if(iBlock==3)htmpCellRatioAllRuns[iBlock]->SetLineColor(kViolet-1);
468 if(iBlock>0)htmpCellRatioAllRuns[iBlock]->DrawCopy(
"same hist");
471 cCompTimeAll[(icell)/totalperCv]->cd(((icell)%4)+1+shift)->SetLogy();
472 if(iBlock==0)htmpCellTimeRuns[iBlock]->GetXaxis()->SetRangeUser(tRange1,tRange2);
473 if(iBlock==0)htmpCellTimeRuns[iBlock]->Draw(
"hist");
474 if(iBlock==1)htmpCellTimeRuns[iBlock]->SetLineColor(kBlue-7);
475 if(iBlock==2)htmpCellTimeRuns[iBlock]->SetLineColor(kGreen-2);
476 if(iBlock==3)htmpCellTimeRuns[iBlock]->SetLineColor(kViolet-1);
477 if(iBlock>0)htmpCellTimeRuns[iBlock]->DrawCopy(
"same hist");
482 TString pdfName= Form(
"./AnalysisOutput/%s/Train_%i/%s_MoreBadCellsCandidates.pdf",period.Data(),trainNo,period.Data());
484 for(
Int_t can=0;can<nCv;can++)
492 cCompAll[can] ->Print(Form(
"%s(",pdfName.Data()));
493 cCompTimeAll[can]->Print(Form(
"%s",pdfName.Data()));
497 cCompAll[can] ->Print(Form(
"%s(",pdfName.Data()));
498 cCompTimeAll[can]->Print(Form(
"%s)",pdfName.Data()));
501 else if(can==(nCv-1))
504 cCompAll[can] ->Print(Form(
"%s",pdfName.Data()));
505 cCompTimeAll[can]->Print(Form(
"%s)",pdfName.Data()));
510 cCompAll[can] ->Print(Form(
"%s",pdfName.Data()));
511 cCompTimeAll[can] ->Print(Form(
"%s",pdfName.Data()));
524 Histo->GetYaxis()->SetTitleOffset(1.1);
525 Histo->GetXaxis()->SetTitleOffset(1.1);
526 Histo->GetXaxis()->SetLabelSize(0.05);
527 Histo->GetYaxis()->SetLabelSize(0.05);
528 Histo->GetXaxis()->SetTitleSize(0.06);
529 Histo->GetYaxis()->SetTitleSize(0.06);
530 Histo->GetXaxis()->SetNdivisions(505);
531 Histo->GetYaxis()->SetNdivisions(505);
533 Histo->GetXaxis()->SetLabelFont(42);
534 Histo->GetYaxis()->SetLabelFont(42);
535 Histo->GetXaxis()->SetTitleFont(42);
536 Histo->GetYaxis()->SetTitleFont(42);
537 if(Xtitel!=
"")Histo->GetXaxis()->SetTitle(Xtitel);
538 if(Ytitel!=
"")Histo->GetYaxis()->SetTitle(Ytitel);
540 Histo->SetLineColor(1);
541 Histo->SetMarkerColor(1);
542 Histo->SetMarkerStyle(20);
543 Histo->SetMarkerSize(0.5);
555 C->Divide(Nx,Ny,0.000,0.000);
557 for (
Int_t i=0;i<Nx;i++)
559 C->cd(i+1)->SetLogy();
560 gPad->SetLeftMargin(lMargin);
561 gPad->SetRightMargin(rMargin);
562 gPad->SetBottomMargin(0);
563 gPad->SetTopMargin(tMargin);
567 for (
Int_t i=0;i<Nx;i++)
570 gPad->SetLeftMargin(lMargin);
571 gPad->SetRightMargin(rMargin);
572 gPad->SetBottomMargin(bMargin);
573 gPad->SetTopMargin(0);
576 for (
Int_t i=0;i<Nx;i++)
578 C->cd(i+1+2*Nx)->SetLogy();
579 gPad->SetLeftMargin(lMargin);
580 gPad->SetRightMargin(rMargin);
581 gPad->SetBottomMargin(0);
582 gPad->SetTopMargin(tMargin);
585 for (
Int_t i=0;i<Nx;i++)
588 gPad->SetLeftMargin(lMargin);
589 gPad->SetRightMargin(rMargin);
590 gPad->SetBottomMargin(bMargin);
591 gPad->SetTopMargin(0);
void SetRunNumber(Int_t run)
TLatex * text[5]
option to what and if export to output file
void CanvasPartition(TCanvas *C, const Int_t Nx=2, const Int_t Ny=2, Float_t lMargin=0.15, Float_t rMargin=0.05, Float_t bMargin=0.15, Float_t tMargin=0.05)
void Test_OADB(TString period="LHC15n", Int_t trainNo=603, TString version="INT7Emc", TString runList="")
AliEMCALGeometry * GetEMCALGeometry() const
void SetHisto(TH1 *Histo, TString Xtitel, TString Ytitel)
void Sort_RunNumbers(TString period="LHC15n", Int_t trainNo=603, TString runList="")
void Plot_CellList(TString period="LHC15n", Int_t trainNo=603, TString cellList="")
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