22 #include <Riostream.h>
30 #include "AliEMCALGeometry.h"
32 #include "AliAODEvent.h"
33 #include "AliOADBContainer.h"
44 cout<<
"o o o Open .txt file with run indices. Name = " << runList << endl;
45 TString RunPath1 = Form(
"./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList.Data());
46 cout<<
"o o o Open .txt file with run indices = " << RunPath1 << endl;
47 FILE *pFile1 = fopen(RunPath1.Data(),
"r");
50 cout<<
"couldn't open file "<<RunPath1<<
"!"<<endl;
56 std::vector<Int_t> RunIdVec1;
59 ncols1 = fscanf(pFile1,
" %d ",&q1);
61 RunIdVec1.push_back(q1);
65 std::sort (RunIdVec1.begin(), RunIdVec1.end());
67 cout<<
"Runs in Order: "<<endl;
68 for(
Int_t iRun = 0; iRun < (
Int_t)RunIdVec1.size(); iRun++)
70 cout<<RunIdVec1.at(iRun)<<
", "<<flush;
82 gStyle->SetOptStat(0);
88 Int_t cellColumnAbs,cellRowAbs,trash,cellID;
89 TString summaryPDF=Form(
"./AnalysisOutput/%s/Train_%i/OADB_Summary.pdf",period.Data(),trainNo);
93 cout<<
"o o o Open .txt file with run indices. Name = " << runList << endl;
94 TString RunPath = Form(
"./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList.Data());
95 cout<<
"o o o Open .txt file with run indices = " << RunPath << endl;
96 FILE *pFile = fopen(RunPath.Data(),
"r");
99 cout<<
"couldn't open file "<<RunPath<<
"!"<<endl;
106 std::vector<Int_t> RunIdVec;
109 ncols = fscanf(pFile,
" %d ",&q);
112 RunIdVec.push_back(q);
117 std::sort (RunIdVec.begin(), RunIdVec.end());
118 Int_t nRuns=RunIdVec.size();
122 TString fBasePath=
"/Users/Eliane/Software/BadChannelAnalysis";
124 AliOADBContainer *cont=
new AliOADBContainer(
"");
125 cont->InitFromFile(Form(
"%s/EMCALBadChannels.root",fBasePath.Data()),
"AliEMCALBadChannels");
130 TString path = Form(
"/Users/Eliane/Software/BadChannelAnalysis/AnalysisOutput/%s/Train_%i/Version%i",period.Data(),trainNo,version);
131 TString rootFileName= Form(
"%s_INT7_Histograms_V%i.root",period.Data(),version);
132 TFile* outputRoot = TFile::Open(Form(
"%s/%s",path.Data(),rootFileName.Data()));
134 if(!outputRoot)cout<<
"File "<<outputRoot->GetName()<<
" does not exist"<<endl;
135 TH2F* h2DChannelMap_FlagBad =(
TH2F*)outputRoot->Get(
"2DChannelMap_Flag2");
136 TH2F* h2DChannelMap_FlagDead=(
TH2F*)outputRoot->Get(
"2DChannelMap_Flag1");
150 Int_t fNMaxCols = 48;
151 Int_t fNMaxRows = 24;
153 Int_t fNMaxColsAbs = 2*fNMaxCols;
156 histoName = Form(
"2DChannelMap_Flag_Bad");
157 TH2F *plot2D_Bad_OADB =
new TH2F(histoName,histoName,fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
159 plot2D_Bad_OADB->GetXaxis()->SetTitle(
"cell column (#eta direction)");
160 plot2D_Bad_OADB->GetYaxis()->SetTitle(
"cell row (#phi direction)");
161 histoName = Form(
"2DChannelMap_Flag_Dead");
162 TH2F *plot2D_Dead_OADB =
new TH2F(histoName,histoName,fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
164 plot2D_Dead_OADB->GetXaxis()->SetTitle(
"cell column (#eta direction)");
165 plot2D_Dead_OADB->GetYaxis()->SetTitle(
"cell row (#phi direction)");
169 TCanvas* C2 =
new TCanvas(
"CompareCanvas",
"Compare OADB to LocalFile",900,900);
171 TCanvas* C4 =
new TCanvas(
"Subtraction of OADB-Orig.",
"Subtraction of OADB-Orig.",900,900);
173 TLatex* textA =
new TLatex(0.5,0.8,
"If empty -> good!");
174 textA->SetTextSize(0.04);
175 textA->SetTextColor(1);
178 cout<<
"Checking "<<nRuns<<
" runs: "<<endl;
179 for(
Int_t iRun = 0; iRun < nRuns; iRun++)
182 if(iRun%5==0)cout<<
"."<<flush;
183 if(iRun%20==0)cout<<
"Run No."<<iRun<<endl;
185 if(!recal)cout<<
"Error - No bad map for run Number "<<RunIdVec.at(iRun)<<
" online!!"<<endl;
187 plot2D_Bad_OADB ->Reset();
188 plot2D_Dead_OADB->Reset();
189 for(
Int_t iSM = 0; iSM < nSM; iSM++)
192 h[iSM]=(TH1C *)recal->FindObject(Form(
"EMCALBadChannelMap_Mod%d",iSM));
194 for(
Int_t column=0;column<48;column++)
196 for(
Int_t row=0;row<24;row++)
200 cellID=geom->GetAbsCellIdFromCellIndexes(iSM,inRow,inCol);
202 if(h[iSM]->GetBinContent(column,row)>1)
204 plot2D_Bad_OADB->SetBinContent(cellColumnAbs,cellRowAbs,1);
206 if(h[iSM]->GetBinContent(column,row)==1)
208 plot2D_Dead_OADB->SetBinContent(cellColumnAbs,cellRowAbs,1);
214 TLatex* text=
new TLatex(0.15,0.85,Form(
"Run Number %i",RunIdVec.at(iRun)));
215 text->SetTextSize(0.05);
217 text->SetTextColor(1);
218 text->SetTextAngle(0);
221 plot2D_Bad_OADB->SetTitle(
"Bad Cells OADB");
222 plot2D_Bad_OADB->DrawCopy(
"colz");
225 plot2D_Dead_OADB->SetTitle(
"Dead Cells OADB");
226 plot2D_Dead_OADB->DrawCopy(
"colz");
228 h2DChannelMap_FlagBad->SetTitle(
"Bad Cells LocalFile");
229 h2DChannelMap_FlagBad->DrawCopy(
"colz");
231 h2DChannelMap_FlagDead->SetTitle(
"Dead Cells LocalFile");
232 h2DChannelMap_FlagDead->DrawCopy(
"colz");
236 plot2D_Bad_OADB->SetTitle(
"OADB-Local File (Bad)");
237 plot2D_Bad_OADB->Add(h2DChannelMap_FlagBad,-1);
238 plot2D_Bad_OADB->DrawCopy(
"colz");
239 plot2D_Bad_OADB->Add(h2DChannelMap_FlagBad,+1);
243 plot2D_Dead_OADB->SetTitle(
"OADB-Local File (Dead)");
244 plot2D_Dead_OADB->Add(h2DChannelMap_FlagDead,-1);
245 plot2D_Dead_OADB->DrawCopy(
"colz");
246 plot2D_Dead_OADB->Add(h2DChannelMap_FlagDead,+1);
249 plot2D_Bad_OADB->SetTitle(
"OADB/Local File (Bad)");
250 plot2D_Bad_OADB->Divide(h2DChannelMap_FlagBad);
251 plot2D_Bad_OADB->DrawCopy(
"colz");
253 plot2D_Dead_OADB->SetTitle(
"OADB/Local File (Dead)");
254 plot2D_Dead_OADB->Divide(h2DChannelMap_FlagDead);
255 plot2D_Dead_OADB->DrawCopy(
"colz");
260 if(iRun==0)C2 ->Print(Form(
"%s(",summaryPDF.Data()));
261 else C2 ->Print(Form(
"%s(",summaryPDF.Data()));
262 if(iRun==nRuns-1)C4 ->Print(Form(
"%s)",summaryPDF.Data()));
263 else C4 ->Print(Form(
"%s",summaryPDF.Data()));
void SetRunNumber(Int_t run)
void Test_OADB(TString period="LHC15n", Int_t trainNo=603, Int_t version=5, 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)
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