23 #include <Riostream.h>
31 #include "AliEMCALGeometry.h"
33 #include "AliAODEvent.h"
34 #include "AliOADBContainer.h"
45 cout<<
"o o o Open .txt file with run indices. Name = " << runList << endl;
46 TString RunPath1 = Form(
"./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList.Data());
47 cout<<
"o o o Open .txt file with run indices = " << RunPath1 << endl;
48 FILE *pFile1 = fopen(RunPath1.Data(),
"r");
51 cout<<
"couldn't open file "<<RunPath1<<
"!"<<endl;
57 std::vector<Int_t> RunIdVec1;
60 ncols1 = fscanf(pFile1,
" %d ",&q1);
62 RunIdVec1.push_back(q1);
66 std::sort (RunIdVec1.begin(), RunIdVec1.end());
68 cout<<
"Runs in Order: "<<endl;
69 for(
Int_t iRun = 0; iRun < (
Int_t)RunIdVec1.size(); iRun++)
71 cout<<RunIdVec1.at(iRun)<<
", "<<flush;
83 gStyle->SetOptStat(0);
89 Int_t cellColumnAbs,cellRowAbs,trash,cellID;
90 TString summaryPDF=Form(
"./AnalysisOutput/%s/Train_%i/OADB_Summary.pdf",period.Data(),trainNo);
94 cout<<
"o o o Open .txt file with run indices. Name = " << runList << endl;
95 TString RunPath = Form(
"./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList.Data());
96 cout<<
"o o o Open .txt file with run indices = " << RunPath << endl;
97 FILE *pFile = fopen(RunPath.Data(),
"r");
100 cout<<
"couldn't open file "<<RunPath<<
"!"<<endl;
107 std::vector<Int_t> RunIdVec;
110 ncols = fscanf(pFile,
" %d ",&q);
113 RunIdVec.push_back(q);
118 std::sort (RunIdVec.begin(), RunIdVec.end());
119 Int_t nRuns=RunIdVec.size();
123 TString fBasePath=
"/Users/Eliane/Software/BadChannelAnalysis";
125 AliOADBContainer *cont=
new AliOADBContainer(
"");
126 cont->InitFromFile(Form(
"%s/EMCALBadChannels.root",fBasePath.Data()),
"AliEMCALBadChannels");
131 TString path = Form(
"/Users/Eliane/Software/BadChannelAnalysis/AnalysisOutput/%s/Train_%i/Version%s",period.Data(),trainNo,version.Data());
132 TString rootFileName= Form(
"%s_INT7_Histograms_V%s.root",period.Data(),version.Data());
133 TFile* outputRoot = TFile::Open(Form(
"%s/%s",path.Data(),rootFileName.Data()));
135 if(!outputRoot)cout<<
"File "<<outputRoot->GetName()<<
" does not exist"<<endl;
136 TH2F* h2DChannelMap_FlagBad =(
TH2F*)outputRoot->Get(
"2DChannelMap_Flag2");
137 TH2F* h2DChannelMap_FlagDead=(
TH2F*)outputRoot->Get(
"2DChannelMap_Flag1");
151 Int_t fNMaxCols = 48;
152 Int_t fNMaxRows = 24;
154 Int_t fNMaxColsAbs = 2*fNMaxCols;
157 histoName = Form(
"2DChannelMap_Flag_Bad");
158 TH2F *plot2D_Bad_OADB =
new TH2F(histoName,histoName,fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
160 plot2D_Bad_OADB->GetXaxis()->SetTitle(
"cell column (#eta direction)");
161 plot2D_Bad_OADB->GetYaxis()->SetTitle(
"cell row (#phi direction)");
162 histoName = Form(
"2DChannelMap_Flag_Dead");
163 TH2F *plot2D_Dead_OADB =
new TH2F(histoName,histoName,fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
165 plot2D_Dead_OADB->GetXaxis()->SetTitle(
"cell column (#eta direction)");
166 plot2D_Dead_OADB->GetYaxis()->SetTitle(
"cell row (#phi direction)");
170 TCanvas* C2 =
new TCanvas(
"CompareCanvas",
"Compare OADB to LocalFile",900,900);
172 TCanvas* C4 =
new TCanvas(
"Subtraction of OADB-Orig.",
"Subtraction of OADB-Orig.",900,900);
174 TLatex* textA =
new TLatex(0.5,0.8,
"If empty -> good!");
175 textA->SetTextSize(0.04);
176 textA->SetTextColor(1);
179 cout<<
"Checking "<<nRuns<<
" runs: "<<endl;
180 std::vector<Int_t> RunsWithoutMap;
181 std::vector<Int_t> RunsWithMap;
183 for(
Int_t iRun = 0; iRun < nRuns; iRun++)
186 if(iRun%5==0)cout<<
"."<<flush;
187 if(iRun%20==0)cout<<
"Run No."<<iRun<<endl;
191 cout<<
"Error - No bad map for run Number "<<RunIdVec.at(iRun)<<
" online!!"<<endl;
192 RunsWithoutMap.push_back(RunIdVec.at(iRun));
195 RunsWithMap.push_back(RunIdVec.at(iRun));
197 plot2D_Bad_OADB ->Reset();
198 plot2D_Dead_OADB->Reset();
199 for(
Int_t iSM = 0; iSM < nSM; iSM++)
202 h[iSM]=(TH1C *)recal->FindObject(Form(
"EMCALBadChannelMap_Mod%d",iSM));
204 for(
Int_t column=0;column<48;column++)
206 for(
Int_t row=0;row<24;row++)
210 cellID=geom->GetAbsCellIdFromCellIndexes(iSM,inRow,inCol);
212 if(h[iSM]->GetBinContent(column,row)>1)
214 plot2D_Bad_OADB->SetBinContent(cellColumnAbs,cellRowAbs,1);
216 if(h[iSM]->GetBinContent(column,row)==1)
218 plot2D_Dead_OADB->SetBinContent(cellColumnAbs,cellRowAbs,1);
224 TLatex*
text=
new TLatex(0.15,0.85,Form(
"Run Number %i",RunIdVec.at(iRun)));
225 text->SetTextSize(0.05);
227 text->SetTextColor(1);
228 text->SetTextAngle(0);
231 plot2D_Bad_OADB->SetTitle(
"Bad Cells OADB");
232 plot2D_Bad_OADB->DrawCopy(
"colz");
235 plot2D_Dead_OADB->SetTitle(
"Dead Cells OADB");
236 plot2D_Dead_OADB->DrawCopy(
"colz");
238 h2DChannelMap_FlagBad->SetTitle(
"Bad Cells LocalFile");
239 h2DChannelMap_FlagBad->DrawCopy(
"colz");
241 h2DChannelMap_FlagDead->SetTitle(
"Dead Cells LocalFile");
242 h2DChannelMap_FlagDead->DrawCopy(
"colz");
246 plot2D_Bad_OADB->SetTitle(
"OADB-Local File (Bad)");
247 plot2D_Bad_OADB->Add(h2DChannelMap_FlagBad,-1);
248 plot2D_Bad_OADB->DrawCopy(
"colz");
249 plot2D_Bad_OADB->Add(h2DChannelMap_FlagBad,+1);
253 plot2D_Dead_OADB->SetTitle(
"OADB-Local File (Dead)");
254 plot2D_Dead_OADB->Add(h2DChannelMap_FlagDead,-1);
255 plot2D_Dead_OADB->DrawCopy(
"colz");
256 plot2D_Dead_OADB->Add(h2DChannelMap_FlagDead,+1);
259 plot2D_Bad_OADB->SetTitle(
"OADB/Local File (Bad)");
260 plot2D_Bad_OADB->Divide(h2DChannelMap_FlagBad);
261 plot2D_Bad_OADB->DrawCopy(
"colz");
263 plot2D_Dead_OADB->SetTitle(
"OADB/Local File (Dead)");
264 plot2D_Dead_OADB->Divide(h2DChannelMap_FlagDead);
265 plot2D_Dead_OADB->DrawCopy(
"colz");
270 if(iRun==0)C2 ->Print(Form(
"%s(",summaryPDF.Data()));
271 else C2 ->Print(Form(
"%s(",summaryPDF.Data()));
272 if(iRun==nRuns-1)C4 ->Print(Form(
"%s)",summaryPDF.Data()));
273 else C4 ->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;
299 cout<<
"o o o Open .txt file with run indices. Name = " << cellList << endl;
300 FILE *pFile = fopen(cellList.Data(),
"r");
303 cout<<
"couldn't open file "<<cellList<<
"!"<<endl;
310 std::vector<Int_t> cellIdVec;
313 ncols = fscanf(pFile,
" %d ",&q);
316 cellIdVec.push_back(q);
321 std::sort (cellIdVec.begin(), cellIdVec.end());
322 Int_t nCells=cellIdVec.size();
326 TString path = Form(
"/Users/Eliane/Software/BadChannelAnalysis/AnalysisOutput/%s/Train_%i/Version%s",period.Data(),trainNo,version.Data());
327 TString rootFileName= Form(
"%s_INT7_Histograms_V%s.root",period.Data(),version.Data());
328 TFile* outputRoot = TFile::Open(Form(
"%s/%s",path.Data(),rootFileName.Data()));
329 if(!outputRoot)cout<<
"File "<<outputRoot->GetName()<<
" does not exist"<<endl;
330 TH2F* h2DAmp =(
TH2F*)outputRoot->Get(
"hCellAmplitude");
331 TH2F* h2DRatio =(
TH2F*)outputRoot->Get(
"ratio2DAmp");
333 TCanvas *c1 =
new TCanvas(1);
336 h2DAmp->Draw(
"colz");
338 h2DRatio->Draw(
"colz");
342 Int_t totalperCv = 16;
343 Int_t nPad = TMath::Sqrt(totalperCv);
344 Int_t nCv = nCells/totalperCv+1;
347 cout<<
" o create: "<<nCv<<
" Canvases with "<<nPad*nPad<<
" pads"<<endl;
349 TCanvas **cComp =
new TCanvas*[nCv];
350 TCanvas **cCompR =
new TCanvas*[nCv];
351 for(
Int_t i=0;i<nCv;i++)
353 cComp[i] =
new TCanvas(TString::Format(
"CompareGood%d", i), TString::Format(
"V) Candidates (%d/%d)", i+1, nCv), 1000,750);
354 cComp[i] ->Divide(nPad,nPad,0.001,0.001);
355 cCompR[i] =
new TCanvas(TString::Format(
"CompareGoodR%d", i), TString::Format(
"V) Ratio (%d/%d)", i+1, nCv), 1000,750);
356 cCompR[i] ->Divide(nPad,nPad,0.001,0.001);
358 cout<<
" o Fill Canvases with bad cells canvases"<<endl;
360 for(
Int_t icell = 0; icell < nCells; icell++)
362 TH1D *htmpCellAllRuns =h2DAmp->ProjectionX(TString::Format(
"hIDProj_cell%d", icell), icell+1, icell+1);
363 cout<<
"cell number:"<<cellIdVec.at(icell)<<endl;
364 cComp[(icell)/totalperCv]->cd(((icell)%totalperCv)+1)->SetLogy();
367 htmpCellAllRuns->Draw(
"hist");
370 TH1D *htmpCellRatioAllRuns =h2DRatio->ProjectionX(TString::Format(
"hIDRatioProj_cell%d", icell), icell+1, icell+1);
371 cout<<
"cell number:"<<cellIdVec.at(icell)<<endl;
372 cCompR[(icell)/totalperCv]->cd(((icell)%totalperCv)+1)->SetLogy();
375 htmpCellRatioAllRuns->Draw(
"hist");
380 for(
Int_t can=0;can<nCv;can++)
387 cComp[can] ->Print(Form(
"%s(",pdfName.Data()));
389 else if(can==(nCv-1))
393 cComp[can] ->Print(Form(
"%s)",pdfName.Data()));
398 cComp[can] ->Print(Form(
"%s",pdfName.Data()));
void SetRunNumber(Int_t run)
TLatex * text[5]
option to what and if export to output file
void Test_OADB(TString period="LHC15n", Int_t trainNo=603, TString version="INT7Emc", TString runList="")
AliEMCALGeometry * GetEMCALGeometry() const
void Sort_RunNumbers(TString period="LHC15n", Int_t trainNo=603, TString runList="")
Class with utils specific to calorimeter clusters/cells.
void AccessGeometry(AliVEvent *inputEvent)
void Plot_CellList(TString period="LHC15n", Int_t trainNo=603, TString version="5", TString cellList="")
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