AliPhysics  239578e (239578e)
helperMacrosBC.C
Go to the documentation of this file.
1 
21 // --- ROOT system ---
22 #include <Riostream.h>
23 #include <TFile.h>
24 #include <TH1.h>
25 #include <TROOT.h>
26 #include <TStyle.h>
27 #include <TLatex.h>
28 #include <TCanvas.h>
29 
30 
31 // --- ANALYSIS system ---
32 #include "AliEMCALGeometry.h" //include when compile
33 #include "AliCalorimeterUtils.h" //include when compile
34 #include "AliAODEvent.h" //include when compile
35 
36 
37 //definition of methods
38 void SetHisto(TH1 *Histo,TString Xtitel,TString Ytitel,Bool_t longhisto);
39 Bool_t IsCellMaskedByHand(Int_t cell, std::vector<Int_t> cellVector);
40 void CreateCellCompPDF(TH2F* hAmpIDMasked, std::vector<Int_t> cellVector, TH1* goodCellsMerged, TH1* goodCellsRbR, TString pdfName);
41 void Plot2DCells(TString Block, Int_t runNo, std::vector<Int_t> cellVectorMergeB, std::vector<Int_t> cellVectorMergeA);
42 
47 void Compare_RunNumbers(TString period="LHC15n",Int_t trainNo=603,TString runList1="",TString runList2="")
48 {
49  //......................................................
50  //..PT. II open the 1st text file and save the run IDs into the RunId[] array
51  //......................................................
52  cout<<"o o o Open .txt file with run indices. Name = " << runList1 << endl;
53  TString RunPath1 = Form("./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList1.Data());
54  cout<<"o o o Open .txt file with run indices = " << RunPath1 << endl;
55  FILE *pFile1 = fopen(RunPath1.Data(), "r");
56  if(!pFile1)
57  {
58  cout<<"couldn't open file "<<RunPath1<<"!"<<endl;
59  return;
60  }
61  Int_t q1;
62  Int_t ncols1;
63  Int_t nlines1 = 0 ;
64  std::vector<Int_t> RunIdVec1;
65  while (1)
66  {
67  ncols1 = fscanf(pFile1," %d ",&q1);
68  if (ncols1< 0) break;
69  RunIdVec1.push_back(q1);
70  nlines1++;
71  }
72  fclose(pFile1);
73  std::sort (RunIdVec1.begin(), RunIdVec1.end());
74  //......................................................
75  //..PT. II open the 2nd text file and save the run IDs into the RunId[] array
76  //......................................................
77  cout<<"o o o Open .txt file with run indices. Name = " << runList2 << endl;
78  TString RunPath2 = Form("./AnalysisInput/%s/Train_%i/%s",period.Data(),trainNo,runList2.Data());
79  cout<<"o o o Open .txt file with run indices = " << RunPath2 << endl;
80  FILE *pFile2 = fopen(RunPath2.Data(), "r");
81  if(!pFile2)
82  {
83  cout<<"couldn't open file "<<RunPath2<<"!"<<endl;
84  return;
85  }
86  Int_t q2;
87  Int_t ncols2;
88  Int_t nlines2 = 0 ;
89  std::vector<Int_t> RunIdVec2;
90  while (1)
91  {
92  ncols2 = fscanf(pFile2," %d ",&q2);
93  if (ncols2< 0) break;
94  RunIdVec2.push_back(q2);
95  nlines2++;
96  }
97  fclose(pFile2);
98  std::sort (RunIdVec2.begin(), RunIdVec2.end());
99 
100  //......................................................
101  //..Find different elements in the runlists
102  //......................................................
103  //find runnumbers present in both lists
104 
105  //this part is not yet working
106  //what it should do is find unique elements.
107  //means I compare list 1 and list 2 and I am interested in elements
108  //that are exclusivley in list1 or exclusivley in list2
109 
110  std::vector<Int_t> RunIdVecSum;
111  cout<<"Elements in Vector Sum a ("<<RunIdVecSum.size()<<")"<<endl;
112  RunIdVecSum.insert( RunIdVecSum.end(),RunIdVec1.begin(), RunIdVec1.end());
113  cout<<"Elements in Vector Sum b("<<RunIdVecSum.size()<<")"<<endl;
114  RunIdVecSum.insert( RunIdVecSum.end(),RunIdVec2.begin(), RunIdVec2.end());
115  cout<<"Elements in Vector Sum c("<<RunIdVecSum.size()<<")"<<endl;
116  std::sort (RunIdVecSum.begin(), RunIdVecSum.end());
117 
118  // using default comparison:
119  std::vector<int>::iterator it;
120  it = std::unique (RunIdVecSum.begin(), RunIdVecSum.end());
121  RunIdVecSum.resize( std::distance(RunIdVecSum.begin(),it) );
122  cout<<"Elements in Vector Sum d("<<RunIdVecSum.size()<<")"<<endl;
123 
124 
125  cout<<"Elements in Vector 1 ("<<RunIdVec1.size()<<")"<<endl;
126  cout<<"Elements in Vector 2 ("<<RunIdVec2.size()<<")"<<endl;
127 
128  cout<<"##Unique elements in vector(not really) ("<<RunIdVecSum.size()<<"):"<<endl;
129  for(Int_t i=0;i<(Int_t)RunIdVecSum.size();i++)
130  {
131  cout<<RunIdVecSum.at(i)<<", "<<flush;
132  }
133  cout<<endl;
134 }
139 void Get_RowCollumnID(Int_t runNum= 244411,Int_t inputCellID=-1,Int_t inputRow=-1,Int_t inputCollumn=-1,Int_t inputSM=-1)
140 {
141  //......................................................
142  //..Initialize EMCal/DCal geometry
143  AliCalorimeterUtils* fCaloUtils = new AliCalorimeterUtils();
144  //..Create a dummy event for the CaloUtils
145  AliAODEvent* aod = new AliAODEvent();
146  fCaloUtils->SetRunNumber(runNum);
147  fCaloUtils->AccessGeometry(aod);
148  AliEMCALGeometry * geom = fCaloUtils->GetEMCALGeometry();
149 
150  //..get row collumn from cell ID
151  Int_t cellColumn=0,cellRow=0;
152  Int_t cellColumnAbs=0,cellRowAbs=0;
153  Int_t cellID=0;
154  Int_t trash;
155 
156  cout<<"...................................................."<<endl;
157  cout<<""<<endl;
158  if(inputCellID!=-1)
159  {
160  fCaloUtils->GetModuleNumberCellIndexesAbsCaloMap(inputCellID,0,cellColumn,cellRow,trash,cellColumnAbs,cellRowAbs);
161  cout<<"Cell Id provided: "<<inputCellID<<endl;
162  cout<<"This corresponds to absolute row: "<<cellRowAbs<<" and absolute collumn: "<<cellColumnAbs<<endl;
163  }
164  else if(inputRow!=-1 && inputCollumn!=-1 && inputSM!=-1)
165  {
166  cout<<"Supermodule provided: "<<inputSM<<endl;
167  cout<<"Absolute row provided: "<< inputRow<<" and absolute collumn provided : "<<inputCollumn<<endl;
168  cellID=geom->GetAbsCellIdFromCellIndexes(inputSM,inputRow,inputCollumn);
169  cout<<"This corresponds to Cell Id: "<<cellID<<endl;
170  }
171  else cout<<"need more information!"<<endl;
172  cout<<""<<endl;
173  cout<<"...................................................."<<endl;
174 }
175 
181 //________________________________________________________________________
182 void Compare2Blocks(TString period="LHC15n",Int_t trainNo=603,Int_t versionA=0, Int_t versionB=1)
183 {
184  gROOT->ProcessLine("gErrorIgnoreLevel = kWarning;"); //..to supress a lot of standard output
185  gStyle->SetOptStat(0); //..Do not plot stat boxes
186  gStyle->SetPadLeftMargin(0.13);
187  gStyle->SetPadRightMargin(0.1);
188  gStyle->SetPadBottomMargin(0.12);
189  gStyle->SetPadTopMargin(0.06);
190 
191  Int_t noOfCells=17674;
192  Int_t nBadCellMerged =noOfCells;
193  Int_t nBadCellRbR =noOfCells;
194  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};
195 
196  //..............................................
197  //..manually disable cells
198  std::vector<Int_t> badcellsBlock1;
199  //badcellsBlock1.insert(badcellsBlock1.end(),{6644,6655,10140,12036,12037,12038,12039,12040,12041,12926,13067,13066,13125});
200  //badcellsBlock1.insert(badcellsBlock1.end(),{13133,13483,13971,13978,14116,14118,14122,14411,14593,14599,14600,14606,14699});
201 
202  std::vector<Int_t> vOnlyMaskedInMergedA;
203  std::vector<Int_t> vOnlyMaskedInMergedB;
204 
205  //......................................................
206  //..Get the .root file from masking runs in Version1
207  //......................................................
208  cout<<"** Open file A with merged runlist analysis: "<<endl;
209  TString pathA = Form("./AnalysisOutput/%s/Train_%i/Version%i",period.Data(),trainNo,versionA);
210  TString rootFileNameA= Form("%s_INT7_Histograms_V%i.root",period.Data(),versionA);
211  TFile* outputRootA = TFile::Open(Form("%s/%s",pathA.Data(),rootFileNameA.Data()));
212  if(!outputRootA)cout<<"File "<<outputRootA->GetName()<<" does not exist"<<endl;
213  else cout<<"file A: "<<outputRootA->GetName()<<endl;
214 
215  //..get the necessary histograms
216  TH2F* hCellAmplitudeA =(TH2F*)outputRootA->Get("hCellAmplitude");
217  TH1F* hnEventsA =(TH1F*)outputRootA->Get("hNEvents");
218  hCellAmplitudeA->Scale(hnEventsA->GetBinContent(1));
219  TH2F* hCellAmplitudeBlockMaskA=(TH2F*)hCellAmplitudeA->Clone("hCellAmplitudeMask");
220  TH1F* hCellFlagA =(TH1F*)outputRootA->Get("fhCellFlag");
221 
222  //......................................................
223  //..Get the .root file from masking runs in Version2
224  //......................................................
225  cout<<endl;
226  cout<<"**Open file B with merged runlist analysis: "<<endl;
227  TString pathB = Form("./AnalysisOutput/%s/Train_%i/Version%i",period.Data(),trainNo,versionB);
228  TString rootFileNameB= Form("%s_INT7_Histograms_V%i.root",period.Data(),versionB);
229  TFile* outputRootB = TFile::Open(Form("%s/%s",pathB.Data(),rootFileNameB.Data()));
230  if(!outputRootB)cout<<"File "<<outputRootB->GetName()<<" does not exist"<<endl;
231  else cout<<"file B: "<<outputRootB->GetName()<<endl;
232 
233  //..get the necessary histograms
234  TH2F* hCellAmplitudeB =(TH2F*)outputRootB->Get("hCellAmplitude");
235  TH1F* hnEventsB =(TH1F*)outputRootB->Get("hNEvents");
236  hCellAmplitudeB->Scale(hnEventsB->GetBinContent(1));
237  TH2F* hCellAmplitudeBlockMaskB=(TH2F*)hCellAmplitudeB->Clone("hCellAmplitudeMask");
238  TH1F* hCellFlagB =(TH1F*)outputRootB->Get("fhCellFlag");
239 
240  //......................................................
241  //..mask the bad cells according to both versions
242  //......................................................
243  Int_t maskA=0;
244  Int_t maskB=0;
245 
246  for(Int_t ic = 0; ic < noOfCells; ic++)
247  {
248  //......................................................
249  //..Part A - analyzed as one merged runblock
250  //......................................................
251  maskA=0;
252  maskA=IsCellMaskedByHand(ic,badcellsBlock1);
253 
254  //..mask the bad cells
255  for (Int_t amp = 1; amp <= hCellAmplitudeBlockMaskA->GetNbinsX(); amp++)
256  {
257  if(hCellFlagA->GetBinContent(ic+1)>0 || maskA==1)
258  {
259  hCellAmplitudeBlockMaskA->SetBinContent(amp,ic+1,0);
260  if(amp==1)nBadCellMerged--;
261  }
262  }
263 
264  //......................................................
265  //..Part B - analyzed run-by-run, corrected and masked in block
266  //......................................................
267  maskB=0;
268  maskB=IsCellMaskedByHand(ic,badcellsBlock1);
269 
270  //..mask the bad cells
271  for (Int_t amp = 1; amp <= hCellAmplitudeBlockMaskB->GetNbinsX(); amp++)
272  {
273  if(hCellFlagB->GetBinContent(ic+1)>0 || maskB==1)
274  {
275  hCellAmplitudeBlockMaskB->SetBinContent(amp,ic+1,0);
276  if(amp==1)nBadCellRbR--;
277  }
278  }
279 
280  //......................................................
281  //..Compare the different channels that are marked in the two versions
282  //......................................................
283  if(!IsCellMaskedByHand(ic,badcellsBlock1))
284  {
285  if(hCellFlagA->GetBinContent(ic+1)>0 && hCellFlagB->GetBinContent(ic+1)==0)vOnlyMaskedInMergedA.push_back(ic);
286  if(hCellFlagA->GetBinContent(ic+1)==0 && hCellFlagB->GetBinContent(ic+1)>0) vOnlyMaskedInMergedB.push_back(ic);
287  }
288  }
289  //..merged runblock
290  TH1* projMaskedCellsA = hCellAmplitudeBlockMaskA->ProjectionX("MaskedCellsMergedBlockA");
291  TH1* projMaskedCellsB = hCellAmplitudeBlockMaskB->ProjectionX("MaskedCellsMergedBlockB");
292 
293  //......................................................
294  //..Plot results
295  //......................................................
296  TCanvas* C1 = new TCanvas("-1-","Projections of A and B",900,900);
297  C1->Divide(2,2);
298  C1->cd(1)->SetLogy();
299  SetHisto(projMaskedCellsA,"","hits/event",0);
300  projMaskedCellsA->DrawCopy("hist");
301  projMaskedCellsB->SetLineColor(8);
302  projMaskedCellsB->DrawCopy("same hist");
303  C1->cd(2);
304  projMaskedCellsA->Divide(projMaskedCellsB);
305  SetHisto(projMaskedCellsA,"","Merged Version A/Merged Version B",0);
306  projMaskedCellsA->DrawCopy("hist");
307  projMaskedCellsA->Multiply(projMaskedCellsB);
308 
309  TLatex* textSM = new TLatex(0.1,0.1,"*test*");
310  textSM->SetTextSize(0.06);
311  textSM->SetTextColor(1);
312  textSM->SetNDC();
313 
314  TCanvas *c1_projSM = new TCanvas("-1a-","Projections of A and B per SM",1200,900);
315  c1_projSM->Divide(5,4,0.001,0.001);
316  TH1* projEnergyMaskASM[20];
317  TH1* projEnergyMaskBSM[20];
318  for(Int_t iSM=0;iSM<20;iSM++)
319  {
320  c1_projSM->cd(iSM+1)->SetLogy();
321  gPad->SetTopMargin(0.03);
322  gPad->SetBottomMargin(0.11);
323  projEnergyMaskASM[iSM] = hCellAmplitudeBlockMaskA->ProjectionX(Form("%sMask_ProjSM%i",hCellAmplitudeBlockMaskA->GetName(),iSM),array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1);
324  projEnergyMaskASM[iSM]->SetTitle("");
325  projEnergyMaskASM[iSM]->SetXTitle(Form("Cell Energy [GeV], SM%i",iSM));
326  projEnergyMaskASM[iSM]->GetYaxis()->SetTitleOffset(1.6);
327  projEnergyMaskASM[iSM]->GetYaxis()->SetLabelSize(0.06);
328  projEnergyMaskASM[iSM]->GetXaxis()->SetLabelSize(0.06);
329  projEnergyMaskASM[iSM]->GetXaxis()->SetRangeUser(0,20);
330  projEnergyMaskASM[iSM]->GetXaxis()->SetTitleSize(0.06);
331  projEnergyMaskASM[iSM]->SetLineColor(kGreen+1);
332  projEnergyMaskASM[iSM]->DrawCopy(" hist");
333 
334  projEnergyMaskBSM[iSM] = hCellAmplitudeBlockMaskB->ProjectionX(Form("%s_ProjSM%i",hCellAmplitudeBlockMaskB->GetName(),iSM),array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1);
335  projEnergyMaskBSM[iSM]->DrawCopy("same hist");
336 
337  textSM->SetTitle(Form("Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
338  textSM->DrawLatex(0.2,0.8,Form("Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
339  }
340  TCanvas *c1_projSMR = new TCanvas("-1b-","Ratio of A/B per SM",1200,900);
341  c1_projSMR->Divide(5,4,0.001,0.001);
342  TH1* projEnergyMaskSM[20];
343  TH1* projEnergySM[20];
344  for(Int_t iSM=0;iSM<20;iSM++)
345  {
346  c1_projSMR->cd(iSM+1);
347  gPad->SetTopMargin(0.03);
348  gPad->SetBottomMargin(0.11);
349  projEnergyMaskASM[iSM]->Divide(projEnergyMaskBSM[iSM]);
350  projEnergyMaskASM[iSM]->SetLineColor(kGray+1);
351  projEnergyMaskASM[iSM]->DrawCopy(" hist");
352 
353  textSM->SetTitle(Form("Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
354  textSM->DrawLatex(0.2,0.8,Form("Includes cell IDs %d-%d",array_StartCellSM_Value[iSM],array_StartCellSM_Value[iSM+1]-1));
355  }
356 
357  TCanvas* C3 = new TCanvas("-3-","2D of A and B",900,900);
358  C3->Divide(2,2);
359  C3->cd(1)->SetLogz();
360  SetHisto(hCellAmplitudeBlockMaskA,"","cell ID",0);
361  hCellAmplitudeBlockMaskA->DrawCopy("colz");
362  C3->cd(2)->SetLogz();
363  SetHisto(hCellAmplitudeBlockMaskB,"","cell ID",0);
364  hCellAmplitudeBlockMaskB->DrawCopy("colz");
365 
366 
367  //......................................................
368  //..Print out compared cells and plot the spectra
369  //......................................................
370  projMaskedCellsA->Scale(1.0/nBadCellMerged);
371  projMaskedCellsB->Scale(1.0/nBadCellRbR);
372 
373 
374  cout<<" Cells masked in version A and not in version B ("<<vOnlyMaskedInMergedA.size()<<"):"<<endl;
375  for(Int_t i=0; i<(Int_t)vOnlyMaskedInMergedA.size();i++)
376  {
377  cout<<vOnlyMaskedInMergedA.at(i)<<","<<flush;
378  }
379  cout<<endl;
380  TString outNameA = Form("./AnalysisOutput/%s/Train_%i/cOnlyMergedBlockA.pdf",period.Data(),trainNo);
381  CreateCellCompPDF(hCellAmplitudeBlockMaskB,vOnlyMaskedInMergedA,projMaskedCellsA,projMaskedCellsB,outNameA);
382  cout<<" Cells masked in version B and not in version A ("<<vOnlyMaskedInMergedB.size()<<"):"<<endl;
383  for(Int_t i=0; i<(Int_t)vOnlyMaskedInMergedB.size();i++)
384  {
385  cout<<vOnlyMaskedInMergedB.at(i)<<","<<flush;
386  }
387  cout<<endl;
388  TString outNameB = Form("./AnalysisOutput/%s/Train_%i/cOnlyMergedBlockB.pdf",period.Data(),trainNo);
389  CreateCellCompPDF(hCellAmplitudeBlockMaskA,vOnlyMaskedInMergedB,projMaskedCellsA,projMaskedCellsB,outNameB);
390 
391  //......................................................
392  //..build two dimensional histogram with cells rejected from
393  //..the one or the other method
394  //......................................................
395  Plot2DCells("-",244917,vOnlyMaskedInMergedB,vOnlyMaskedInMergedA);
396 }
397 //-----------------------------------------------------------
398 // All functions below this point are helping the
399 // Compare2Blocks function
400 //-----------------------------------------------------------
401 
405 void Plot2DCells(TString Block, Int_t runNo, std::vector<Int_t> cellVectorMergeB, std::vector<Int_t> cellVectorMergeA)
406 {
407  //......................................................
408  //..Initialize EMCal/DCal geometry
409  AliCalorimeterUtils* fCaloUtils = new AliCalorimeterUtils();
410  //..Create a dummy event for the CaloUtils
411  AliAODEvent* aod = new AliAODEvent();
412  fCaloUtils->SetRunNumber(runNo);
413  fCaloUtils->AccessGeometry(aod);
414  //......................................................
415  //..setings for the 2D histogram
416  Int_t nModules=fCaloUtils->GetEMCALGeometry()->GetNumberOfSuperModules();
417  Int_t fNMaxColsAbs = 2*48;
418  Int_t fNMaxRowsAbs = Int_t (nModules/2)*24; //multiply by number of supermodules
419 
420  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);
421  plot2D_VersionB->GetXaxis()->SetTitle("cell column (#eta direction)");
422  plot2D_VersionB->GetYaxis()->SetTitle("cell row (#phi direction)");
423  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);
424  plot2D_VersionA->GetXaxis()->SetTitle("cell column (#eta direction)");
425  plot2D_VersionA->GetYaxis()->SetTitle("cell row (#phi direction)");
426 
427  Int_t cellColumn=0,cellRow=0;
428  Int_t cellColumnAbs=0,cellRowAbs=0;
429  Int_t trash;
430 
431  for(Int_t i = 0; i < (Int_t)cellVectorMergeB.size(); i++)
432  {
433  Int_t cell=cellVectorMergeB.at(i);
434  //..Do that only for cell ids also accepted by the code
435  if(!fCaloUtils->GetEMCALGeometry()->CheckAbsCellId(cell))continue;
436 
437  //..Get Row and Collumn for cell ID c
438  fCaloUtils->GetModuleNumberCellIndexesAbsCaloMap(cell,0,cellColumn,cellRow,trash,cellColumnAbs,cellRowAbs);
439  if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
440  {
441  cout<<"Problem! wrong calculated number of max col and max rows"<<endl;
442  cout<<"current col: "<<cellColumnAbs<<", max col"<<fNMaxColsAbs<<endl;
443  cout<<"current row: "<<cellRowAbs<<", max row"<<fNMaxRowsAbs<<endl;
444  }
445  plot2D_VersionB->Fill(cellColumnAbs,cellRowAbs);
446  }
447  for(Int_t i = 0; i < (Int_t)cellVectorMergeA.size(); i++)
448  {
449  Int_t cell=cellVectorMergeA.at(i);
450  //..Do that only for cell ids also accepted by the code
451  if(!fCaloUtils->GetEMCALGeometry()->CheckAbsCellId(cell))continue;
452 
453  //..Get Row and Collumn for cell ID c
454  fCaloUtils->GetModuleNumberCellIndexesAbsCaloMap(cell,0,cellColumn,cellRow,trash,cellColumnAbs,cellRowAbs);
455  if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
456  {
457  cout<<"Problem! wrong calculated number of max col and max rows"<<endl;
458  cout<<"current col: "<<cellColumnAbs<<", max col"<<fNMaxColsAbs<<endl;
459  cout<<"current row: "<<cellRowAbs<<", max row"<<fNMaxRowsAbs<<endl;
460  }
461  plot2D_VersionA->Fill(cellColumnAbs,cellRowAbs,1);
462  }
463  //. . . . . . . . . . . . . . . . . . . .
464  TCanvas *c1 = new TCanvas(Form("2DMapForBlock%s",Block.Data()),Form("2DMapForBlock%s",Block.Data()),900,500);
465  c1->ToggleEventStatus();
466  c1->Divide(2);
467  c1->cd(1);
468  plot2D_VersionB->Draw("colz");
469  c1->cd(2);
470  plot2D_VersionA->Draw("colz");
471 }
475 Bool_t IsCellMaskedByHand(Int_t cell, std::vector<Int_t> cellVector)
476 {
477  Bool_t bad=0;
478  for(Int_t i=0; i<(Int_t)cellVector.size();i++)
479  {
480  if(cell==cellVector.at(i))bad=1;
481  }
482 
483  return bad;
484 }
488 void CreateCellCompPDF(TH2F* hAmpIDMasked, std::vector<Int_t> cellVector,TH1* goodCellsMerged, TH1* goodCellsRbR, TString pdfName)
489 {
490  Int_t NoOfCells=cellVector.size();
491  Bool_t firstCanvas=0;
492  TString name;
493  /*TLatex* textA = new TLatex(0.2,0.8,"*test*");
494  textA->SetTextSize(0.08);
495  textA->SetTextColor(1);
496  textA->SetNDC();
497  */
498  for(Int_t cell=0;cell<NoOfCells;cell++)
499  {
500  TString internal_pdfName=pdfName;
501  TCanvas *c1;
502  if(cell%9==0)
503  {
504  c1 = new TCanvas(Form("badcells%i",cell),"badcells",1000,750);
505  if(cellVector.size() > 6) c1->Divide(3,3);
506  else if (cellVector.size() > 3) c1->Divide(3,2);
507  else c1->Divide(3,1);
508  }
509  TH1 *hCell = hAmpIDMasked->ProjectionX(Form("Cell %d",cellVector.at(cell)),cellVector.at(cell)+1,cellVector.at(cell)+1);
510  TH1 *hCell2 = (TH1*)hCell->Clone("hCell2");
511 
512  c1->cd(cell%9 + 1)->SetLogy();
513  hCell->Divide(goodCellsRbR);
514  hCell2->Divide(goodCellsMerged);
515 
516  hCell->SetLineColor(kBlue-8);
517  hCell2->SetLineColor(kRed-9);
518  hCell->GetXaxis()->SetTitle("E (GeV)");
519  hCell->GetYaxis()->SetTitle("cell/mean of good");
520  hCell->GetXaxis()->SetRangeUser(0.,10.);
521  hCell->SetLineWidth(1) ;
522  hCell->SetTitle(Form("Cell No. %d",cellVector.at(cell)));
523  hCell->Draw("hist");
524  hCell2->DrawCopy("same hist");
525 
526  //textA->SetTitle(Form("Cell No. %d",cellVector.at(cell)));
527  //textA->Draw();
528 
529  //..page is full or end of loop
530  if(cell%9==8 ||cell == NoOfCells-1)
531  {
532  if(cell == NoOfCells-1)
533  {
534  //internal_pdfName +=")";
535  c1->Print(Form("%s)",pdfName.Data()));
536  }
537  else if(firstCanvas==0)
538  {
539  internal_pdfName +="(";
540  c1->Print(internal_pdfName.Data());
541  firstCanvas=1;
542  }
543  else
544  {
545  c1->Print(internal_pdfName.Data());
546  }
547  delete c1;
548  }
549  }
550 
551 }
556 void SetHisto(TH1 *Histo,TString Xtitel,TString Ytitel,Bool_t longhisto)
557 {
558  Histo->SetStats(0);
559  Histo->SetTitle("");
560  if(longhisto==0)
561  {
562  Histo->GetYaxis()->SetTitleOffset(1.4);
563  Histo->GetXaxis()->SetTitleOffset(1.4);
564  Histo->GetXaxis()->SetLabelSize(0.05);
565  Histo->GetYaxis()->SetLabelSize(0.05);
566  Histo->GetXaxis()->SetTitleSize(0.045);
567  Histo->GetYaxis()->SetTitleSize(0.045);
568  Histo->GetXaxis()->SetNdivisions(505);
569  Histo->GetYaxis()->SetNdivisions(505);
570  }
571 
572  if(longhisto==1)
573  {
574  Histo->GetYaxis()->SetTitleOffset(0.2);
575  Histo->GetXaxis()->SetTitleOffset(1.0);
576  //if(big==1) Histo->GetYaxis()->SetLabelOffset(0.015);
577  //if(big==1) Histo->GetXaxis()->SetLabelOffset(0.015);
578  Histo->GetXaxis()->SetLabelSize(0.07);
579  Histo->GetYaxis()->SetLabelSize(0.07);
580  Histo->GetXaxis()->SetTitleSize(0.08);
581  Histo->GetYaxis()->SetTitleSize(0.08);
582  //Histo->GetXaxis()->CenterTitle();
583  //Histo->GetYaxis()->CenterTitle();
584  Histo->GetXaxis()->SetNdivisions(520);
585  Histo->GetYaxis()->SetNdivisions(10);
586  }
587 
588  Histo->GetXaxis()->SetLabelFont(42);
589  Histo->GetYaxis()->SetLabelFont(42);
590  Histo->GetXaxis()->SetTitleFont(42);
591  Histo->GetYaxis()->SetTitleFont(42);
592  if(Xtitel!="")Histo->GetXaxis()->SetTitle(Xtitel);
593  if(Ytitel!="")Histo->GetYaxis()->SetTitle(Ytitel);
594 
595  Histo->SetLineColor(1);
596  Histo->SetMarkerColor(1);
597  Histo->SetMarkerStyle(20);
598  Histo->SetMarkerSize(0.5);
599 }
void SetRunNumber(Int_t run)
Definition: External.C:236
Bool_t IsCellMaskedByHand(Int_t cell, std::vector< Int_t > cellVector)
void SetHisto(TH1 *Histo, TString Xtitel, TString Ytitel, Bool_t longhisto)
void Compare_RunNumbers(TString period="LHC15n", Int_t trainNo=603, TString runList1="", TString runList2="")
void Compare2Blocks(TString period="LHC15n", Int_t trainNo=603, Int_t versionA=0, Int_t versionB=1)
AliEMCALGeometry * GetEMCALGeometry() const
int Int_t
Definition: External.C:63
const char * pdfName
Definition: DrawAnaELoss.C:30
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)
bool Bool_t
Definition: External.C:53
Class with utils specific to calorimeter clusters/cells.
void AccessGeometry(AliVEvent *inputEvent)
Definition: External.C:196
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)