AliPhysics  026afea (026afea)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaCaloChannelAnalysis.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 // --- ROOT system ---
17 #include <TFile.h>
18 #include <TH1F.h>
19 #include <TH2F.h>
20 #include <TF1.h>
21 #include <TSpectrum.h>
22 #include <TROOT.h>
23 #include <TLine.h>
24 #include <TCanvas.h>
25 #include <TStyle.h>
26 #include <TLegend.h>
27 #include <TString.h>
28 #include <TSystem.h>
29 #include <TList.h>
30 #include <TLatex.h>
31 
32 #include <Riostream.h>
33 #include <stdio.h>
34 #include <fstream>
35 #include <iostream>
36 #include <alloca.h>
37 #include <string>
38 #include <cstring>
39 
40 // --- ANALYSIS system ---
41 #include <AliCalorimeterUtils.h>
42 #include <AliEMCALGeometry.h>
44 #include <AliAODEvent.h>
45 
46 using std::vector;
47 using std::cout;
48 using std::endl;
49 using std::ofstream;
50 using std::flush;
51 using std::ios;
52 
56 
60 //________________________________________________________________________
62 TObject(),
63  fCurrentRunNumber(-1),
64  fPeriod(),
65  fPass(),
66  fTrigger(),
67  fNoOfCells(),
68  fCellStartDCal(12288),
69  fAnalysisOutput(),
70  fAnalysisInput(),
71  fRunList(),
72  fRunListFileName(),
73  fWorkdir(),
74  fQADirect(),
75  fMergedFileName(),
76  fAnalysisVector(),
77  fTrial(),
78  fExternalFileName(),
79  fTestRoutine(),
80  fNMaxCols(48),
81  fNMaxRows(24),
82  fNMaxColsAbs(),
83  fNMaxRowsAbs(),
84  fFlag(),
85  fCriterionCounter(),
86  fCaloUtils()
87 {
88  fCurrentRunNumber = 254381;
89  fPeriod = "LHC16h";
90  fPass = "muon_caloLego";
91  fTrigger = "AnyINT";
92  fWorkdir = ".";
93  fRunListFileName = "runList.txt";
94  fTrial = 0;
95 
96  Init();
97 }
98 
102 //________________________________________________________________________
103 AliAnaCaloChannelAnalysis::AliAnaCaloChannelAnalysis(TString period, TString pass, TString trigger, Int_t runNumber,Int_t trial, TString workDir, TString listName):
104  TObject(),
105  fCurrentRunNumber(-1),
106  fPeriod(),
107  fPass(),
108  fTrigger(),
109  fNoOfCells(),
110  fCellStartDCal(12288),
111  fAnalysisOutput(),
112  fAnalysisInput(),
113  fRunList(),
114  fRunListFileName(),
115  fWorkdir(),
116  fQADirect(),
117  fMergedFileName(),
118  fAnalysisVector(),
119  fTrial(),
120  fExternalFileName(),
121  fTestRoutine(),
122  fNMaxCols(48),
123  fNMaxRows(24),
124  fNMaxColsAbs(),
125  fNMaxRowsAbs(),
126  fFlag(),
127  fCriterionCounter(),
128  fCaloUtils()
129 {
130  fCurrentRunNumber = runNumber;
131  fPeriod = period;
132  fPass = pass; //ELI only for folder structure
133  fTrigger = trigger; //ELI important to select trigger in output file == different wagons in lego train
134  fWorkdir = workDir;
135  fRunListFileName = listName;
136  fTrial = trial;
137 
138  Init();
139 }
140 
144 //________________________________________________________________________
146 {
147  //......................................................
148  //..Default values - can be set by functions
150  fTestRoutine=0;
151 
152  //..Settings for the input/output structure (hard coded)
153  // TO BE CHANGED
154  fAnalysisInput =Form("AnalysisInput/%s",fPeriod.Data());
155  fAnalysisOutput =Form("AnalysisOutput/%s/Version%i",fPeriod.Data(),fTrial);
156 
157  //..Make output directory if it doesn't exist
158  //..first the period folder
159  gSystem->mkdir(Form("%s/AnalysisOutput/%s",fWorkdir.Data(),fPeriod.Data()));
160  //..then the version folder
161  gSystem->mkdir(Form("%s/%s",fWorkdir.Data(),fAnalysisOutput.Data()));
162 
163  fMergedFileName= Form("%s/%s/%s/MergedRuns_%s.root",fWorkdir.Data(),fAnalysisInput.Data(),fPass.Data(),fTrigger.Data());
164  fRunList = Form("%s/%s/%s/%s",fWorkdir.Data(), fAnalysisInput.Data(), fPass.Data(), fRunListFileName.Data());
165  fQADirect = Form("CaloQA_%s",fTrigger.Data());
166 
167  TString fileName = Form("%s/%s/%s%s_Histograms_V%i.root",fWorkdir.Data(),fAnalysisOutput.Data(), fPass.Data(),fTrigger.Data() ,fTrial);
168  fRootFile = new TFile(fileName,"recreate");
169  //.. make sure the vector is empty
170  fAnalysisVector.clear();
171 
172  //......................................................
173  //..Initialize EMCal/DCal geometry
175  //..Create a dummy event for the CaloUtils
176  AliAODEvent* aod = new AliAODEvent();
179 
180  fNoOfCells =fCaloUtils->GetEMCALGeometry()->GetNCells(); //..Very important number, never change after that point!
181  Int_t nModules=fCaloUtils->GetEMCALGeometry()->GetNumberOfSuperModules();
182  //..This is how the calorimeter looks like in the current period (defined by example run ID fCurrentRunNumber)
183  cout<<"Called geometry for run number: "<<fCurrentRunNumber<<endl;
184  cout<<"Number of supermod: "<<nModules<<endl;
185  cout<<"Number of cells: "<<fNoOfCells<<endl;
186  cout<<"Cell ID of first DCal cell: "<<fCellStartDCal<<endl;
187  //cout<<"Number of supermod utils: "<<fCaloUtils->GetNumberOfSuperModulesUsed()<<endl; //..will always be 22 unless set by hand
188 
189  //......................................................
190  //..Initialize flag array to store how the cell is categorized
191  //..In the histogram: bin 1= cellID 0, bin 2= cellID 1 etc
192  //..In the array: fFlag[cellID]= some information
193  fFlag = new Int_t[fNoOfCells];
194  fFlag[fNoOfCells] = {0}; //..flagged as good by default
195  fCriterionCounter=2; //This value will be written in fflag and updates after each PeriodAnalysis
196  //......................................................
197  //..setings for the 2D histogram
198  //fNMaxCols = 48; //eta direction
199  //fNMaxRows = 24; //phi direction
201  fNMaxRowsAbs = Int_t (nModules/2)*fNMaxRows; //multiply by number of supermodules
202 
203 
204  //......................................................
205  //..Create TLists to organize the outputfile
206  fOutputListBad = new TList();
207  fOutputListGood = new TList();
208  fOutputListBadRatio = new TList();
209  fOutputListGoodRatio = new TList();
210 
211  fOutputListBad ->SetName("BadCell_Amplitudes");
212  fOutputListGood ->SetName("GoodCell_Amplitudes");
213  fOutputListBadRatio ->SetName("BadCell_AmplitudeRatios");
214  fOutputListGoodRatio->SetName("GoodCell_AmplitudeRatios");
215 
216  //fOutputListGood ->SetOwner();//ELI instead of delete in destructor??
217  //fOutputListBadRatio ->SetOwner();
218  //fOutputListGoodRatio ->SetOwner();
219 }
220 
234 //________________________________________________________________________
236 {
237 // cout<<"fired trigger class"<<AliAODEvent::GetFiredTriggerClasses()<<endl;
238 
239  if(fExternalFileName=="")
240  {
241  //..If no extrenal file is provided merge different runs together
242  cout<<". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."<<endl;
243  cout<<". . .Start process by converting files. . . . . . . . . . . ."<<endl;
244  cout<<endl;
246  if(fMergedFileName.IsNull())
247  {
248  Printf("File not produced, exit");
249  return;
250  }
251  cout<<endl;
252  }
253  else
254  {
255  //..If extrenal file is provided load it
256  cout<<". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."<<endl;
257  cout<<". . .Start process by loading external file. . . . . . . . . . ."<<endl;
258  fMergedFileName= Form("%s/%s/%s/%s",fWorkdir.Data(),fAnalysisInput.Data(),fPass.Data(),fExternalFileName.Data());
259  }
260  cout<<". . .Load inputfile with name: "<<fMergedFileName<<" . . . . . . . ."<<endl;
261 
262  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
263  //.. Read all the needed input for the Bad/Dead Channel analysis
264  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
265  TFile *mergedFileInput = new TFile(fMergedFileName);
266  if(!mergedFileInput->IsOpen())
267  {
268  Printf("Error! Input file not found, abort");
269  return;
270  }
271  fCellAmplitude = (TH2F*) mergedFileInput->Get("hCellAmplitude");
272  fCellTime = (TH2F*) mergedFileInput->Get("hCellTime");
273  fProcessedEvents = (TH1F*) mergedFileInput->Get("hNEventsProcessedPerRun");
274 
275  cout<<". . .Continue process by . . . . . . . . . . . ."<<endl;
276  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
277  //.. DEAD CELLS
278  //.. Flag dead cells with fFlag=1
279  //.. this excludes cells from analysis (will not appear in results)
280  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
281  cout<<"o o o Flag dead cells o o o"<<endl;
282  FlagAsDead();
283  cout<<endl;
284  cout<<endl;
285 
286  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
287  //.. BAD CELLS
288  //.. Flag dead cells with fFlag=2 and bigger
289  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
290  cout<<"o o o Flag bad cells o o o"<<endl;
291  BCAnalysis();
292 
293  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
294  //..In the end summarize results
295  //..in a .pdf and a .txt file
296  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
297  cout<<"o o o Write .txt for each period analyis with bad cells o o o"<<endl;
299 
300  cout<<"o o o Create summary documents for the entire analysis o o o"<<endl;
302  fRootFile->WriteObject(fFlag,"FlagArray");
303  fRootFile->Close();
304  cout<<endl;
305 
306  //..make a reccomendation about the used energy range to be investigated
307  //..and the binning
308  TH1D *hRefDistr = BuildMeanFromGood();
309  //..Find bin where reference has value 1, and the corresponding x-value
310  Int_t binHeihgtOne = hRefDistr->FindLastBinAbove(1);
311  Double_t binCentreHeightOne = hRefDistr->GetBinCenter(binHeihgtOne);
312  cout<<". . .Recomendation:"<<endl;
313  cout<<". . .With the current statistic on average a cell has 1 hit at "<<binCentreHeightOne<<" GeV"<<endl;
314  cout<<". . .so it makes no sense to select energy ranges >"<<binCentreHeightOne<<" as cells will be maked bad just due to the lack of statistic"<<endl;
315  cout<<". . .End of process . . . . . . . . . . . . . . . . . . . . ."<<endl;
316  cout<<". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ."<<endl;
317 }
318 
325 //________________________________________________________________________
327 {
328  cout<<"o o o Start conversion process o o o"<<endl;
329  cout<<"o o o period: " << fPeriod << ", pass: " << fPass << ", trigger: "<<fTrigger<< endl;
330 
331  //..Create histograms needed for adding all the files together
332  //ELI a little problematic to hard code properties of histograms??
333  TH2F *hCellAmplitude = new TH2F("hCellAmplitude","Cell Amplitude",200,0,10,23040,0,23040);
334  TH2F *hCellTime = new TH2F("hCellTime","Cell Time",250,-275,975,23040,0,23040);
335  TH1F *hNEventsProcessedPerRun = new TH1F("hNEventsProcessedPerRun","Number of processed events in analyzed runs",1,0,1);
336 
337  //..Open the text file with the run list numbers and run index
338  cout<<"o o o Open .txt file with run indices. Name = " << fRunList << endl;
339  FILE *pFile = fopen(fRunList.Data(), "r");
340  if(!pFile)
341  {
342  cout<<"couldn't open file!"<<endl;
343  return "";
344  }
345  Int_t nEntr;
346  Int_t nEntrTot=0;
347  Int_t q;
348  Int_t ncols;
349  Int_t nlines = 0 ;
350  Int_t runId[500] ;
351  while (1)
352  {
353  ncols = fscanf(pFile," %d ",&q);
354  if (ncols< 0) break;
355  runId[nlines]=q;
356  nlines++;
357  }
358  fclose(pFile);
359 
360 
361  //..Open the different .root files with help of the run numbers from the text file
362  const Int_t nRun = nlines ;
363  TString base;
364  TString infile;
365  TString singleRunFileName;
366 
367  cout<<"o o o Start merging process of " << nRun <<" files"<< endl;
368  //..loop over the amount of run numbers found in the previous text file.
369  for(Int_t i = 0 ; i < nRun ; i++)
370  {
371  base = Form("%s/%s/%s/%d", fWorkdir.Data(), fAnalysisInput.Data(), fPass.Data(), runId[i]);
372  /*if ((fPass=="cpass1_pass2")||(fPass=="cfPass1-2"))
373  {
374  if (fTrigger=="default")
375  {
376  infile = Form("%s_barrel.root",base.Data());
377  }
378  else
379  {
380  infile = Form("%s_outer.root",base.Data());
381  }
382  }
383  else
384  {*/
385  //..This is a run2 case
386  infile = Form("%s.root",base.Data()) ;
387  //}
388 
389  cout<<" o Open .root file with name: "<<infile<<endl;
390  TFile *f = TFile::Open(infile);
391 
392  //..Do some basic checks
393  if(!f)
394  {
395  cout<<"Couldn't open/find .root file: "<<infile<<endl;
396  continue;
397  }
398  TDirectoryFile *dir = (TDirectoryFile *)f->Get(fQADirect);
399  if(!dir)
400  {
401  cout<<"Couln't open directory file in .root file: "<<infile<<", directory: "<<fQADirect<<endl;
402  continue;
403  }
404  TList *outputList = (TList*)dir->Get(fQADirect);
405  if(!outputList)
406  {
407  cout << "Couln't get TList from directory file: "<<fQADirect<<endl;
408  continue;
409  }
410 
411  //ELI should one maybe clone the hAmpId histos eg to hCellAmplitude, then one does't need to hard code them.
412  TH2F *hAmpId;
413  TH2F *hTimeId;
414  TH1F *hNEvents;
415 
416  hAmpId =(TH2F *)outputList->FindObject("EMCAL_hAmpId");
417  if(!hAmpId)
418  {
419  Printf("hAmpId not found");
420  outputList->ls();
421  continue;
422  }
423  hTimeId =(TH2F *)outputList->FindObject("EMCAL_hTimeId");
424  if(!hTimeId)
425  {
426  Printf("hTimeId not found");
427  outputList->ls();
428  continue;
429  }
430  hNEvents =(TH1F *)outputList->FindObject("hNEvents");
431  if(!hNEvents)
432  {
433  Printf("hNEvents not found");
434  outputList->ls();
435  continue;
436  }
437  nEntr = (Int_t)hNEvents->GetEntries();
438 
439  //..does that mean do not merge small files?
440  if (nEntr<100)
441  {
442  cout <<" o File to small to be merged. Only N entries " << nEntr << endl;
443  continue ;
444  }
445  cout <<" o File with N entries " << nEntr<<" will be merged"<< endl;
446  nEntrTot+=nEntr;
447  hCellAmplitude->Add(hAmpId);
448  hCellTime->Add(hTimeId);
449  hNEventsProcessedPerRun->Add(hNEvents);
450 
451  //..Create copies of the original root files just with the bad channel QA
452  //..So that a run by run bad channel analysis can be performed more easily
453  singleRunFileName= Form("%s/%s/%s/%d_Filtered.root",fWorkdir.Data(),fAnalysisInput.Data(),fPass.Data(),runId[i]);
454  TFile *singleRunFile = TFile::Open(singleRunFileName,"recreate");
455  hNEventsProcessedPerRun->Write();
456  hCellAmplitude->Write();
457  hCellTime->Write();
458  singleRunFile->Close();
459 
460  outputList->Delete();
461  dir->Delete();
462  f->Close();
463  delete f;
464  }
465 
466  //.. Save the merged histograms
467  cout<<"o o o Save the merged histogramms to .root file with name: "<<fMergedFileName<<endl;
468  cout<<"o o o"<<nEntrTot<<" events were merged"<<endl;
469  TFile *BCF = TFile::Open(fMergedFileName,"recreate");
470  hNEventsProcessedPerRun->Write();
471  hCellAmplitude->Write();
472  hCellTime->Write();
473  BCF->Close();
474  cout<<"o o o End conversion process o o o"<<endl;
475  return fMergedFileName;
476 }
477 
478 
484 //_________________________________________________________________________
486 {
487  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
488  //.. BAD CELLS
489  //.. Flag bad cells with fFlag= 2,3,4,5.. etc
490  //.. this excludes cells from subsequent analysis
491  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
492  TArrayD periodArray;
493  for(Int_t i=0;i<(Int_t)fAnalysisVector.size();i++)
494  {
495  periodArray=fAnalysisVector.at(i);
496  PeriodAnalysis(periodArray.At(0),periodArray.At(1),periodArray.At(2),periodArray.At(3));
498  cout<<""<<endl;
499  cout<<""<<endl;
500  }
501  cout<<"o o o End of bad channel analysis o o o"<<endl;
502 }
503 
512 //________________________________________________________________________
514 {
515  TArrayD periodArray;
516  periodArray.Set(4);
517  periodArray.AddAt((Double_t)criteria,0);
518  periodArray.AddAt(nsigma,1);
519  periodArray.AddAt(emin,2);
520  periodArray.AddAt(emax,3);
521  fAnalysisVector.push_back(periodArray);
522 }
538 //____________________________________________________________________
540 {
541  //ELI criterion should be between 1-4
542  cout<<"o o o o o o o o o o o o o o o o o o o o o o o o o"<<endl;
543  cout<<"o o o PeriodAnalysis for flag "<<criterion<<" o o o"<<endl;
544  cout<<"o o o Done in the energy range E "<<emin<<"-"<<emax<<endl;
545 
546  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
547  //.. ANALYSIS OF CELLS WITH ENTRIES
548  //.. Build average distributions and fit them
549  //.. Three tests for bad cells:
550  //.. 1) Average energy per hit
551  //.. 2) Average hit per event
552  //.. 3) ...
553  //.. 4) ...
554  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
555  TH1F* histogram;
556  if(criterion < 6)cout<<"o o o Analyze average cell distributions o o o"<<endl;
557  //..For case 1 or 2
558  if(criterion < 3) histogram = BuildHitAndEnergyMean(criterion, emin, emax,nsigma);
559  //..For case 3, 4 or 5
560  else if (criterion < 6) TestCellShapes(criterion, emin, emax, nsigma);
561 
562  Double_t range=0.001;
563  if(emin>0.49)range=0.0005;
564  if(emin>0.99)range=0.0001;
565  if(emin>1.99)range=0.00005;
566 
567  if(criterion==1) FlagAsBad(criterion, histogram, nsigma, 200,-1);
568  if(criterion==2) FlagAsBad(criterion, histogram, nsigma, 600,range);
569 
570  /*
571  if(criterion==3) FlagAsBad(criterion, histogram, nsigma, dnbins, maxval3);
572  if(criterion==4) FlagAsBad(criterion, histogram, nsigma, dnbins, maxval1);
573  if(criterion==5) FlagAsBad(criterion, histogram, nsigma, dnbins, maxval2);
574  */
575 }
576 
586 //_________________________________________________________________________
588 {
589  cout<<" o Calculate average cell hit per event and average cell energy per hit "<<endl;
590  TH1F *histogram;
591  if(crit==1)histogram = new TH1F(Form("hCellEtoNtotal_E%.2f-%.2f",emin,emax),Form("Energy per hit, %.2f < E < %.2f GeV",emin,emax), fNoOfCells,0,fNoOfCells);
592  if(crit==2)histogram = new TH1F(Form("hCellNtotal_E%.2f-%.2f",emin,emax),Form("Number of hits per event, %.2f < E < %.2f GeV",emin,emax), fNoOfCells,0,fNoOfCells);
593  histogram->SetXTitle("Abs. Cell Id");
594  if(crit==1)histogram->SetYTitle("Energy per hit");
595  if(crit==2)histogram->SetYTitle("Number of hits per event");
596  histogram->GetXaxis()->SetNdivisions(510);
597  Double_t totalevents = fProcessedEvents->Integral(1, fProcessedEvents->GetNbinsX());
598 
599  //..here the average hit per event and the average energy per hit is caluclated for each cell.
600  for (Int_t cell = 0; cell < fNoOfCells; cell++)
601  {
602  Double_t Esum = 0;
603  Double_t Nsum = 0;
604 
605  for (Int_t j = 1; j <= fCellAmplitude->GetNbinsX(); j++)
606  {
607  Double_t E = fCellAmplitude->GetXaxis()->GetBinCenter(j);
608  Double_t N = fCellAmplitude->GetBinContent(j, cell+1);
609  //..investigate only cells that were not flagged as dead ore bad
610  if (E < emin || E > emax || fFlag[cell]!=0) continue;
611  Esum += E*N;
612  Nsum += N;
613  }
614  //..Set the values only for cells that are not yet marked as bad
615  if(fFlag[cell]==0)
616  {
617  if(totalevents> 0. && crit==2)histogram->SetBinContent(cell+1, Nsum/totalevents); //..number of hits per event
618  if(Nsum > 0. && crit==1)histogram->SetBinContent(cell+1, Esum/Nsum); //..average energy per hit
619  }
620  }
621  return histogram;
622 }
627 //_________________________________________________________________________
629 {
630  TH1F *Histogram = new TH1F(Form("hSomethingWithTime_E%.2f-%.2f",emin,emax),Form("I don't know, %.2f < E < %.2f GeV",emin,emax), 2,0,2);
631 
632  return Histogram;
633 }
644 //_________________________________________________________________________
646 {
647  //..binning parameters
648  Int_t ncells = fCellAmplitude->GetNbinsY();
649  Double_t amin = fCellAmplitude->GetYaxis()->GetXmin();
650  Double_t amax = fCellAmplitude->GetYaxis()->GetXmax();
651  cout << "ncells " << ncells << " amin = " << amin << "amax = " << amax<< endl;
652 
653  //..initialize histograms
654  TH1 *hFitA = new TH1F("hFitA_hCellAmplitude","Fit A value", ncells,amin,amax);
655  hFitA->SetXTitle("AbsId");
656  hFitA->SetYTitle("A");
657 
658  TH1 *hFitB = new TH1F("hFitB_hCellAmplitude","Fit B value", ncells,amin,amax);
659  hFitB->SetXTitle("AbsIdhname");
660  hFitB->SetYTitle("B");
661 
662  TH1 *hFitChi2Ndf = new TH1F("hFitChi2Ndf_hCellAmplitude","Fit #chi^{2}/ndf value", ncells,amin,amax);
663  hFitChi2Ndf->SetXTitle("AbsId");
664  hFitChi2Ndf->SetYTitle("#chi^{2}/ndf");
665 
666  Double_t maxval1=0., maxval2=0., maxval3=0.;
667  Double_t prev=0., MSA=0., AvA = 0. ; //those param are used to automaticaly determined a reasonable maxval1
668  Double_t prev2=0., MSB=0., AvB = 0. ; //those param are used to automaticaly determined a reasonable maxval2
669  Double_t prev3=0., MSki2=0., Avki2 = 0. ; //those param are used to automaticaly determined a reasonable maxval3
670  Double_t ki2=0.0 ;
671  for (Int_t k = 1; k <= fNoOfCells; k++)
672  {
673  TF1 *fit = new TF1("fit", "[0]*exp(-[1]*x)/x^2");
674  TH1 *hCell = fCellAmplitude->ProjectionX("",k,k);
675  if (hCell->GetEntries() == 0) continue;
676  // hCell->Rebin(3);
677  hCell->Fit(fit, "0QEM", "", fitemin, fitemax);
678  delete hCell;
679 
680  if(fit->GetParameter(0) < 5000.)
681  {
682  hFitA->SetBinContent(k, fit->GetParameter(0));
683  if(k<3000)
684  {
685  AvA += fit->GetParameter(0);
686  if(k==2999) maxval1 = AvA/3000. ;
687  if (prev < fit->GetParameter(0)) MSA += fit->GetParameter(0) - prev;
688  else MSA -= (fit->GetParameter(0) - prev) ;
689  prev = fit->GetParameter(0);
690  }
691  else
692  {
693  if((fit->GetParameter(0) - maxval1) > 0. && (fit->GetParameter(0) - maxval1) < (MSA/1000.))
694  {
695  maxval1 = fit->GetParameter(0);
696  }
697  }
698  }
699  else hFitA->SetBinContent(k, 5000.);
700 
701  if(fit->GetParameter(1) < 5000.)
702  {
703  hFitB->SetBinContent(k, fit->GetParameter(1));
704  if(k<3000)
705  {
706  AvB += fit->GetParameter(1);
707  if(k==2999) maxval2 = AvB/3000. ;
708  if (prev2 < fit->GetParameter(1)) MSB += fit->GetParameter(1) - prev2;
709  else MSB -= (fit->GetParameter(1) - prev2) ;
710  prev2 = fit->GetParameter(1);
711  }
712  else
713  {
714  if((fit->GetParameter(1) - maxval2) > 0. && (fit->GetParameter(1) - maxval2) < (MSB/1000.))
715  {
716  maxval2 = fit->GetParameter(1);
717  }
718  }
719  }
720  else hFitB->SetBinContent(k, 5000.);
721 
722 
723  if (fit->GetNDF() != 0 ) ki2 = fit->GetChisquare()/fit->GetNDF();
724  else ki2 = 1000.;
725 
726  if(ki2 < 1000.)
727  {
728  hFitChi2Ndf->SetBinContent(k, ki2);
729  if(k<3000)
730  {
731  Avki2 += ki2;
732  if(k==2999) maxval3 = Avki2/3000. ;
733  if (prev3 < ki2) MSki2 += ki2 - prev3;
734  else MSki2 -= (ki2 - prev3) ;
735  prev3 = ki2;
736  }
737  else
738  {
739  if((ki2 - maxval3) > 0. && (ki2 - maxval3) < (MSki2/1000.))
740  {
741  maxval3 = ki2;
742  }
743  }
744  }
745  else hFitChi2Ndf->SetBinContent(k, 1000.);
746 
747  delete fit ;
748  }
749 
750  // if you have problem with automatic parameter :
751  // maxval1 =
752  // maxval2 =
753  // maxval3 =
754  /*
755  if(crit==3)
756  Process(crit, hFitChi2Ndf, nsigma, dnbins, maxval3);
757  if(crit==4)
758  Process(crit, hFitA, nsigma, dnbins, maxval1);
759  if(crit==5)
760  Process(crit, hFitB, nsigma, dnbins, maxval2);
761  */
762 
763  //ELI something like thie in the future:
764  //return histogram;
765 }
766 
767 
772 //_________________________________________________________________________
774 {
775  Int_t sumOfExcl=0;
776  //..Direction of cell ID
777  for (Int_t cell = 0; cell < fNoOfCells; cell++)
778  {
779  Double_t nSum = 0;
780  //..Direction of amplitude (Checks energies from 0-10 GeV)
781  for (Int_t amp = 1; amp <= fCellAmplitude->GetNbinsX(); amp++)
782  {
783  //..cellID+1 = histogram bin
784  Double_t N = fCellAmplitude->GetBinContent(amp,cell+1);
785  nSum += N;
786  }
787  //..If the amplitude in one cell is basically 0
788  //..mark the cell as excluded
789  if(nSum < 0.5 && fFlag[cell]==0)
790  {
791  //..Cell flagged as dead.
792  //..Flag only if it hasn't been flagged before
793  fFlag[cell] =1;
794  sumOfExcl++;
795  }
796  }
797  cout<<" o Number of dead cells: "<<sumOfExcl<<endl;
798  cout<<" ("<<sumOfExcl<<")"<<endl;
799 }
800 
815 //_________________________________________________________________________
816 void AliAnaCaloChannelAnalysis::FlagAsBad(Int_t crit, TH1F* inhisto, Double_t nsigma, Int_t dnbins, Double_t dmaxval)
817 {
818  gStyle->SetOptStat(0); // MG modif
819  gStyle->SetOptFit(0); // MG modif
820 
821  if(crit==1)cout<<" o Fit average energy per hit distribution"<<endl;
822  if(crit==2)cout<<" o Fit average hit per event distribution"<<endl;
823 
824  Int_t cellColumn=0,cellRow=0;
825  Int_t cellColumnAbs=0,cellRowAbs=0;
826  Int_t trash;
827 
828  TString histoName=inhisto->GetName();
829  Double_t goodmax= 0. ;
830  Double_t goodmin= 0. ;
831  if (dmaxval < 0.)
832  {
833  dmaxval = inhisto->GetMaximum()*1.01; // 1.01 - to see the last bin
834  if(crit==2 && dmaxval > 1) dmaxval =1. ;
835  }
836 
837  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
838  //. . .build the distribution of average values
839  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
840  Double_t totalevents = fProcessedEvents->Integral(1, fProcessedEvents->GetNbinsX());
841  //..Be aware that the bin width should never be larger than 1/totalevents because this
842  //..is the minimum differce between the cells. One hit more/event otherwise you will see ugly empty bins in the histogram
843  if(((dmaxval-inhisto->GetMinimum())/(dnbins*1.0))<1.0/totalevents)
844  {
845  dnbins=(dmaxval-inhisto->GetMinimum())*totalevents;
846  cout<<"Problem - Reset dnbins to new value:"<<dnbins<<endl;
847  }
848 
849  //..build histos
850  TH1F *distrib = new TH1F(Form("%sDistr",(const char*)histoName), "", dnbins, inhisto->GetMinimum(), dmaxval);
851  distrib->SetXTitle(inhisto->GetYaxis()->GetTitle());
852  distrib->SetYTitle("Entries");
853  TH1F *distrib_wTRDStruc = new TH1F(Form("%sDistr_wTRD",(const char*)histoName), "", dnbins, inhisto->GetMinimum(), dmaxval);
854  TH1F *distrib_woTRDStruc= new TH1F(Form("%sDistr_woTRD",(const char*)histoName), "", dnbins, inhisto->GetMinimum(), dmaxval);
855 
856 
857  //..build two dimensional histogram with values row vs. column
858  TH2F *plot2D = new TH2F(Form("%s_HitRowColumn",(const char*)histoName),Form("%s_HitRowColumn",(const char*)histoName),fNMaxColsAbs+1,-0.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+1,-0.5,fNMaxRowsAbs+0.5);
859  plot2D->GetXaxis()->SetTitle("cell column (#eta direction)");
860  plot2D->GetYaxis()->SetTitle("cell row (#phi direction)");
861 
862  for (Int_t cell = 0; cell < fNoOfCells; cell++)
863  {
864  //..Do that only for cell ids also accepted by the code
865  if(!fCaloUtils->GetEMCALGeometry()->CheckAbsCellId(cell))continue;
866 
867  //..Fill histograms only for cells that are not yet flagged as bad
868  if(fFlag[cell]==0)
869  {
870  //..fill the distribution of avarge cell values
871  distrib->Fill(inhisto->GetBinContent(cell+1));
872  //if(cell<fCellStartDCal)distrib_wTRDStruc->Fill(inhisto->GetBinContent(cell+1));
873  //else distrib_woTRDStruc ->Fill(inhisto->GetBinContent(cell+1));
874  //..Get Row and Collumn for cell ID
875  fCaloUtils->GetModuleNumberCellIndexesAbsCaloMap(cell,0,cellColumn,cellRow,trash,cellColumnAbs,cellRowAbs);
876  if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
877  {
878  cout<<"Problem! wrong calculated number of max col and max rows"<<endl;
879  cout<<"current col: "<<cellColumnAbs<<", max col"<<fNMaxColsAbs<<endl;
880  cout<<"current row: "<<cellRowAbs<<", max row"<<fNMaxRowsAbs<<endl;
881  }
882  plot2D->SetBinContent(cellColumnAbs,cellRowAbs,inhisto->GetBinContent(cell+1));
883  //..check TRD support structure
884  if(IsCoveredByTRD(cellRowAbs,cellColumnAbs)==1)
885  {
886  distrib_wTRDStruc->Fill(inhisto->GetBinContent(cell+1));
887  }
888  else
889  {
890  distrib_woTRDStruc ->Fill(inhisto->GetBinContent(cell+1));
891  }
892  }
893  }
894 
895  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
896  //. . .draw histogram + distribution
897  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
898 
899  TCanvas *c1 = new TCanvas(histoName,histoName,900,900);
900  c1->ToggleEventStatus();
901  TPad* upperPad = new TPad("upperPad", "upperPad",.005, .5, .995, .995);
902  TPad* lowerPadLeft = new TPad("lowerPadL", "lowerPadL",.005, .005, .5, .5);
903  TPad* lowerPadRight = new TPad("lowerPadR", "lowerPadR",.5, .005, .995, .5);
904  upperPad->Draw();
905  lowerPadLeft->Draw();
906  lowerPadRight->Draw();
907 
908  upperPad->cd();
909  upperPad->SetLeftMargin(0.045);
910  upperPad->SetRightMargin(0.05);
911  upperPad->SetLogy();
912  inhisto->SetTitleOffset(0.6,"Y");
913  inhisto->GetXaxis()->SetRangeUser(0,fNoOfCells+1);
914 
915  inhisto->SetLineColor(kBlue+1);
916  inhisto->Draw();
917 
918  lowerPadRight->cd();
919  lowerPadRight->SetLeftMargin(0.09);
920  lowerPadRight->SetRightMargin(0.1);
921  plot2D->Draw("colz");
922 
923  lowerPadLeft->cd();
924  lowerPadLeft->SetLeftMargin(0.09);
925  lowerPadLeft->SetRightMargin(0.07);
926  lowerPadLeft->SetLogy();
927  distrib->SetLineColor(kBlue+1);
928  distrib->Draw();
929  distrib_wTRDStruc->SetLineColor(kGreen+1);
930  distrib_wTRDStruc->DrawCopy("same");
931  distrib_woTRDStruc->SetLineColor(kMagenta+1);
932  distrib_woTRDStruc->DrawCopy("same");
933 
934  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
935  //. . .fit histogram
936  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
937  Int_t higherbin=0,i;
938  for(i = 2; i <= dnbins; i++)
939  {
940  if(distrib->GetBinContent(higherbin) < distrib->GetBinContent(i)) higherbin = i ;
941  }
942  //..good range is around the max value as long as the
943  //..bin content is larger than 2 entries
944  for(i = higherbin ; i<=dnbins ; i++)
945  {
946  if(distrib->GetBinContent(i)<2) break ;
947  goodmax = distrib->GetBinCenter(i);
948  }
949  for(i = higherbin ; i>1 ; i--)
950  {
951  if(distrib->GetBinContent(i)<2) break ;
952  goodmin = distrib->GetBinLowEdge(i);
953  }
954  //cout<<"higherbin : "<<higherbin<<endl;
955  //cout<<"good range : "<<goodmin<<" - "<<goodmax<<endl;
956 
957  TF1 *fit2 = new TF1("fit2", "gaus",0,10);
958  //..start the fit with a mean of the highest value
959  fit2->SetParameter(1,higherbin);
960 
961  distrib->Fit(fit2, "0LQEM", "", goodmin, goodmax);
962  Double_t sig, mean;// chi2ndf;
963  // Marie midif to take into account very non gaussian distrig
964  mean = fit2->GetParameter(1);
965  sig = fit2->GetParameter(2);
966  //chi2ndf = fit2->GetChisquare()/fit2->GetNDF();
967 
968  if (mean <0.) mean=0.; //ELI is this not a highly problematic case??
969 
970  goodmin = mean - nsigma*sig ;
971  goodmax = mean + nsigma*sig ;
972 
973  if (goodmin<0) goodmin=0.;
974 
975  cout<<" o Result of fit: "<<endl;
976  cout<<" o "<<endl;
977  cout<<" o Mean: "<<mean <<" sigma: "<<sig<<endl;
978  cout<<" o good range : "<<goodmin <<" - "<<goodmax<<endl;
979 
980  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
981  //. . .Add info to histogram
982  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
983  TLine *lline = new TLine(goodmin, 0, goodmin, distrib->GetMaximum());
984  lline->SetLineColor(kGreen+2);
985  lline->SetLineStyle(7);
986  lline->Draw();
987 
988  TLine *rline = new TLine(goodmax, 0, goodmax, distrib->GetMaximum());
989  rline->SetLineColor(kGreen+2);
990  rline->SetLineStyle(7);
991  rline->Draw();
992 
993  TLegend *leg = new TLegend(0.60,0.70,0.9,0.85);
994  leg->AddEntry(lline,"Good region boundary","l");
995  leg->AddEntry(distrib_wTRDStruc,"Covered by TRD","l");
996  leg->AddEntry(distrib_woTRDStruc,"wo TRD structure","l");
997  leg->SetBorderSize(0);
998  leg->Draw("same");
999 
1000  fit2->SetLineColor(kOrange-3);
1001  fit2->SetLineStyle(1);//7
1002  fit2->Draw("same");
1003 
1004  TLatex* text = 0x0;
1005  if(crit==1) text = new TLatex(0.12,0.85,Form("Good range: %.2f-%.2f",goodmin,goodmax));
1006  if(crit==2) text = new TLatex(0.12,0.85,Form("Good range: %.2f-%.2fx10^-5",goodmin*100000,goodmax*100000));
1007  text->SetTextSize(0.06);
1008  text->SetNDC();
1009  text->SetTextColor(1);
1010  text->Draw();
1011 
1012 
1013  upperPad->cd();
1014  TLine *uline = new TLine(0, goodmax,fNoOfCells,goodmax);
1015  uline->SetLineColor(kGreen+2);
1016  uline->SetLineStyle(7);
1017  uline->Draw();
1018  TLine *lowline = new TLine(0, goodmin,fNoOfCells,goodmin);
1019  lowline->SetLineColor(kGreen+2);
1020  lowline->SetLineStyle(7);
1021  lowline->Draw();
1022  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1023  //. . .Save histogram
1024  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1025  c1->Update();
1026  TString name =Form("%s/%s/criteria-_%d.gif",fWorkdir.Data(), fAnalysisOutput.Data(), crit);
1027  if(crit==1)name=Form("%s/%s/AverageEperHit_%s.gif",fWorkdir.Data(), fAnalysisOutput.Data(), (const char*)histoName);
1028  if(crit==2)name=Form("%s/%s/AverageHitperEvent_%s.gif",fWorkdir.Data(), fAnalysisOutput.Data(), (const char*)histoName);
1029  c1->SaveAs(name);
1030 
1031  fRootFile->WriteObject(c1,c1->GetName());
1032  fRootFile->WriteObject(plot2D,plot2D->GetName());
1033  fRootFile->WriteObject(distrib,distrib->GetName());
1034  fRootFile->WriteObject(inhisto,inhisto->GetName());
1035  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1036  //. . . Mark the bad cells in the fFlag array
1037  //. . .(fCriterionCounter= bad because cell average value lower than min allowed)
1038  //. . .(fCriterionCounter= bad because cell average value higher than max allowed)
1039  //. . .(0 by default - good cell)
1040  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1041  cout<<" o Flag bad cells that are outside the good range "<<endl;
1042  for(Int_t cell = 0; cell < fNoOfCells; cell++)
1043  {
1044  //..cell=0 and bin=1, cell=1 and bin=2
1045  //.. <= throws out zeros, might not be a dead cell but still have zero entries in a given energy range
1046  if (inhisto->GetBinContent(cell+1) <= goodmin && fFlag[cell]==0)//ELI
1047  {
1048  fFlag[cell]=fCriterionCounter;
1049  }
1050  if (inhisto->GetBinContent(cell+1) > goodmax && fFlag[cell]==0)
1051  {
1052  fFlag[cell]=fCriterionCounter;
1053  }
1054  }
1055  cout<<" o o o o o o o o o o o o o o o o o o o o o o o"<<endl;
1056 }
1057 
1058 
1059 
1060 
1065 //________________________________________________________________________
1067 {
1068  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1069  //.. RESULTS
1070  //.. 1) Print the bad cells
1071  //.. and write the results to a file
1072  //.. for each added period analysis
1073  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1074  TArrayD periodArray;
1075  Double_t emin,emax;
1076  Int_t criterion;
1077  TString output;
1078  Int_t nb1=0;
1079 
1080  for(Int_t i=0;i<(Int_t)fAnalysisVector.size();i++)
1081  {
1082  periodArray=fAnalysisVector.at(i);
1083  criterion =periodArray.At(0);
1084  emin =periodArray.At(2);
1085  emax =periodArray.At(3);
1086 
1087  //..Print the results on the screen and
1088  //..write the results in a file
1089  output.Form("%s/%s/Criterion%d_Emin-%.2f_Emax-%.2f.txt",fWorkdir.Data(), fAnalysisOutput.Data(), criterion,emin,emax);
1090  ofstream file(output, ios::out | ios::trunc);
1091  if(!file)
1092  {
1093  cout<<"#### Major Error. Check the textfile!"<<endl;
1094  }
1095  file<<"fFlag="<<i+2<<"means Criterion : "<<criterion<<", emin = "<<emin<<" GeV"<<", emax = "<<emax<<" GeV"<<endl;
1096  cout<<" o Criterion : "<<criterion<<", emin = "<<emin<<" GeV"<<", emax = "<<emax<<" GeV"<<" (Method "<<i<<")"<<endl;
1097 
1098  nb1=0;
1099  for(Int_t cellID=0;cellID<fNoOfCells;cellID++)
1100  {
1101  if(fFlag[cellID]==(i+2))
1102  {
1103  nb1++;
1104  file<<cellID<<", ";
1105  }
1106  }
1107  file<<"Total number of bad cells with fFlag=="<<i+2<<endl;
1108  file<<"("<<nb1<<")"<<endl;
1109  file.close();
1110  cout<<" o Total number of bad cells ("<<nb1<<")"<<endl;
1111  cout<<endl;
1112  }
1113 }
1120 //________________________________________________________________________
1122 {
1123  Int_t cellID, nDCalCells = 0, nEMCalCells = 0;
1124  TString cellSummaryFile, deadPdfName, badPdfName, ratioOfBad,goodCells;
1125  TH2F* cellAmp_masked= (TH2F*)fCellAmplitude->Clone("cellAmp_masked");
1126  TH2F* cellTime_masked= (TH2F*)fCellTime->Clone("fCellTime");
1127 
1128  deadPdfName = Form("%s/%s/%s%s_Dead_Amplitudes_V%i.pdf",fWorkdir.Data(), fAnalysisOutput.Data(), fPass.Data(), fTrigger.Data() ,fTrial);
1129  badPdfName = Form("%s/%s/%s%s_Bad_Amplitudes_V%i.pdf",fWorkdir.Data(), fAnalysisOutput.Data(), fPass.Data(), fTrigger.Data() ,fTrial);
1130  cellSummaryFile = Form("%s/%s/%s%s_Bad_Amplitudes_V%i.txt",fWorkdir.Data(), fAnalysisOutput.Data(), fPass.Data(), fTrigger.Data() ,fTrial); ;
1131  ratioOfBad = Form("%s/%s/%s%s_BCRatio_Amplitudes_V%i.pdf",fWorkdir.Data(), fAnalysisOutput.Data(), fPass.Data(), fTrigger.Data() ,fTrial);
1132  goodCells = Form("%s/%s/%s%s_Good_Amplitudes_V%i.pdf",fWorkdir.Data(), fAnalysisOutput.Data(), fPass.Data(), fTrigger.Data() ,fTrial);
1133 
1134  cout<<" o Final results o "<<endl;
1135  ofstream file(cellSummaryFile, ios::out | ios::trunc);
1136  if(file)
1137  {
1138  file<<"Dead cells : "<<endl;
1139  cout<<" o Dead cells : "<<endl;
1140  nEMCalCells =0;
1141  nDCalCells =0;
1142  for(cellID=0; cellID<fNoOfCells; cellID++)
1143  {
1144  if(cellID==0)
1145  {
1146  file<<"In EMCal : "<<endl;
1147  //cout<<" o In EMCal : "<<endl;
1148  }
1149  if(cellID==fCellStartDCal)
1150  {
1151  file<<"In DCal : "<<endl;
1152  //cout<<endl;
1153  //cout<<" o In DCal : "<<endl;
1154  }
1155  if(fFlag[cellID]==1)
1156  {
1157  file<<cellID<<"\n" ;
1158  //cout<<cellID<<"," ;
1159  if(cellID<fCellStartDCal)nEMCalCells++;
1160  else nDCalCells++;
1161  }
1162  }
1163  //cout<<endl;
1164  file<<"EMCal ("<<nEMCalCells<<" ="<<100*nEMCalCells/(1.0*fCellStartDCal)<<"%), DCal ("<<nDCalCells<<" ="<<100*nDCalCells/(1.0*fNoOfCells-fCellStartDCal)<<"%)"<<endl;
1165  cout<<" o EMCal ("<<nEMCalCells<<" ="<<100*nEMCalCells/(1.0*fCellStartDCal)<<"%), DCal ("<<nDCalCells<<" ="<<100*nDCalCells/(1.0*fNoOfCells-fCellStartDCal)<<"%)"<<endl;
1166 
1167  file<<"Bad cells: "<<endl;
1168  cout<<" o Bad cells: "<<endl;
1169  nEMCalCells =0;
1170  nDCalCells =0;
1171  for(cellID=0;cellID<fNoOfCells;cellID++)
1172  {
1173  if(cellID==0)
1174  {
1175  file<<"In EMCal : "<<endl;
1176  //cout<<" o In EMCal : "<<endl;
1177  }
1178  if(cellID==fCellStartDCal)
1179  {
1180  file<<"In DCal : "<<endl;
1181  //cout<<endl;
1182  //cout<<" o In DCal : "<<endl;
1183  }
1184  if(fFlag[cellID]>1)
1185  {
1186  file<<cellID<<"\n" ;
1187  //cout<<cellID<<"," ;
1188  if(cellID<fCellStartDCal)nEMCalCells++;
1189  else nDCalCells++;
1190  }
1191  }
1192  //cout<<endl;
1193  file<<"EMCal ("<<nEMCalCells<<" ="<<100*nEMCalCells/(1.0*fCellStartDCal)<<"%), DCal ("<<nDCalCells<<" ="<<100*nDCalCells/(1.0*fNoOfCells-fCellStartDCal)<<"%)"<<endl;
1194  cout<<" o EMCal ("<<nEMCalCells<<" ="<<100*nEMCalCells/(1.0*fCellStartDCal)<<"%), DCal ("<<nDCalCells<<" ="<<100*nDCalCells/(1.0*fNoOfCells-fCellStartDCal)<<"%)"<<endl;
1195  }
1196  file.close();
1197 
1198  for (Int_t cell = 0; cell < fNoOfCells; cell++)
1199  {
1200  //..Direction of amplitude (Checks energies from 0-10 GeV)
1201  for (Int_t amp = 1; amp <= fCellAmplitude->GetNbinsX(); amp++)
1202  {
1203  if(fFlag[cell]!=0)
1204  {
1205  //..cellID+1 = histogram bin
1206  //Double_t N = fCellAmplitude->GetBinContent(amp,cell+1);
1207  cellAmp_masked->SetBinContent(amp,cell+1,0);
1208  cellTime_masked->SetBinContent(amp,cell+1,0);
1209  }
1210  }
1211  }
1212  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1213  //..Plot some summary canvases
1214  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1215  TCanvas *c1 = new TCanvas("CellProp","summary of cell properties",1000,1000);
1216  c1->ToggleEventStatus();
1217  c1->Divide(2,2);
1218  c1->cd(1)->SetLogz();
1219  //lowerPadRight->SetLeftMargin(0.09);
1220  //lowerPadRight->SetRightMargin(0.06);
1221  fCellAmplitude->SetXTitle("Cell Energy [GeV]");
1222  fCellAmplitude->SetYTitle("Abs. Cell Id");
1223  fCellAmplitude->Draw("colz");
1224  c1->cd(2)->SetLogz();
1225  fCellTime->SetXTitle("Cell Time [ns]");
1226  fCellTime->SetYTitle("Abs. Cell Id");
1227  fCellTime->Draw("colz");
1228  c1->cd(3)->SetLogz();
1229  //lowerPadRight->SetLeftMargin(0.09);
1230  //lowerPadRight->SetRightMargin(0.06);
1231  cellAmp_masked->SetTitle("Masked Cell Amplitude");
1232  cellAmp_masked->SetXTitle("Cell Energy [GeV]");
1233  cellAmp_masked->SetYTitle("Abs. Cell Id");
1234  cellAmp_masked->Draw("colz");
1235  c1->cd(4)->SetLogz();
1236  cellTime_masked->SetTitle("Masked Cell Time");
1237  cellTime_masked->SetXTitle("Cell Time [ns]");
1238  cellTime_masked->SetYTitle("Abs. Cell Id");
1239  cellTime_masked->Draw("colz");
1240 
1241 
1242 
1243 
1244  c1->Update();
1245  TString name =Form("%s/%s/CellProperties.gif", fWorkdir.Data(),fAnalysisOutput.Data());
1246  c1->SaveAs(name);
1247  fRootFile->WriteObject(c1,c1->GetName());
1248  fRootFile->WriteObject(fCellAmplitude,fCellAmplitude->GetName());
1249  fRootFile->WriteObject(fCellTime,fCellTime->GetName());
1250 
1251 
1252  PlotFlaggedCells2D(0); //..all good cells
1253  PlotFlaggedCells2D(1); //..all dead cells
1254  PlotFlaggedCells2D(2,fCriterionCounter); //..all bad cells
1255 
1256 
1257  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1258  //..Save the flagged cells to .pdf files
1259  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1260  //cout<<" o Save the Dead channel spectra to a .pdf file"<<endl;
1261  //SaveBadCellsToPDF(0,deadPdfName);
1262  cout<<" o Save the bad channel spectra to a .pdf file"<<endl;
1263  SaveBadCellsToPDF(1,badPdfName) ;
1264  SaveBadCellsToPDF(10,ratioOfBad) ; //..Special case
1265  if(fTestRoutine==1)SaveBadCellsToPDF(2,goodCells) ; //..Special case all good cells to check, should all have a flag naming them *Candidate*
1266 
1267  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1268  //..Add the amplitude distributions to the output root file
1269  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1270  cout<<" o Save all amplitues to a .root file"<<endl;
1271  SaveHistoToFile();
1272  cout<<" o Results can be found in : "<<endl;
1273  //cout<<" o "<<cellSummaryFile<<endl;
1274  //cout<<" o "<<badPdfName<<endl;
1275  //cout<<" o "<<badPdfName<<endl;
1276 
1277 }
1278 
1279 
1294 //________________________________________________________________________
1296 {
1297  gROOT->SetStyle("Plain");
1298  gStyle->SetOptStat(0);
1299  gStyle->SetFillColor(kWhite);
1300  gStyle->SetTitleFillColor(kWhite);
1301  gStyle->SetPalette(1);
1302 
1303  char title[100];
1304  char name[100];
1305 
1306  TH1D *hRefDistr = BuildMeanFromGood();
1307  fRootFile->WriteObject(hRefDistr,hRefDistr->GetName());
1308  Int_t firstCanvas=0;
1309  Bool_t candidate;
1310  TLatex* text = new TLatex(0.2,0.8,"*Candidate*");
1311  text->SetTextSize(0.06);
1312  text->SetTextColor(8);
1313  text->SetNDC();
1314  text->SetTextColor(1);
1315 
1316  TLatex* text2 = new TLatex(0.2,0.8,"*Not a Candidate*");
1317  text2->SetTextSize(0.08);
1318  text2->SetTextColor(8);
1319 
1320  //..collect cells in an internal vector.
1321  //..when the vector is of size=9 or at the end of being filled
1322  //..plot the channels into a canvas
1323  std::vector<Int_t> channelVector;
1324  channelVector.clear();
1325  cout<<"Start printing into .pdf for version: "<<version<<endl;
1326  for(Int_t cell=0;cell<fNoOfCells;cell++)
1327  {
1328  if(fFlag[cell]==1 && version==0)channelVector.push_back(cell);
1329  if(fFlag[cell]>1 && version==1)channelVector.push_back(cell);
1330  if(fFlag[cell]==0 && version==2)channelVector.push_back(cell);
1331  if(fFlag[cell]>1 && version==10)channelVector.push_back(cell);
1332 
1333  if(cell%2000==0)cout<<"...cell No."<<cell<<endl;
1334  //..when 9 bad cells are collected or we are at the end of the list, fill the canvas
1335  if(channelVector.size()==9 || cell == fNoOfCells-1)
1336  {
1337  cout<<"."<<flush;
1338 
1339  TString internal_pdfName=pdfName;
1340  TCanvas *c1 = new TCanvas("badcells","badcells",1000,750);
1341  if(channelVector.size() > 6) c1->Divide(3,3);
1342  else if (channelVector.size() > 3) c1->Divide(3,2);
1343  else c1->Divide(3,1);
1344 
1345  TLegend *leg = new TLegend(0.7, 0.7, 0.9, 0.9);
1346  for(Int_t i=0; i< (Int_t)channelVector.size() ; i++)
1347  {
1348  sprintf(name, "Cell %d",channelVector.at(i)) ;
1349  TH1 *hCell = fCellAmplitude->ProjectionX(name,channelVector.at(i)+1,channelVector.at(i)+1);
1350  sprintf(title,"Cell No: %d Entries: %d",channelVector.at(i), (Int_t)hCell->GetEntries()) ;
1351 
1352  c1->cd(i%9 + 1);
1353  c1->cd(i%9 + 1)->SetLogy();
1354  if(i==0)
1355  {
1356  leg->AddEntry(hRefDistr,"mean of good","l");
1357  leg->AddEntry(hCell,"current","l");
1358  }
1359  if(version>1)//..These are ratio plots of energy distr. of cell and mean of all good cells
1360  {
1361  //cout<<"bin nr: "<<ChannelVector.at(i)<<endl;
1362  hCell->Divide(hRefDistr);
1363  //..Check the distribution whether it looks like a *Candidate* for a miscalibrated warm cell
1364  candidate = CheckDistribution(hCell,hRefDistr);
1365  }
1366  //.. save histograms to file
1367  if(version==1) fOutputListBad->Add(hCell);
1368  if(version==10)fOutputListBadRatio->Add(hCell);
1369  if(version==2) fOutputListGoodRatio->Add(hCell);
1370 
1371  hCell->SetLineColor(kBlue+1);
1372  hCell->GetXaxis()->SetTitle("E (GeV)");
1373  hCell->GetYaxis()->SetTitle("N Entries");
1374  hCell->GetXaxis()->SetRangeUser(0.,10.);
1375  hCell->SetLineWidth(1) ;
1376  hCell->SetTitle(title);
1377  hRefDistr->SetLineColor(kGray+2);
1378  hRefDistr->SetLineWidth(1);
1379 
1380  if(version!=10)hCell->Draw("hist");
1381  if(version==10)
1382  {
1383  if(fTestRoutine==0 && candidate==1)hCell->Draw("hist"); //..Draw those cells that are labled as a candidate for wam cells
1384  if(fTestRoutine==1) hCell->Draw("hist"); //..In case we are running in QA mode plot all Bad Cell distributions
1385  }
1386  if(version==1)hRefDistr->Draw("same") ;
1387  if(version==10 && candidate==1)text->Draw(); //..Draw a marker in the histogram that could be miscalibrated and labelled as warm
1388  if(version==2 && candidate==0)text2->Draw(); //..Draw a marker in the histogram that was falsley missed as a good candidate
1389  if(version==2 && candidate==0)leg->Draw();
1390  if(version<2)leg->Draw();
1391  }
1392 
1393  if(channelVector.size()<9 || cell == fNoOfCells-1)
1394  {
1395  internal_pdfName +=")";
1396  c1->Print(internal_pdfName.Data());
1397  }
1398  else if(firstCanvas==0)
1399  {
1400  internal_pdfName +="(";
1401  c1->Print(internal_pdfName.Data());
1402  firstCanvas=1;
1403  }
1404  else
1405  {
1406  c1->Print(internal_pdfName.Data());
1407  }
1408  delete c1;
1409  delete leg;
1410  channelVector.clear();
1411  }
1412  }
1413  delete hRefDistr;
1414  //..Add the subdirectories to the file
1415  if(version==1) fRootFile->WriteObject(fOutputListBad,fOutputListBad->GetName());
1416  if(version==10)fRootFile->WriteObject(fOutputListBadRatio,fOutputListBadRatio->GetName());
1417  if(version==2) fRootFile->WriteObject(fOutputListGoodRatio,fOutputListGoodRatio->GetName());
1418 
1419  cout<<endl;
1420 }
1424 //_________________________________________________________________________
1426 {
1427  TH1D* hGoodAmp;
1428  TH1D* hgoodMean;
1429  Int_t NrGood=0;
1430  for (Int_t cell = 0; cell < fNoOfCells; cell++)
1431  {
1432  if(fFlag[cell]!=0)continue;
1433  NrGood++;
1434  if(NrGood==1)hgoodMean = (TH1D*)fCellAmplitude->ProjectionX("hgoodMean",cell+1,cell+1);
1435  else
1436  {
1437  hGoodAmp = (TH1D*)fCellAmplitude->ProjectionX("hGoodCells",cell+1,cell+1);
1438  hgoodMean->Add(hGoodAmp);
1439  }
1440  }
1441  hgoodMean->Scale(1.0/NrGood);
1442 
1443  return hgoodMean;
1444 }
1455 //_________________________________________________________________________
1457 {
1458  Double_t percentageOfLast=0.6;
1459  Double_t higherThanMean=5;
1460  Double_t highestRatio=1000;
1461  Double_t cliffSize=2; //height before cliff shouldn't be double as high than after cliff
1462 
1463  //..By default each cell is a candidate for recalibration
1464  Bool_t candidate=1;
1465  //..Find bin where reference has value 1, and the corresponding x-value
1466  Int_t binHeihgtOne = reference->FindLastBinAbove(1);
1467  Double_t binCentreHeightOne = reference->GetBinCenter(binHeihgtOne);
1468  Double_t thirdBinCentre = reference->GetBinCenter(3);
1469 
1470  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1471  //..Check the histogram
1472  //..Different checks to see whether the
1473  //..cell is really bad. Set candidate to 0.
1474 
1475  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1476  //..check end of spectrum, should be larger than "percentageOfLast"% of the end of the mean histogram
1477  if(ratio->FindLastBinAbove(0)<ratio->FindBin(binCentreHeightOne*percentageOfLast))
1478  {
1479  candidate=0;
1480  }
1481 
1482  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1483  //..Check maximum of ratio. Cell should not have "highestRatio" times more entries than reference in any bin
1484  //ELI check that crieteria carfully - seems to work but not shure about it
1485  ratio->GetXaxis()->SetRangeUser(thirdBinCentre,10);//..zoom in to find the maximum between "not first 2 bins" - 10 GeV
1486  if(ratio->GetMaximum()>highestRatio)//
1487  {
1488  candidate=0;
1489  }
1490 
1491  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1492  //..check whether there are large spikes in the histogram
1493  //..compare bin values to mean of the ratio. If there is a bin value with
1494  //..content "higherThanMean" times lareger than mean it's losing it candidate status
1495  Double_t mean=0;
1496  //..Find the maximum in the mean range (0-binHeihgtOne)
1497  ratio->GetXaxis()->SetRangeUser(0,binCentreHeightOne);
1498  Double_t localMaxBin=ratio->GetMaximumBin();
1499 
1500  for(Int_t i=2;i<binHeihgtOne;i++)
1501  {
1502  //..Exclude 0 bins and exclude bins near the maximum
1503  if(ratio->GetBinContent(i)<=0) continue;
1504  if(i>localMaxBin-3 && i<localMaxBin+3)continue;
1505  mean+=ratio->GetBinContent(i);
1506  }
1507  mean*=1.0/(binHeihgtOne-1);//..divide by number of bins
1508  ratio->GetXaxis()->SetRangeUser(thirdBinCentre,binCentreHeightOne);//..zoom in to find the maximum between 0-BinOne
1509  //cout<<"mean: "<<mean<<", max: "<<ratio->GetMaximum()<<endl;
1510  if(ratio->GetMaximum()>mean*higherThanMean)
1511  {
1512  candidate=0;
1513  }
1514 
1515  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1516  //..Check for a cliff at 4GeV, happens in some cases
1517  Double_t beforeCliff=0;
1518  Double_t afterCliff=0;
1519  Int_t binsBefore=0;
1520  Int_t binsAfter=0;
1521  Int_t cliffBin = ratio->FindBin(4);
1522  for(Int_t i=cliffBin-10;i<cliffBin+11;i++)
1523  {
1524  //..Exclude 0 bins
1525  if(ratio->GetBinContent(i)<=0)continue;
1526  if(i<=cliffBin) binsBefore++;
1527  if(i>cliffBin) binsAfter++;
1528  if(i<=cliffBin) beforeCliff+=ratio->GetBinContent(i);
1529  if(i>cliffBin) afterCliff+=ratio->GetBinContent(i);
1530  beforeCliff*=1.0/binsBefore;
1531  afterCliff*=1.0/binsAfter;
1532  }
1533  if((beforeCliff-afterCliff)>cliffSize*afterCliff)
1534  {
1535  if(beforeCliff!=0 && afterCliff!=0)candidate=0;
1536  }
1537 
1538  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1539  //..Employ peak finder
1540 /* if(candidate==1)
1541  {
1542  TSpectrum *spec = new TSpectrum(2,1); //..Nr peaks, resol. 1=3sigma distance
1543  Int_t nfound = spec->Search(ratio,4.3,"nobackground new",0.70);
1544  //GetNPeaks();
1545  //cout<<"found N peaks: "<<nfound<<endl;
1546  }
1547 */
1548  return candidate;
1549 }
1550 
1559 //_________________________________________________________________________
1561 {
1562  //..TRD support structure
1563  //..(determined by eye, could be improved, but is already very acurate):
1564  //..collumn 4,5,6,7,8 33,34,35,36 58,59,60 85,86,87,88,89
1565  //..row 1 (21),22,23,24 45,46,47,(48) 69,70,71,(72) (92),93,94,95 117,118,(119) 127 149,150,151 (173),174,175,(176) 198,199,200
1566  Bool_t coveredByTRDSupportStruc=0;
1567 
1568  if((collumn>3 && collumn<9) || (collumn>32 && collumn<37) || (collumn>57 && collumn<61) || (collumn>84 && collumn<90) ||
1569  (row==1) ||(row>20 && row<25) || (row>44 && row<49) || (row>68 && row<73) || (row>91 && row<96) ||
1570  (row>116 && row<120)|| row==127 || (row>148 && row<152) || (row>172 && row<177) || (row>197 && row<201)
1571  )
1572  {
1573  coveredByTRDSupportStruc=1;
1574  }
1575  return coveredByTRDSupportStruc;
1576 }
1585 //_________________________________________________________________________
1587 {
1588  //..build two dimensional histogram with values row vs. column
1589  TString histoName = Form("HitRowColumn_Flag%d",flagBegin);
1590  TH2F *plot2D = new TH2F(histoName,histoName,fNMaxColsAbs+2,-1.5,fNMaxColsAbs+0.5, fNMaxRowsAbs+2,-1.5,fNMaxRowsAbs+0.5);
1591  plot2D->GetXaxis()->SetTitle("cell column (#eta direction)");
1592  plot2D->GetYaxis()->SetTitle("cell row (#phi direction)");
1593 
1594  Int_t cellColumn=0,cellRow=0;
1595  Int_t cellColumnAbs=0,cellRowAbs=0;
1596  Int_t trash;
1597 
1598  for (Int_t cell = 0; cell < fNoOfCells; cell++)
1599  {
1600  //..Do that only for cell ids also accepted by the code
1601  if(!fCaloUtils->GetEMCALGeometry()->CheckAbsCellId(cell))continue;
1602 
1603  //..Get Row and Collumn for cell ID c
1604  fCaloUtils->GetModuleNumberCellIndexesAbsCaloMap(cell,0,cellColumn,cellRow,trash,cellColumnAbs,cellRowAbs);
1605  if(cellColumnAbs> fNMaxColsAbs || cellRowAbs>fNMaxRowsAbs)
1606  {
1607  cout<<"Problem! wrong calculated number of max col and max rows"<<endl;
1608  cout<<"current col: "<<cellColumnAbs<<", max col"<<fNMaxColsAbs<<endl;
1609  cout<<"current row: "<<cellRowAbs<<", max row"<<fNMaxRowsAbs<<endl;
1610  }
1611  if(flagEnd==-1 && fFlag[cell]==flagBegin) plot2D->SetBinContent(cellColumnAbs,cellRowAbs,1);
1612  if(flagEnd!=-1 && fFlag[cell]>=flagBegin && fFlag[cell]<=flagEnd)plot2D->SetBinContent(cellColumnAbs,cellRowAbs,1);
1613  }
1614  TCanvas *c1 = new TCanvas(histoName,histoName,500,500);
1615  c1->ToggleEventStatus();
1616  c1->cd();
1617  //lowerPadRight->SetLeftMargin(0.09);
1618  //lowerPadRight->SetRightMargin(0.06);
1619  plot2D->Draw("colz");
1620 
1621  TLatex* text = 0x0;
1622  if(flagBegin==0) text = new TLatex(0.2,0.8,"Good Cells");
1623  if(flagBegin==1) text = new TLatex(0.2,0.8,"Dead Cells");
1624  if(flagBegin>1) text = new TLatex(0.2,0.8,"Bad Cells");
1625  text->SetTextSize(0.06);
1626  text->SetNDC();
1627  text->SetTextColor(1);
1628  text->Draw();
1629 
1630  c1->Update();
1631  TString name =Form("%s/%s/2DChannelMap_Flag%d.gif", fWorkdir.Data(),fAnalysisOutput.Data(), flagBegin);
1632  c1->SaveAs(name);
1633 
1634  fRootFile->WriteObject(plot2D,plot2D->GetName());
1635 
1636 }
1640 //_________________________________________________________________________
1642 {
1643  char name[100];
1644  for(Int_t cell=0;cell<fNoOfCells;cell++)
1645  {
1646  sprintf(name, "Cell %d",cell) ;
1647  TH1 *hCell = fCellAmplitude->ProjectionX(name,cell+1,cell+1);
1648  if(fFlag[cell]==0)fOutputListGood->Add(hCell);
1649  }
1650  fRootFile->WriteObject(fOutputListGood,fOutputListGood->GetName());
1651 }
TH1F * BuildTimeMean(Int_t crit, Double_t emin, Double_t emax, Double_t nsigma)
double Double_t
Definition: External.C:58
void SetRunNumber(Int_t run)
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:26
void AddPeriodAnalysis(Int_t criteria, Double_t nsigma, Double_t emin, Double_t emax)
TH2F * fCellTime
! possible histogram for the analysis. Cell ID vs. time, read from the input merged file ...
Int_t fNMaxRows
Maximum No of rows in module (phi direction)
Int_t fTrial
Number of trial that this specific analyis is. By default '0' so one can try different settings witho...
TString fileName
TFile * fRootFile
! root file with all histograms from this analysis
TSystem * gSystem
std::vector< TArrayD > fAnalysisVector
Vector of analysis information. Each place is filled with 4 doubles: version, sigma, lower, and upper energy range.
TH1F * fProcessedEvents
! Stores the number of events in the run
Int_t fNoOfCells
Number of cells in EMCal and DCal.
AliCalorimeterUtils * fCaloUtils
! Calorimeter information for the investigated runs
Int_t fCellStartDCal
ID of the first cell in the DCal.
TString fPass
Pass of the analyzed data.
Int_t * fFlag
! fFlag[CellID] = 0 (ok),1 (dead),2 and higher (bad certain criteria) start at 0 (cellID 0 = histobin...
Int_t fNMaxCols
Maximum No of colums in module (eta direction)
Int_t fCriterionCounter
! This value will be written in fflag and updates after each PeriodAnalysis, to distinguish the steps...
TString fMergedFileName
Filename of the .root file containing the merged runs.
AliEMCALGeometry * GetEMCALGeometry() const
int Int_t
Definition: External.C:63
TList * fOutputListBadRatio
! list with bad channel amplitude ratios, stored in fRootFile
TString fAnalysisInput
Here the .root files of each run of the period are saved.
void TestCellShapes(Int_t crit, Double_t fitemin, Double_t fitemax, Double_t nsigma=4.)
TString fQADirect
Dierctory in the QA.root files where the input histograms are stored.
Definition: External.C:212
TString fWorkdir
Directory which contains the folders fMergeOutput, fAnalysisInput and fAnalysisOutput. By default it is './'.
void FlagAsBad(Int_t crit, TH1F *inhisto, Double_t nsigma=4., Int_t dnbins=200, Double_t dmaxval=-1.)
TList * fOutputListBad
! list with bad channel amplitudes, stored in fRootFile
Bool_t IsCoveredByTRD(Int_t row, Int_t collumn)
Double_t nsigma
TString fExternalFileName
If you have already a file that contains many runs merged together you can place it in fMergeOutput a...
TString fPeriod
The name of the analyzed period.
const char * pdfName
Definition: DrawAnaELoss.C:30
void PlotFlaggedCells2D(Int_t flagBegin, Int_t flagEnd=-1)
TH1F * BuildHitAndEnergyMean(Int_t crit, Double_t emin=0.1, Double_t emax=2., Double_t nsigma=4.)
TString fTrigger
Selected trigger for the analysis.
Bool_t CheckDistribution(TH1 *ratio, TH1 *reference)
Int_t fNMaxRowsAbs
Maximum No of rows in Calorimeter.
Int_t fNMaxColsAbs
Maximum No of colums in Calorimeter.
void PeriodAnalysis(Int_t criterum=7, Double_t nsigma=4.0, Double_t emin=0.1, Double_t emax=2.0)
Bool_t fTestRoutine
This is a flag, if set true will produce some extra quality check histograms.
TList * fOutputListGood
! list with good channel amplitudes, stored in fRootFile
Analyses cell properties and identifies bad cells.
TString fAnalysisOutput
The list with bad channels and histograms are saved in this folder.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TFile * file
TList * fOutputListGoodRatio
! list with good channel amplitude ratios, stored in fRootFile
bool Bool_t
Definition: External.C:53
Class with utils specific to calorimeter clusters/cells.
void AccessGeometry(AliVEvent *inputEvent)
TH2F * fCellAmplitude
! main histogram for the analysis. Cell ID vs. amplitude, read from the input merged file ...
void SaveBadCellsToPDF(Int_t version, TString pdfName)
TString fRunListFileName
This is the name of the file with the run numbers to be merged, by default it's 'runList.txt'.
Int_t fCurrentRunNumber
A run number of an analyzed period. This is important for the AliCalorimeterUtils initialization...
Definition: External.C:196
TString fRunList
Thats the full path and name of the file which contains a list of all runs to be merged together...
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