AliPhysics  879ce3b (879ce3b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
AliCalorimeterUtils.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 <TGeoManager.h>
18 #include <TH2F.h>
19 #include <TCanvas.h>
20 #include <TStyle.h>
21 #include <TPad.h>
22 #include <TFile.h>
23 #include <TParticle.h>
24 
25 // --- ANALYSIS system ---
26 #include "AliCalorimeterUtils.h"
27 #include "AliESDEvent.h"
28 #include "AliMCEvent.h"
29 #include "AliStack.h"
30 #include "AliAODPWG4Particle.h"
31 #include "AliVCluster.h"
32 #include "AliVCaloCells.h"
33 #include "AliAODCaloCluster.h"
34 #include "AliOADBContainer.h"
35 #include "AliAnalysisManager.h"
36 #include "AliAODMCParticle.h"
37 #include "AliLog.h"
38 
39 // --- Detector ---
40 #include "AliEMCALGeometry.h"
41 #include "AliPHOSGeoUtils.h"
42 
46 
47 
48 //____________________________________________
50 //____________________________________________
52 TObject(), fDebug(0),
53 fEMCALGeoName(""),
54 fPHOSGeoName (""),
55 fEMCALGeo(0x0), fPHOSGeo(0x0),
56 fEMCALGeoMatrixSet(kFALSE), fPHOSGeoMatrixSet(kFALSE),
57 fLoadEMCALMatrices(kFALSE), fLoadPHOSMatrices(kFALSE),
58 fRemoveBadChannels(kFALSE), fPHOSBadChannelMap(0x0),
59 fNCellsFromPHOSBorder(0),
60 fNMaskCellColumns(0), fMaskCellColumns(0x0),
61 fRecalibration(kFALSE), fRunDependentCorrection(kFALSE),
62 fPHOSRecalibrationFactors(), fEMCALRecoUtils(new AliEMCALRecoUtils),
63 fRecalculatePosition(kFALSE), fCorrectELinearity(kFALSE),
64 fRecalculateMatching(kFALSE),
65 fCutR(20), fCutZ(20),
66 fCutEta(20), fCutPhi(20),
67 fLocMaxCutE(0), fLocMaxCutEDiff(0),
68 fPlotCluster(0), fOADBSet(kFALSE),
69 fOADBForEMCAL(kFALSE), fOADBForPHOS(kFALSE),
70 fOADBFilePathEMCAL(""), fOADBFilePathPHOS(""),
71 fImportGeometryFromFile(0), fImportGeometryFilePath(""),
72 fNSuperModulesUsed(0), fRunNumber(0),
73 fMCECellClusFracCorrOn(0), fMCECellClusFracCorrParam()
74 {
76  for(Int_t i = 0; i < 22; i++) fEMCALMatrix[i] = 0 ;
77  for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix [i] = 0 ;
78 }
79 
80 //_________________________________________
81 // Destructor.
82 //_________________________________________
84 {
85  //if(fPHOSGeo) delete fPHOSGeo ;
86  if(fEMCALGeo) delete fEMCALGeo ;
87 
89 {
90  fPHOSBadChannelMap->Clear();
91  delete fPHOSBadChannelMap;
92  }
93 
95 {
98  }
99 
100  if(fEMCALRecoUtils) delete fEMCALRecoUtils ;
101  if(fNMaskCellColumns) delete [] fMaskCellColumns;
102 }
103 
104 //____________________________________________________
107 //____________________________________________________
108 void AliCalorimeterUtils::AccessOADB(AliVEvent* event)
109 {
110  // Set it only once
111  if(fOADBSet) return ;
112 
113  if(fRunNumber <= 0) fRunNumber = event->GetRunNumber() ; // take the run number from the event itself
114  TString pass = GetPass();
115 
116  // EMCAL
117  if(fOADBForEMCAL)
118  {
119  AliInfo(Form("Get AODB parameters from EMCAL in %s for run %d, and <%s>",fOADBFilePathEMCAL.Data(),fRunNumber,pass.Data()));
120 
121  Int_t nSM = fEMCALGeo->GetNumberOfSuperModules();
122 
123  // Bad map
125  {
126  AliOADBContainer *contBC=new AliOADBContainer("");
127  contBC->InitFromFile(Form("%s/EMCALBadChannels.root",fOADBFilePathEMCAL.Data()),"AliEMCALBadChannels");
128 
129  TObjArray *arrayBC=(TObjArray*)contBC->GetObject(fRunNumber);
130 
131  if(arrayBC)
132  {
134  AliInfo("Remove EMCAL bad cells");
135 
136  for (Int_t i=0; i<nSM; ++i)
137  {
138  TH2I *hbm = GetEMCALChannelStatusMap(i);
139 
140  if (hbm)
141  delete hbm;
142 
143  hbm=(TH2I*)arrayBC->FindObject(Form("EMCALBadChannelMap_Mod%d",i));
144 
145  if (!hbm)
146  {
147  AliError(Form("Can not get EMCALBadChannelMap_Mod%d",i));
148  continue;
149  }
150 
151  hbm->SetDirectory(0);
153 
154  } // loop
155  } else AliInfo("Do NOT remove EMCAL bad channels\n"); // run array
156 
157  delete contBC;
158  } // Remove bad
159 
160  // Energy Recalibration
161  if(fRecalibration)
162  {
163  AliOADBContainer *contRF=new AliOADBContainer("");
164 
165  contRF->InitFromFile(Form("%s/EMCALRecalib.root",fOADBFilePathEMCAL.Data()),"AliEMCALRecalib");
166 
167  TObjArray *recal=(TObjArray*)contRF->GetObject(fRunNumber);
168 
169  if(recal)
170  {
171  TObjArray *recalpass=(TObjArray*)recal->FindObject(pass);
172 
173  if(recalpass)
174  {
175  TObjArray *recalib=(TObjArray*)recalpass->FindObject("Recalib");
176 
177  if(recalib)
178  {
179  AliInfo("Recalibrate EMCAL");
180  for (Int_t i=0; i < nSM; ++i)
181  {
183 
184  if (h)
185  delete h;
186 
187  h = (TH2F*)recalib->FindObject(Form("EMCALRecalFactors_SM%d",i));
188 
189  if (!h)
190  {
191  AliError(Form("Could not load EMCALRecalFactors_SM%d",i));
192  continue;
193  }
194 
195  h->SetDirectory(0);
196 
198  } // SM loop
199  } else AliInfo("Do NOT recalibrate EMCAL, no params object array"); // array ok
200  } else AliInfo("Do NOT recalibrate EMCAL, no params for pass"); // array pass ok
201  } else AliInfo("Do NOT recalibrate EMCAL, no params for run"); // run number array ok
202 
203  delete contRF;
204  // once set, apply run dependent corrections if requested
205  //fEMCALRecoUtils->SetRunDependentCorrections(fRunNumber);
206 
207  } // Recalibration on
208 
209  // Energy Recalibration, apply on top of previous calibration factors
211  {
212  AliOADBContainer *contRFTD=new AliOADBContainer("");
213 
214  contRFTD->InitFromFile(Form("%s/EMCALTemperatureCorrCalib.root",fOADBFilePathEMCAL.Data()),"AliEMCALRunDepTempCalibCorrections");
215 
216  TH1S *htd=(TH1S*)contRFTD->GetObject(fRunNumber);
217 
218  //If it did not exist for this run, get closes one
219  if (!htd)
220  {
221  AliWarning(Form("No TemperatureCorrCalib Objects for run: %d",fRunNumber));
222  // let's get the closest fRunNumber instead then..
223  Int_t lower = 0;
224  Int_t ic = 0;
225  Int_t maxEntry = contRFTD->GetNumberOfEntries();
226 
227  while ( (ic < maxEntry) && (contRFTD->UpperLimit(ic) < fRunNumber) )
228  {
229  lower = ic;
230  ic++;
231  }
232 
233  Int_t closest = lower;
234  if ( (ic<maxEntry) &&
235  (contRFTD->LowerLimit(ic)-fRunNumber) < (fRunNumber - contRFTD->UpperLimit(lower)) )
236  {
237  closest = ic;
238  }
239 
240  AliWarning(Form("TemperatureCorrCalib Objects found closest id %d from run: %d", closest, contRFTD->LowerLimit(closest)));
241  htd = (TH1S*) contRFTD->GetObjectByIndex(closest);
242  }
243 
244  if(htd)
245  {
246  AliInfo("Recalibrate (Temperature) EMCAL");
247 
248  for (Int_t ism=0; ism<nSM; ++ism)
249  {
250  for (Int_t icol=0; icol<48; ++icol)
251  {
252  for (Int_t irow=0; irow<24; ++irow)
253  {
254  Float_t factor = GetEMCALChannelRecalibrationFactor(ism,icol,irow);
255 
256  Int_t absID = fEMCALGeo->GetAbsCellIdFromCellIndexes(ism, irow, icol); // original calibration factor
257  factor *= htd->GetBinContent(absID) / 10000. ; // correction dependent on T
258 
259  //printf("\t ism %d, icol %d, irow %d,absID %d, corrA %2.3f, corrB %2.3f, corrAB %2.3f\n",ism, icol, irow, absID,
260  // GetEMCALChannelRecalibrationFactor(ism,icol,irow) , htd->GetBinContent(absID) / 10000., factor);
261 
262  SetEMCALChannelRecalibrationFactor(ism,icol,irow,factor);
263  } // columns
264  } // rows
265  } // SM loop
266  } else AliInfo("Do NOT recalibrate EMCAL with T variations, no params TH1");
267 
268  delete contRFTD;
269  } // Run by Run T calibration
270 
271  // Time Recalibration
272  if(fEMCALRecoUtils->IsTimeRecalibrationOn())
273  {
274  AliOADBContainer *contTRF=new AliOADBContainer("");
275 
276  contTRF->InitFromFile(Form("%s/EMCALTimeCalib.root",fOADBFilePathEMCAL.Data()),"AliEMCALTimeCalib");
277 
278  TObjArray *trecal=(TObjArray*)contTRF->GetObject(fRunNumber);
279 
280  if(trecal)
281  {
282  TString passM = pass;
283  if(pass=="spc_calo") passM = "pass3";
284  TObjArray *trecalpass=(TObjArray*)trecal->FindObject(passM);
285 
286  if(trecalpass)
287  {
288  AliInfo("Time Recalibrate EMCAL");
289  for (Int_t ibc = 0; ibc < 4; ++ibc)
290  {
292 
293  if (h)
294  delete h;
295 
296  h = (TH1F*)trecalpass->FindObject(Form("hAllTimeAvBC%d",ibc));
297 
298  if (!h)
299  {
300  AliError(Form("Could not load hAllTimeAvBC%d",ibc));
301  continue;
302  }
303 
304  h->SetDirectory(0);
305 
307  } // bunch crossing loop
308  } else AliInfo("Do NOT recalibrate time EMCAL, no params for pass"); // array pass ok
309  } else AliInfo("Do NOT recalibrate time EMCAL, no params for run"); // run number array ok
310 
311  delete contTRF;
312  } // Time Recalibration on
313 
314  // Time L1 phase racalibration
315  if(fEMCALRecoUtils->IsL1PhaseInTimeRecalibrationOn()) {
316  Bool_t useDefault=kFALSE;
317  AliOADBContainer *contTRF=new AliOADBContainer("");
318  contTRF->InitFromFile(Form("%s/EMCALTimeL1PhaseCalib.root",fOADBFilePathEMCAL.Data()),"AliEMCALTimeL1PhaseCalib");
319  TObjArray *trecal=(TObjArray*)contTRF->GetObject(fRunNumber);
320  if(!trecal) {
321  AliError(Form("Do NOT recalibrate time EMCAL. No params for run %d. Default used.",fRunNumber)); // run number array ok
322  trecal=(TObjArray*)contTRF->GetObject(0);
323  if(!trecal) {
324  AliFatal(Form("No params for run %d. No default params.",fRunNumber));
325  return;
326  }
327  useDefault=kTRUE;
328  }
329 
330  TString passM = pass;
331  if(useDefault) passM = "pass1";
332  else if(pass=="muon_calo") passM = "pass0";
333 
334  TObjArray *trecalpass=(TObjArray*)trecal->FindObject(passM);
335  if(!trecalpass) {
336  if(useDefault){
337  AliFatal("No defaults params pass1.");
338  return;
339  }
340  AliInfo("Do NOT recalibrate time EMCAL, no params for pass"); // array pass ok
341  //use default
342  trecal->Delete();
343  trecal=(TObjArray*)contTRF->GetObject(0);
344  if(!trecal) {
345  AliFatal(Form("No params for run %d. No default params.",fRunNumber));
346  return;
347  }
348  useDefault=kTRUE;
349  trecalpass=(TObjArray*)trecal->FindObject("pass1");
350  if(!trecalpass) {
351  AliFatal("No defaults params pass1.");
352  return;
353  }
354  //end use default
355  }
356  AliInfo("Time L1 phase Recalibrate EMCAL");
358  if (h) delete h;
359  h = (TH1C*)trecalpass->FindObject(Form("h%d",fRunNumber));
360  if (!h) AliError(Form("Could not load h%d",fRunNumber));
361  h->SetDirectory(0);
363 
364  delete contTRF;
365  }//End of Time L1 phase racalibration
366 
367  }// EMCAL
368 
369  // PHOS
370  if(fOADBForPHOS)
371  {
372  AliInfo(Form("Get AODB parameters from PHOS in %s for run %d, and <%s>",fOADBFilePathPHOS.Data(),fRunNumber,pass.Data()));
373 
374  // Bad map
376  {
377  AliOADBContainer badmapContainer(Form("phosBadMap"));
378  TString fileName="$ALICE_PHYSICS/OADB/PHOS/PHOSBadMaps.root";
379  badmapContainer.InitFromFile(Form("%s/PHOSBadMaps.root",fOADBFilePathPHOS.Data()),"phosBadMap");
380 
381  //Use a fixed run number from year 2010, this year not available yet.
382  TObjArray *maps = (TObjArray*)badmapContainer.GetObject(139000,"phosBadMap");
383  if(!maps)
384  {
385  AliInfo(Form("Can not read PHOS bad map for run %d",fRunNumber)) ;
386  }
387  else
388  {
389  AliInfo(Form("Setting PHOS bad map with name %s",maps->GetName())) ;
390 
391  for(Int_t mod = 1; mod < 5; mod++)
392  {
393  TH2I *hbmPH = GetPHOSChannelStatusMap(mod);
394 
395  if(hbmPH)
396  delete hbmPH ;
397 
398  hbmPH = (TH2I*)maps->At(mod);
399 
400  if(hbmPH) hbmPH->SetDirectory(0);
401 
402  SetPHOSChannelStatusMap(mod-1,hbmPH);
403 
404  } // modules loop
405  } // maps exist
406  } // Remove bad channels
407  } // PHOS
408 
409  // Parameters already set once, so do not it again
410  fOADBSet = kTRUE;
411 }
412 
413 //_____________________________________________________________
416 //_____________________________________________________________
417 void AliCalorimeterUtils::AccessGeometry(AliVEvent* inputEvent)
418 {
419  // First init the geometry, a priory not done before
420  if(fRunNumber <=0 ) fRunNumber = inputEvent->GetRunNumber() ;
421 
422  InitPHOSGeometry ();
424 
425  //Get the EMCAL transformation geometry matrices from ESD
427  {
429  {
430  AliInfo("Load user defined EMCAL geometry matrices");
431 
432  // OADB if available
433  AliOADBContainer emcGeoMat("AliEMCALgeo");
434  emcGeoMat.InitFromFile(Form("%s/EMCALlocal2master.root",fOADBFilePathEMCAL.Data()),"AliEMCALgeo");
435  TObjArray *matEMCAL=(TObjArray*)emcGeoMat.GetObject(fRunNumber,"EmcalMatrices");
436 
437  for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
438  {
439  if (!fEMCALMatrix[mod]) // Get it from OADB
440  {
441  AliDebug(1,Form("EMCAL matrices SM %d, %p", mod,((TGeoHMatrix*) matEMCAL->At(mod))));
442  //((TGeoHMatrix*) matEMCAL->At(mod))->Print();
443 
444  fEMCALMatrix[mod] = (TGeoHMatrix*) matEMCAL->At(mod) ;
445  }
446 
447  if(fEMCALMatrix[mod])
448  {
449  if(fDebug > 1)
450  fEMCALMatrix[mod]->Print();
451 
452  fEMCALGeo->SetMisalMatrix(fEMCALMatrix[mod],mod) ;
453  }
454  else if(gGeoManager)
455  {
456  AliWarning(Form("Set matrix for SM %d from gGeoManager",mod));
457  fEMCALGeo->SetMisalMatrix(fEMCALGeo->GetMatrixForSuperModuleFromGeoManager(mod),mod) ;
458  }
459  else
460  {
461  AliError(Form("Alignment atrix for SM %d is not available",mod));
462  }
463  } // SM loop
464 
465  fEMCALGeoMatrixSet = kTRUE;//At least one, so good
466 
467  } // Load matrices
468  else if (!gGeoManager)
469  {
470  AliDebug(1,"Load EMCAL misalignment matrices");
471  if(!strcmp(inputEvent->GetName(),"AliESDEvent"))
472  {
473  for(Int_t mod = 0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++)
474  {
475  //printf("Load ESD matrix %d, %p\n",mod,((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod));
476  if(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod))
477  {
478  fEMCALGeo->SetMisalMatrix(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod),mod) ;
479  }
480  }// loop over super modules
481 
482  fEMCALGeoMatrixSet = kTRUE;//At least one, so good
483 
484  }//ESD as input
485  else
486  {
487  AliDebug(1,"Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file");
488  }//AOD as input
489  }//Get matrix from data
490  else if(gGeoManager)
491  {
492  fEMCALGeoMatrixSet = kTRUE;
493  }
494  }//EMCAL geo && no geoManager
495 
496  //Get the PHOS transformation geometry matrices from ESD
498  {
500  {
501  AliInfo("Load user defined PHOS geometry matrices");
502 
503  // OADB if available
504  AliOADBContainer geomContainer("phosGeo");
505  geomContainer.InitFromFile(Form("%s/PHOSGeometry.root",fOADBFilePathPHOS.Data()),"PHOSRotationMatrixes");
506  TObjArray *matPHOS = (TObjArray*)geomContainer.GetObject(139000,"PHOSRotationMatrixes");
507 
508  for(Int_t mod = 0 ; mod < 5 ; mod++)
509  {
510  if (!fPHOSMatrix[mod]) // Get it from OADB
511  {
512  AliDebug(1,Form("PHOS matrices module %d, %p",mod,((TGeoHMatrix*) matPHOS->At(mod))));
513  //((TGeoHMatrix*) matPHOS->At(mod))->Print();
514 
515  fPHOSMatrix[mod] = (TGeoHMatrix*) matPHOS->At(mod) ;
516  }
517 
518  // Set it, if it exists
519  if(fPHOSMatrix[mod])
520  {
521  if(fDebug > 1 )
522  fPHOSMatrix[mod]->Print();
523 
524  fPHOSGeo->SetMisalMatrix(fPHOSMatrix[mod],mod) ;
525  }
526  }// SM loop
527 
528  fPHOSGeoMatrixSet = kTRUE;//At least one, so good
529 
530  }//Load matrices
531  else if (!gGeoManager)
532  {
533  AliDebug(1,"Load PHOS misalignment matrices.");
534  if(!strcmp(inputEvent->GetName(),"AliESDEvent"))
535  {
536  for(Int_t mod = 0; mod < 5; mod++)
537  {
538  if( ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod))
539  {
540  //printf("PHOS: mod %d, matrix %p\n",mod, ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod));
541  fPHOSGeo->SetMisalMatrix( ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod),mod) ;
542  }
543  } // loop over modules
544 
545  fPHOSGeoMatrixSet = kTRUE; //At least one so good
546  } // ESD as input
547  else
548  {
549  AliDebug(1,"Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file");
550  } // AOD as input
551  } // get matrix from data
552  else if(gGeoManager)
553  {
554  fPHOSGeoMatrixSet = kTRUE;
555  }
556  }//PHOS geo and geoManager was not set
557 }
558 
559 //______________________________________________________________________________________
562 //______________________________________________________________________________________
563 Bool_t AliCalorimeterUtils::AreNeighbours(Int_t calo, Int_t absId1, Int_t absId2 ) const
564 {
565  Bool_t areNeighbours = kFALSE ;
566 
567  Int_t iRCU1 = -1, irow1 = -1, icol1 = -1;
568  Int_t iRCU2 = -1, irow2 = -1, icol2 = -1;
569 
570  Int_t rowdiff = 0, coldiff = 0;
571 
572  Int_t nSupMod1 = GetModuleNumberCellIndexes(absId1, calo, icol1, irow1, iRCU1);
573  Int_t nSupMod2 = GetModuleNumberCellIndexes(absId2, calo, icol2, irow2, iRCU2);
574 
575  if(calo==kEMCAL && nSupMod1!=nSupMod2)
576  {
577  // In case of a shared cluster, index of SM in C side, columns start at 48 and ends at 48*2-1
578  // C Side impair SM, nSupMod%2=1; A side pair SM nSupMod%2=0
579  if(nSupMod1%2) icol1+=AliEMCALGeoParams::fgkEMCALCols;
580  else icol2+=AliEMCALGeoParams::fgkEMCALCols;
581  }
582 
583  rowdiff = TMath::Abs( irow1 - irow2 ) ;
584  coldiff = TMath::Abs( icol1 - icol2 ) ;
585 
586  //if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
587  if ((coldiff + rowdiff == 1 ))
588  areNeighbours = kTRUE ;
589 
590  return areNeighbours;
591 }
592 
593 //_________________________________________________________________________________________
596 //_________________________________________________________________________________________
597 Bool_t AliCalorimeterUtils::IsClusterSharedByTwoSuperModules(const AliEMCALGeometry * geom,
598  AliVCluster* cluster)
599 {
600  Int_t iSupMod = -1;
601  Int_t iSM0 = -1;
602  Int_t iTower = -1;
603  Int_t iIphi = -1;
604  Int_t iIeta = -1;
605  Int_t iphi = -1;
606  Int_t ieta = -1;
607 
608  for(Int_t iDigit = 0; iDigit < cluster->GetNCells(); iDigit++)
609  {
610  // Get from the absid the supermodule, tower and eta/phi numbers
611  geom->GetCellIndex(cluster->GetCellAbsId(iDigit),iSupMod,iTower,iIphi,iIeta);
612  geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi,iIeta, iphi,ieta);
613 
614  // Check if there are cells of different SM
615  if (iDigit == 0 ) iSM0 = iSupMod;
616  else if(iSupMod != iSM0)
617  {
618  if(iSupMod > 11 && iSupMod < 18)
619  AliWarning(Form("Cluster shared in 2 DCal: SM%d, SM%d??",iSupMod,iSM0));
620 
621  return kTRUE;
622  }
623  }
624 
625  return kFALSE;
626 }
627 
628 //______________________________________________________________________________
631 //______________________________________________________________________________
632 Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster,
633  AliVCaloCells* cells) const
634 {
635  //If the distance to the border is 0 or negative just exit accept all clusters
636 
637  if ( cells->GetType()==AliVCaloCells::kEMCALCell && fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder() <= 0 ) return kTRUE;
638 
639  if ( cells->GetType()==AliVCaloCells::kPHOSCell && fNCellsFromPHOSBorder <= 0 ) return kTRUE;
640 
641  Int_t absIdMax = -1;
642  Float_t ampMax = -1;
643 
644  for(Int_t i = 0; i < cluster->GetNCells() ; i++)
645  {
646  Int_t absId = cluster->GetCellAbsId(i) ;
647  Float_t amp = cells->GetCellAmplitude(absId);
648 
649  if(amp > ampMax)
650  {
651  ampMax = amp;
652  absIdMax = absId;
653  }
654  }
655 
656  AliDebug(1,Form("Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f",
657  absIdMax, ampMax, cluster->E()));
658 
659  if ( absIdMax == -1 ) return kFALSE;
660 
661  // Check if the cell is close to the borders:
662  Bool_t okrow = kFALSE;
663  Bool_t okcol = kFALSE;
664 
665  if ( cells->GetType() == AliVCaloCells::kEMCALCell )
666  {
667  // It should be the same as AliEMCALRecoUtils::CheckCellFiducialRegion()
668  // Why not calling it?
669 
670  Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1;
671 
672  fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta);
673 
674  fEMCALGeo->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta);
675 
676  if(iSM < 0 || iphi < 0 || ieta < 0 )
677  {
678  AliFatal(Form("Negative value for super module: %d, or cell ieta: %d, or cell iphi: %d, check EMCAL geometry name",iSM,ieta,iphi));
679  }
680 
681  // Check rows/phi
682  Int_t nborder = fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder();
683 
684  if ( iSM < 10 || (iSM > 11 && iSM < 18) ) // Full EMCal (SM0-9) and DCal 2/3 (SM12-17)
685  {
686  if(iphi >= nborder && iphi < 24-nborder) okrow = kTRUE;
687  }
688  else // 1/3 SMs (SM10-11, SM18-19)
689  {
690  if(iphi >= nborder && iphi < 8-nborder) okrow = kTRUE;
691  }
692 
693  // Check columns/eta
694 
695  // Remove all borders if IsEMCALNoBorderAtEta0 or DCal SMs(12-17)
696  if(!fEMCALRecoUtils->IsEMCALNoBorderAtEta0() || (iSM > 11 && iSM < 18))
697  {
698  if(ieta > nborder && ieta < 48-nborder) okcol =kTRUE;
699  }
700  else // Do not remove borders close at eta = 0 for Full EMCal SMs and 1/3 EMCal
701  {
702  if ( iSM%2 == 0 )
703  {
704  if(ieta >= nborder) okcol = kTRUE;
705  }
706  else
707  {
708  if(ieta < 48-nborder) okcol = kTRUE;
709  }
710  } // eta 0 not checked
711 
712  AliDebug(1,Form("EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ? ok row %d, ok column %d",
713  nborder, ieta, iphi, iSM,okrow,okcol));
714 
715  }//EMCAL
716  else if ( cells->GetType() == AliVCaloCells::kPHOSCell )
717  {
718  Int_t relId[4];
719  Int_t irow = -1, icol = -1;
720  fPHOSGeo->AbsToRelNumbering(absIdMax,relId);
721 
722  if (relId[1] != 0 ) return kFALSE; // skip CPV only PHOS
723 
724  irow = relId[2];
725  icol = relId[3];
726  //imod = relId[0]-1;
727 
728  if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE;
729  if(icol >= fNCellsFromPHOSBorder && icol < 56-fNCellsFromPHOSBorder) okcol =kTRUE;
730 
731  AliDebug(1,Form("PHOS Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ? ok row %d, ok column %d",
732  fNCellsFromPHOSBorder, icol, irow, relId[0]-1,okrow,okcol));
733  }//PHOS
734 
735  if (okcol && okrow) return kTRUE;
736  else return kFALSE;
737 }
738 
739 //________________________________________________________________________________________________________
742 //________________________________________________________________________________________________________
743 Bool_t AliCalorimeterUtils::ClusterContainsBadChannel(Int_t calorimeter, UShort_t* cellList, Int_t nCells)
744 {
745  if (!fRemoveBadChannels) return kFALSE;
746 
747  //printf("fEMCALBadChannelMap %p, fPHOSBadChannelMap %p \n",fEMCALBadChannelMap,fPHOSBadChannelMap);
748  if(calorimeter == kEMCAL && !fEMCALRecoUtils->GetEMCALChannelStatusMap(0)) return kFALSE;
749  if(calorimeter == kPHOS && !fPHOSBadChannelMap) return kFALSE;
750 
751  Int_t icol = -1;
752  Int_t irow = -1;
753  Int_t imod = -1;
754  for(Int_t iCell = 0; iCell<nCells; iCell++)
755  {
756  // Get the column and row
757  if ( calorimeter == kEMCAL )
758  {
759  return fEMCALRecoUtils->ClusterContainsBadChannel((AliEMCALGeometry*)fEMCALGeo,cellList,nCells);
760  }
761  else if ( calorimeter == kPHOS )
762  {
763  Int_t relId[4];
764  fPHOSGeo->AbsToRelNumbering(cellList[iCell],relId);
765 
766  if (relId[1] != 0 ) return kTRUE; // skip CPV only PHOS
767 
768  irow = relId[2];
769  icol = relId[3];
770  imod = relId[0]-1;
771 
772  if ( fPHOSBadChannelMap->GetEntries() <= imod ) continue;
773 
774  //printf("PHOS bad channels imod %d, icol %d, irow %d\n",imod, irow, icol);
775  if ( GetPHOSChannelStatus(imod, irow, icol) ) return kTRUE;
776  }
777  else return kFALSE;
778  } // cell cluster loop
779 
780  return kFALSE;
781 }
782 
783 //_______________________________________________________________
785 //_______________________________________________________________
787 {
788  clus->SetE(fEMCALRecoUtils->CorrectClusterEnergyLinearity(clus));
789 }
790 
791 //_______________________________________________________________
799 //______________________________________________________________________________
800 void AliCalorimeterUtils::GetEMCALSubregion(AliVCluster * clus, AliVCaloCells * cells,
801  Int_t & regEta, Int_t & regPhi) const
802 {
803  regEta = regPhi = -1 ;
804 
805  if(!clus->IsEMCAL()) return ;
806 
807  Int_t icol = -1, irow = -1, iRCU = -1;
808  Float_t clusterFraction = 0;
809 
810  Int_t absId = GetMaxEnergyCell(cells,clus,clusterFraction);
811 
812  Int_t sm = GetModuleNumberCellIndexes(absId,kEMCAL,icol,irow,iRCU);
813 
814  // Shift by 48 to for impair SM
815  if( sm%2 == 1) icol+=AliEMCALGeoParams::fgkEMCALCols;
816 
817  // Avoid borders
818  if(icol < 2 || icol > 93 || irow < 2 || irow > 21) return;
819 
820  //
821  // Eta regions
822  //
823 
824  // Region 0: center of SM ~0.18<|eta|<0.55
825  if ( icol > 9 && icol < 34 ) regEta = 0;
826  else if ( icol > 62 && icol < 87 ) regEta = 0;
827 
828  // Region 3: frames ~0.1<|eta|<~0.22 ~0.51<|eta|<0.62
829 
830  else if ( icol <= 9 && icol >= 5 ) regEta = 3;
831  else if ( icol <= 38 && icol >= 34 ) regEta = 3;
832  else if ( icol <= 62 && icol >= 58 ) regEta = 3;
833  else if ( icol <= 91 && icol >= 87 ) regEta = 3;
834 
835  // Region 1: |eta| < ~0.15
836 
837  else if ( icol < 58 && icol > 38 ) regEta = 1 ;
838 
839  // Region 2: |eta| > ~0.6
840 
841  else regEta = 2 ;
842 
843  //
844  // Phi regions
845  //
846 
847  if ( irow >= 2 && irow <= 5 ) regPhi = 0; // External
848  else if ( irow >= 18 && irow <= 21 ) regPhi = 0; // External
849  else if ( irow >= 6 && irow <= 9 ) regPhi = 1; // Mid
850  else if ( irow >= 14 && irow <= 17 ) regPhi = 1; // Mid
851  else regPhi = 2; //10-13 Central
852 
853 }
854 
855 //________________________________________________________________________________________
857 //________________________________________________________________________________________
858 Int_t AliCalorimeterUtils::GetMaxEnergyCell(AliVCaloCells * cells,
859  AliVCluster * clu,
860  Float_t & clusterFraction) const
861 {
862  if( !clu || !cells )
863  {
864  AliInfo("Cluster or cells pointer is null!");
865  return -1;
866  }
867 
868  Double_t eMax =-1.;
869  Double_t eTot = 0.;
870  Double_t eCell =-1.;
871  Float_t fraction = 1.;
872  Float_t recalFactor = 1.;
873  Int_t cellAbsId =-1 , absId =-1 ;
874  Int_t iSupMod =-1 , ieta =-1 , iphi = -1, iRCU = -1;
875 
876  Int_t calo = kEMCAL;
877  if(clu->IsPHOS()) calo = kPHOS ;
878 
879  for (Int_t iDig=0; iDig< clu->GetNCells(); iDig++)
880  {
881  cellAbsId = clu->GetCellAbsId(iDig);
882 
883  fraction = clu->GetCellAmplitudeFraction(iDig);
884  if(fraction < 1e-4) fraction = 1.; // in case unfolding is off
885 
886  iSupMod = GetModuleNumberCellIndexes(cellAbsId, calo, ieta, iphi, iRCU);
887 
888  if(IsRecalibrationOn())
889  {
890  if(calo == kEMCAL) recalFactor = GetEMCALChannelRecalibrationFactor(iSupMod,ieta,iphi);
891  else recalFactor = GetPHOSChannelRecalibrationFactor (iSupMod,iphi,ieta);
892  }
893 
894  eCell = cells->GetCellAmplitude(cellAbsId)*fraction*recalFactor;
895 
896  if(eCell > eMax)
897  {
898  eMax = eCell;
899  absId = cellAbsId;
900  }
901 
902  eTot+=eCell;
903 
904  }// cell loop
905 
906  if(eTot > 0.1)
907  clusterFraction = (eTot-eMax)/eTot; //Do not use cluster energy in case it was corrected for non linearity.
908  else
909  clusterFraction =1.;
910 
911  return absId;
912 }
913 
914 //___________________________________________________________________________________
918 //___________________________________________________________________________________
919 AliVTrack * AliCalorimeterUtils::GetMatchedTrack(AliVCluster* cluster,
920  AliVEvent* event, Int_t index) const
921 {
922  AliVTrack *track = 0x0;
923 
924  //
925  // EMCAL case only when matching is recalculated
926  //
927  if(cluster->IsEMCAL() && IsRecalculationOfClusterTrackMatchingOn())
928  {
929  Int_t trackIndex = fEMCALRecoUtils->GetMatchedTrackIndex(cluster->GetID());
930  //printf("track index %d, cluster ID %d \n ",trackIndex,cluster->GetID());
931 
932  if(trackIndex < 0 )
933  AliInfo(Form("Wrong track index %d, from recalculation", trackIndex));
934  else
935  track = dynamic_cast<AliVTrack*> (event->GetTrack(trackIndex));
936 
937  return track ;
938  }
939 
940  //
941  // Normal case, get info from ESD or AOD
942  //
943 
944  // No tracks matched
945  if( cluster->GetNTracksMatched() < 1 ) return 0x0;
946 
947  // At least one match
948  Int_t iTrack = 0; // only one match for AODs with index 0.
949 
950  // ESDs
951  if(!strcmp("AliESDCaloCluster",Form("%s",cluster->ClassName())))
952  {
953  if( index >= 0 ) iTrack = index;
954  else iTrack = ((AliESDCaloCluster*)cluster)->GetTracksMatched()->At(0); //cluster->GetTrackMatchedIndex();
955 
956  track = dynamic_cast<AliVTrack*> ( event->GetTrack(iTrack) );
957  }
958  else // AODs
959  {
960  if( index > 0 ) iTrack = index;
961 
962  track = dynamic_cast<AliVTrack*>( cluster->GetTrackMatched(iTrack) );
963  }
964 
965  return track ;
966 }
967 
972 Float_t AliCalorimeterUtils::GetMCECellClusFracCorrection(Float_t eCell, Float_t eCluster) const
973 {
974  if( eCluster <= 0 || eCluster < eCell )
975  {
976  AliWarning(Form("Bad values eCell=%f, eCluster %f",eCell,eCluster));
977  return 1;
978  }
979 
980  Float_t frac = eCell / eCluster;
981 
982  Float_t correction = fMCECellClusFracCorrParam[0] +
983  TMath::Exp( frac*fMCECellClusFracCorrParam[2]+fMCECellClusFracCorrParam[1] ) +
984  fMCECellClusFracCorrParam[3]/TMath::Sqrt(frac);
985 
986 // printf("AliCalorimeterUtils::GetMCECellClusFracCorrection(eCell=%f, eCluster %f, frac %f) = %f\n",eCell, eCluster, frac, correction);
987 // printf("\t %2.2f + TMath::Exp( %2.3f*%2.2f + %2.2f ) + %2.2f/TMath::Sqrt(%2.3f)) = %f\n",
988 // fMCECellClusFracCorrParam[0],frac,fMCECellClusFracCorrParam[2],fMCECellClusFracCorrParam[1],fMCECellClusFracCorrParam[3], frac, correction);
989 
990  return correction;
991 }
992 
993 //_____________________________________________________________________________________________________
995 //_____________________________________________________________________________________________________
996 Int_t AliCalorimeterUtils::GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent * inputEvent) const
997 {
998  Int_t absId = -1;
999 
1000  if(particle->GetDetectorTag()==kEMCAL)
1001  {
1002  fEMCALGeo->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(), absId);
1003 
1004  AliDebug(2,Form("EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d",
1005  particle->Eta(), particle->Phi()*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId)));
1006 
1007  return fEMCALGeo->GetSuperModuleNumber(absId) ;
1008  } // EMCAL
1009  else if ( particle->GetDetectorTag() == kPHOS )
1010  {
1011  // In case we use the MC reader, the input are TParticles,
1012  // in this case use the corresponing method in PHOS Geometry to get the particle.
1013  if(strcmp(inputEvent->ClassName(), "AliMCEvent") == 0 )
1014  {
1015  Int_t mod =-1;
1016  Double_t z = 0., x=0.;
1017  TParticle* primary = 0x0;
1018  AliStack * stack = ((AliMCEvent*)inputEvent)->Stack();
1019 
1020  if(stack)
1021  {
1022  primary = stack->Particle(particle->GetCaloLabel(0));
1023  }
1024  else
1025  {
1026  AliFatal("Stack not available, stop!");
1027  }
1028 
1029  if(primary)
1030  {
1031  fPHOSGeo->ImpactOnEmc(primary,mod,z,x) ;
1032  }
1033  else
1034  {
1035  AliFatal("Primary not available, stop!");
1036  }
1037  return mod;
1038  }
1039  // Input are ESDs or AODs, get the PHOS module number like this.
1040  else
1041  {
1042  //FIXME
1043  //AliVCluster *cluster = inputEvent->GetCaloCluster(particle->GetCaloLabel(0));
1044  //return GetModuleNumber(cluster);
1045  //MEFIX
1046  return -1;
1047  }
1048  } // PHOS
1049 
1050  return -1;
1051 }
1052 
1053 //_____________________________________________________________________
1055 //_____________________________________________________________________
1056 Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const
1057 {
1058  if(!cluster)
1059  {
1060  AliDebug(1,"AliCalorimeterUtils::GetModuleNumber() - NUL Cluster, please check!!!");
1061 
1062  return -1;
1063  }
1064 
1065  if ( cluster->GetNCells() <= 0 ) return -1;
1066 
1067  Int_t absId = cluster->GetCellAbsId(0);
1068 
1069  if ( absId < 0 ) return -1;
1070 
1071  if( cluster->IsEMCAL() )
1072  {
1073  AliDebug(2,Form("EMCAL absid %d, SuperModule %d",absId, fEMCALGeo->GetSuperModuleNumber(absId)));
1074 
1075  return fEMCALGeo->GetSuperModuleNumber(absId) ;
1076  } // EMCAL
1077  else if ( cluster->IsPHOS() )
1078  {
1079  Int_t relId[4];
1080  fPHOSGeo->AbsToRelNumbering(absId,relId);
1081 
1082  if (relId[1] != 0 ) return -1; // skip CPV only PHOS
1083 
1084  AliDebug(2,Form("PHOS absid %d Module %d",absId, relId[0]-1));
1085 
1086  return relId[0]-1;
1087  } // PHOS
1088 
1089  return -1;
1090 }
1091 
1092 //___________________________________________________________________________________________________
1094 //___________________________________________________________________________________________________
1096  Int_t & icol, Int_t & irow, Int_t & iRCU) const
1097 {
1098  Int_t imod = -1;
1099 
1100  if ( absId < 0 ) return -1 ;
1101 
1102  if ( calo == kEMCAL )
1103  {
1104  Int_t iTower = -1, iIphi = -1, iIeta = -1;
1105  fEMCALGeo->GetCellIndex(absId,imod,iTower,iIphi,iIeta);
1106  fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol);
1107 
1108  if(imod < 0 || irow < 0 || icol < 0 )
1109  {
1110  AliFatal(Form("Negative value for super module: %d, or cell icol: %d, or cell irow: %d, check EMCAL geometry name",imod,icol,irow));
1111  }
1112 
1113  // In case of DCal C side, shift columns to match offline/online numbering
1114  // when calculating the DDL for Run2
1115  // See AliEMCALRawUtils::Digits2Raw and Raw2Digits.
1116  Int_t ico2 = icol ;
1117  if ( imod == 13 || imod == 15 || imod == 17 ) ico2 += 16;
1118 
1119  // RCU / DDL
1120  if(imod < 10 || (imod > 11 && imod < 18)) // (EMCAL Full || DCAL 2/3)
1121  {
1122  // RCU0 / DDL0
1123  if ( 0 <= irow && irow < 8 ) iRCU = 0; // first cable row
1124  else if ( 8 <= irow && irow < 16 &&
1125  0 <= ico2 && ico2 < 24 ) iRCU = 0; // first half;
1126  //second cable row
1127 
1128  // RCU1 / DDL1
1129  else if ( 8 <= irow && irow < 16 &&
1130  24 <= ico2 && ico2 < 48 ) iRCU = 1; // second half;
1131  //second cable row
1132  else if ( 16 <= irow && irow < 24 ) iRCU = 1; // third cable row
1133 
1134  if ( imod%2 == 1 ) iRCU = 1 - iRCU; // swap for odd=C side, to allow us to cable both sides the same
1135  }
1136  else
1137  {
1138  // 1/3 SM have one single SRU, just assign RCU/DDL 0
1139  iRCU = 0 ;
1140  }
1141 
1142  if ( iRCU < 0 )
1143  AliFatal(Form("Wrong EMCAL RCU number = %d", iRCU));
1144 
1145  return imod ;
1146  } // EMCAL
1147  else // PHOS
1148  {
1149  Int_t relId[4];
1150  fPHOSGeo->AbsToRelNumbering(absId,relId);
1151 
1152  if (relId[1] != 0 ) return -1; // skip CPV only PHOS
1153 
1154  irow = relId[2];
1155  icol = relId[3];
1156  imod = relId[0]-1;
1157  iRCU= (Int_t)(relId[2]-1)/16 ;
1158 
1159  //Int_t iBranch= (Int_t)(relid[3]-1)/28 ; //0 to 1
1160 
1161  if ( iRCU >= 4 )
1162  AliFatal(Form("Wrong PHOS RCU number = %d", iRCU));
1163 
1164  return imod;
1165  } // PHOS
1166 
1167  return -1;
1168 }
1169 
1170 //___________________________________________________________________________________________________
1173 //___________________________________________________________________________________________________
1175  Int_t & icol , Int_t & irow , Int_t & iRCU,
1176  Int_t & icolAbs, Int_t & irowAbs) const
1177 {
1178  Int_t imod = GetModuleNumberCellIndexes(absId, calo, icol, irow,iRCU);
1179 
1180  icolAbs = icol;
1181  irowAbs = irow;
1182 
1183  //
1184  // PHOS
1185  //
1186  if(calo == kPHOS)
1187  {
1188  irowAbs = irow + 64 * imod;
1189 
1190  return imod;
1191  }
1192  //
1193  // EMCal/DCal
1194  //
1195  else
1196  {
1197  //
1198  // Shift collumns in even SM
1199  Int_t shiftEta = 48;
1200 
1201  // Shift collumn even more due to smaller acceptance of DCal collumns
1202  if ( imod > 11 && imod < 18) shiftEta+=48/3;
1203 
1204  icolAbs = (imod % 2) ? icol + shiftEta : icol;
1205 
1206  //
1207  // Shift rows per sector
1208  irowAbs = irow + 24 * Int_t(imod / 2);
1209 
1210  // Shift row less due to smaller acceptance of SM 10 and 11 to count DCal rows
1211  if ( imod > 11 && imod < 20) irowAbs -= (2*24 / 3);
1212 
1213  return imod ;
1214  }
1215 }
1216 
1217 
1218 //___________________________________________________________________________________________
1220 //___________________________________________________________________________________________
1221 Int_t AliCalorimeterUtils::GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCaloCells* cells)
1222 {
1223  const Int_t nc = cluster->GetNCells();
1224 
1225  Int_t absIdList[nc];
1226  Float_t maxEList[nc];
1227 
1228  Int_t nMax = GetNumberOfLocalMaxima(cluster, cells, absIdList, maxEList);
1229 
1230  return nMax;
1231 }
1232 
1233 //___________________________________________________________________________________________
1235 //___________________________________________________________________________________________
1236 Int_t AliCalorimeterUtils::GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCaloCells* cells,
1237  Int_t *absIdList, Float_t *maxEList)
1238 {
1239  Int_t iDigitN = 0 ;
1240  Int_t iDigit = 0 ;
1241  Int_t absId1 = -1 ;
1242  Int_t absId2 = -1 ;
1243  const Int_t nCells = cluster->GetNCells();
1244 
1245  Float_t eCluster = RecalibrateClusterEnergy(cluster, cells);// recalculate cluster energy, avoid non lin correction.
1246 
1247  Float_t simuTotWeight = 0;
1249  {
1250  simuTotWeight = RecalibrateClusterEnergyWeightCell(cluster, cells,eCluster);// same but apply a weight
1251  simuTotWeight/= eCluster;
1252  }
1253 
1254  Int_t calorimeter = kEMCAL;
1255  if(!cluster->IsEMCAL()) calorimeter = kPHOS;
1256 
1257  //printf("cluster : ncells %d \n",nCells);
1258 
1259  Float_t emax = 0;
1260  Int_t idmax =-1;
1261  for(iDigit = 0; iDigit < nCells ; iDigit++)
1262  {
1263  absIdList[iDigit] = cluster->GetCellsAbsId()[iDigit] ;
1264  Float_t en = cells->GetCellAmplitude(absIdList[iDigit]);
1265  RecalibrateCellAmplitude(en,calorimeter,absIdList[iDigit]);
1266 
1268  en*=GetMCECellClusFracCorrection(en,eCluster)/simuTotWeight;
1269 
1270  if( en > emax )
1271  {
1272  emax = en ;
1273  idmax = absIdList[iDigit] ;
1274  }
1275  //Int_t icol = -1, irow = -1, iRCU = -1;
1276  //Int_t sm = GetModuleNumberCellIndexes(absIdList[iDigit], calorimeter, icol, irow, iRCU) ;
1277  //printf("\t cell %d, id %d, sm %d, col %d, row %d, e %f\n", iDigit, absIdList[iDigit], sm, icol, irow, en );
1278  }
1279 
1280  for(iDigit = 0 ; iDigit < nCells; iDigit++)
1281  {
1282  if( absIdList[iDigit] >= 0 )
1283  {
1284  absId1 = cluster->GetCellsAbsId()[iDigit];
1285 
1286  Float_t en1 = cells->GetCellAmplitude(absId1);
1287  RecalibrateCellAmplitude(en1,calorimeter,absId1);
1288 
1290  en1*=GetMCECellClusFracCorrection(en1,eCluster)/simuTotWeight;
1291 
1292  //printf("%d : absIDi %d, E %f\n",iDigit, absId1,en1);
1293 
1294  for(iDigitN = 0; iDigitN < nCells; iDigitN++)
1295  {
1296  absId2 = cluster->GetCellsAbsId()[iDigitN] ;
1297 
1298  if(absId2==-1 || absId2==absId1) continue;
1299 
1300  //printf("\t %d : absIDj %d\n",iDigitN, absId2);
1301 
1302  Float_t en2 = cells->GetCellAmplitude(absId2);
1303  RecalibrateCellAmplitude(en2,calorimeter,absId2);
1304 
1306  en2*=GetMCECellClusFracCorrection(en2,eCluster)/simuTotWeight;
1307 
1308  //printf("\t %d : absIDj %d, E %f\n",iDigitN, absId2,en2);
1309 
1310  if ( AreNeighbours(calorimeter, absId1, absId2) )
1311  {
1312  // printf("\t \t Neighbours \n");
1313  if ( en1 > en2 )
1314  {
1315  absIdList[iDigitN] = -1 ;
1316  //printf("\t \t indexN %d not local max\n",iDigitN);
1317  // but may be digit too is not local max ?
1318  if(en1 < en2 + fLocMaxCutEDiff) {
1319  //printf("\t \t index %d not local max cause locMaxCutEDiff\n",iDigit);
1320  absIdList[iDigit] = -1 ;
1321  }
1322  }
1323  else
1324  {
1325  absIdList[iDigit] = -1 ;
1326  //printf("\t \t index %d not local max\n",iDigitN);
1327  // but may be digitN too is not local max ?
1328  if(en1 > en2 - fLocMaxCutEDiff)
1329  {
1330  absIdList[iDigitN] = -1 ;
1331  //printf("\t \t indexN %d not local max cause locMaxCutEDiff\n",iDigit);
1332  }
1333  }
1334  } // if Are neighbours
1335  //else printf("\t \t NOT Neighbours \n");
1336  } // while digitN
1337  } // slot not empty
1338  } // while digit
1339 
1340  iDigitN = 0 ;
1341  for(iDigit = 0; iDigit < nCells; iDigit++)
1342  {
1343  if( absIdList[iDigit] >= 0 )
1344  {
1345  absIdList[iDigitN] = absIdList[iDigit] ;
1346 
1347  Float_t en = cells->GetCellAmplitude(absIdList[iDigit]);
1348  RecalibrateCellAmplitude(en,calorimeter,absIdList[iDigit]);
1349 
1351  en*=GetMCECellClusFracCorrection(en,eCluster)/simuTotWeight;
1352 
1353  if(en < fLocMaxCutE) continue; // Maxima only with seed energy at least
1354 
1355  maxEList[iDigitN] = en ;
1356 
1357  //printf("Local max %d, id %d, en %f\n", iDigit,absIdList[iDigitN],en);
1358  iDigitN++ ;
1359  }
1360  }
1361 
1362  if ( iDigitN == 0 )
1363  {
1364  AliDebug(1,Form("No local maxima found, assign highest energy cell as maxima, id %d, en cell %2.2f, en cluster %2.2f",
1365  idmax,emax,cluster->E()));
1366  iDigitN = 1 ;
1367  maxEList[0] = emax ;
1368  absIdList[0] = idmax ;
1369  }
1370 
1371 
1372  AliDebug(1,Form("In cluster E %2.2f (wth non lin. %2.2f), M02 %2.2f, M20 %2.2f, N maxima %d",
1373  cluster->E(),eCluster, cluster->GetM02(),cluster->GetM20(), iDigitN));
1374 
1375 // if(fDebug > 1) for(Int_t imax = 0; imax < iDigitN; imax++)
1376 // {
1377 // printf(" \t i %d, absId %d, Ecell %f\n",imax,absIdList[imax],maxEList[imax]);
1378 // }
1379 
1380  return iDigitN ;
1381 }
1382 
1383 //____________________________________
1385 //____________________________________
1387 {
1388  if (!AliAnalysisManager::GetAnalysisManager()->GetTree())
1389  {
1390  AliError("AliCalorimeterUtils::GetPass() - Pointer to tree = 0, returning null");
1391  return TString("");
1392  }
1393 
1394  if (!AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile())
1395  {
1396  AliError("AliCalorimeterUtils::GetPass() - Null pointer input file, returning null");
1397  return TString("");
1398  }
1399 
1400  TString pass(AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile()->GetName());
1401  if (pass.Contains("ass1")) return TString("pass1");
1402  else if (pass.Contains("ass2")) return TString("pass2");
1403  else if (pass.Contains("ass3")) return TString("pass3");
1404  else if (pass.Contains("ass4")) return TString("pass4");
1405  else if (pass.Contains("ass5")) return TString("pass5");
1406  else if (pass.Contains("LHC11c") && pass.Contains("spc_calo") ) return TString("spc_calo");
1407  else if (pass.Contains("calo") || pass.Contains("high_lumi"))
1408  {
1409  AliInfo("Path contains <calo> or <high-lumi>, set as <pass1>");
1410  return TString("pass1");
1411  }
1412 
1413  // No condition fullfilled, give a default value
1414  AliInfo("Pass number string not found");
1415  return TString("");
1416 }
1417 
1418 //________________________________________
1420 //________________________________________
1422 {
1423  fEMCALGeoName = "";
1424  fPHOSGeoName = "";
1425 
1426  fEMCALGeoMatrixSet = kFALSE;
1427  fPHOSGeoMatrixSet = kFALSE;
1428 
1429  fRemoveBadChannels = kFALSE;
1430 
1432 
1433  fLocMaxCutE = 0.1 ;
1434  fLocMaxCutEDiff = 0.0 ;
1435 
1436  // fMaskCellColumns = new Int_t[fNMaskCellColumns];
1437  // fMaskCellColumns[0] = 6 ; fMaskCellColumns[1] = 7 ; fMaskCellColumns[2] = 8 ;
1438  // fMaskCellColumns[3] = 35; fMaskCellColumns[4] = 36; fMaskCellColumns[5] = 37;
1439  // fMaskCellColumns[6] = 12+AliEMCALGeoParams::fgkEMCALCols; fMaskCellColumns[7] = 13+AliEMCALGeoParams::fgkEMCALCols;
1440  // fMaskCellColumns[8] = 40+AliEMCALGeoParams::fgkEMCALCols; fMaskCellColumns[9] = 41+AliEMCALGeoParams::fgkEMCALCols;
1441  // fMaskCellColumns[10]= 42+AliEMCALGeoParams::fgkEMCALCols;
1442 
1443  fOADBSet = kFALSE;
1444  fOADBForEMCAL = kTRUE ;
1445  fOADBForPHOS = kFALSE;
1446 
1447  fOADBFilePathEMCAL = "$ALICE_PHYSICS/OADB/EMCAL" ;
1448  fOADBFilePathPHOS = "$ALICE_PHYSICS/OADB/PHOS" ;
1449 
1450  fImportGeometryFromFile = kTRUE;
1452 
1453  fNSuperModulesUsed = 22;
1454 
1455  fMCECellClusFracCorrParam[0] = 0.78;
1456  fMCECellClusFracCorrParam[1] =-1.8;
1457  fMCECellClusFracCorrParam[2] =-6.3;
1458  fMCECellClusFracCorrParam[3] = 0.014;
1459 }
1460 
1461 //_____________________________________________________
1463 //_____________________________________________________
1465 {
1466  AliDebug(1,"Init bad channel map");
1467 
1468  // In order to avoid rewriting the same histograms
1469  Bool_t oldStatus = TH1::AddDirectoryStatus();
1470  TH1::AddDirectory(kFALSE);
1471 
1472  fPHOSBadChannelMap = new TObjArray(5);
1473  for (int i = 0; i < 5; i++)fPHOSBadChannelMap->Add(new TH2I(Form("PHOS_BadMap_mod%d",i),
1474  Form("PHOS_BadMap_mod%d",i),
1475  64, 0, 64, 56, 0, 56));
1476 
1477  fPHOSBadChannelMap->SetOwner(kTRUE);
1478  fPHOSBadChannelMap->Compress();
1479 
1480  //In order to avoid rewriting the same histograms
1481  TH1::AddDirectory(oldStatus);
1482 }
1483 
1484 //______________________________________________________
1486 //______________________________________________________
1488 {
1489  AliDebug(1,"Init recalibration map");
1490 
1491  // In order to avoid rewriting the same histograms
1492  Bool_t oldStatus = TH1::AddDirectoryStatus();
1493  TH1::AddDirectory(kFALSE);
1494 
1495  fPHOSRecalibrationFactors = new TObjArray(5);
1496  for (int i = 0; i < 5; i++)
1497  {
1498  fPHOSRecalibrationFactors->Add(new TH2F(Form("PHOSRecalFactors_Mod%d",i),
1499  Form("PHOSRecalFactors_Mod%d",i),
1500  64, 0, 64, 56, 0, 56));
1501  }
1502 
1503  // Init the histograms with 1
1504  for (Int_t m = 0; m < 5; m++)
1505  {
1506  for (Int_t i = 0; i < 56; i++)
1507  {
1508  for (Int_t j = 0; j < 64; j++)
1509  {
1511  }
1512  }
1513  }
1514 
1515  fPHOSRecalibrationFactors->SetOwner(kTRUE);
1516  fPHOSRecalibrationFactors->Compress();
1517 
1518  // In order to avoid rewriting the same histograms
1519  TH1::AddDirectory(oldStatus);
1520 }
1521 
1526 {
1527  if (fEMCALGeo) return;
1528 
1529  AliDebug(1,Form(" for run=%d",fRunNumber));
1530 
1531  if(fEMCALGeoName=="")
1532  {
1533  fEMCALGeo = AliEMCALGeometry::GetInstanceFromRunNumber(fRunNumber);
1534  AliInfo(Form("Get EMCAL geometry name to <%s> for run %d",fEMCALGeo->GetName(),fRunNumber));
1535  }
1536  else
1537  {
1538  fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName);
1539  AliInfo(Form("Set EMCAL geometry name to <%s>",fEMCALGeoName.Data()));
1540  }
1541 
1542  // Init geometry, I do not like much to do it like this ...
1543  if(fImportGeometryFromFile && !gGeoManager)
1544  {
1545  if(fImportGeometryFilePath=="") // If not specified, set location depending on run number
1546  {
1547  // "$ALICE_ROOT/EVE/alice-data/default_geo.root"
1548  if (fRunNumber < 140000) fImportGeometryFilePath = "$ALICE_PHYSICS/OADB/EMCAL/geometry_2010.root";
1549  else if(fRunNumber < 171000) fImportGeometryFilePath = "$ALICE_PHYSICS/OADB/EMCAL/geometry_2011.root";
1550  else if(fRunNumber < 198000) fImportGeometryFilePath = "$ALICE_PHYSICS/OADB/EMCAL/geometry_2012.root"; // 2012-2013
1551  else fImportGeometryFilePath = "$ALICE_PHYSICS/OADB/EMCAL/geometry_2015.root"; // >= 2015
1552  }
1553 
1554  AliInfo(Form("Import %s",fImportGeometryFilePath.Data()));
1555 
1556  TGeoManager::Import(fImportGeometryFilePath) ; // default need file "geometry.root" in local dir!!!!
1557  }
1558  else if (!gGeoManager) AliInfo("Careful!, gGeoManager not loaded, load misalign matrices");
1559 }
1560 
1565 {
1566  if (fPHOSGeo) return;
1567 
1568  AliDebug(1,Form(" for run=%d",fRunNumber));
1569 
1570  if(fPHOSGeoName=="") fPHOSGeoName = "PHOSgeo";
1571 
1572  fPHOSGeo = new AliPHOSGeoUtils(fPHOSGeoName);
1573 
1574  //if (!gGeoManager) AliInfo("Careful!, gGeoManager not loaded, load misalign matrices");
1575 }
1576 
1577 //______________________________________________________________________________________________
1578 // Check that a MC ESD is in the calorimeter acceptance
1579 //______________________________________________________________________________________________
1580 Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(Int_t calo, TParticle* particle)
1581 {
1582  if(!particle || (calo!=kEMCAL && calo!=kPHOS)) return kFALSE ;
1583 
1584  if( (!IsPHOSGeoMatrixSet () && calo == kPHOS ) ||
1585  (!IsEMCALGeoMatrixSet() && calo == kEMCAL) )
1586  {
1587  AliFatal(Form("Careful Geo Matrix for calo <%d> is not set, use AliFidutialCut instead",calo));
1588  return kFALSE ;
1589  }
1590 
1591  if(calo == kPHOS )
1592  {
1593  Int_t mod = 0 ;
1594  Double_t x = 0, z = 0 ;
1595  return GetPHOSGeometry()->ImpactOnEmc( particle, mod, z, x);
1596  }
1597  else if(calo == kEMCAL)
1598  {
1599  Int_t absID = 0 ;
1600  Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(),absID);
1601  if(ok)
1602  {
1603  Int_t icol = -1, irow = -1, iRCU = -1;
1604  Int_t nModule = GetModuleNumberCellIndexes(absID,calo, icol, irow, iRCU);
1605  Int_t status = GetEMCALChannelStatus(nModule,icol,irow);
1606  if(status > 0) ok = kFALSE;
1607  }
1608 
1609  return ok ;
1610  }
1611 
1612  return kFALSE ;
1613 }
1614 
1615 //______________________________________________________________________________________________________
1617 //______________________________________________________________________________________________________
1618 Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(Int_t calo, AliAODMCParticle* particle)
1619 {
1620  if(!particle || (calo!=kEMCAL && calo!=kPHOS)) return kFALSE ;
1621 
1622  if( (!IsPHOSGeoMatrixSet () && calo == kPHOS ) ||
1623  (!IsEMCALGeoMatrixSet() && calo == kEMCAL) )
1624  {
1625  AliFatal(Form("Careful Geo Matrix for calo <%d> is not set, use AliFidutialCut instead",calo));
1626  return kFALSE ;
1627  }
1628 
1629  Float_t phi = particle->Phi();
1630  if(phi < 0) phi+=TMath::TwoPi();
1631 
1632  if(calo == kPHOS )
1633  {
1634  Int_t mod = 0 ;
1635  Double_t x = 0, z = 0 ;
1636  Double_t vtx[]={ particle->Xv(), particle->Yv(), particle->Zv() } ;
1637  return GetPHOSGeometry()->ImpactOnEmc(vtx, particle->Theta(), phi, mod, z, x) ;
1638  }
1639  else if(calo == kEMCAL)
1640  {
1641  Int_t absID = 0 ;
1642  Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),phi,absID);
1643  if(ok)
1644  {
1645  Int_t icol = -1, irow = -1, iRCU = -1;
1646  Int_t nModule = GetModuleNumberCellIndexes(absID,calo, icol, irow, iRCU);
1647  Int_t status = GetEMCALChannelStatus(nModule,icol,irow);
1648  if(status > 0) ok = kFALSE;
1649  }
1650 
1651  return ok ;
1652  }
1653 
1654  return kFALSE ;
1655 }
1656 
1657 //_____________________________________________________________________________________________________
1658 // Check that a TLorentzVector is in the calorimeter acceptance, give the cell number where it hit.
1659 //_____________________________________________________________________________________________________
1660 Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(Int_t calo, Float_t eta, Float_t theta,
1661  Float_t phiOrg, Int_t & absID)
1662 {
1663  if(calo!=kEMCAL && calo!=kPHOS) return kFALSE ;
1664 
1665  if( (!IsPHOSGeoMatrixSet () && calo == kPHOS ) ||
1666  (!IsEMCALGeoMatrixSet() && calo == kEMCAL) )
1667  {
1668  AliFatal(Form("Careful Geo Matrix for calo <%d> is not set, use AliFidutialCut instead",calo));
1669  return kFALSE ;
1670  }
1671 
1672  Float_t phi = phiOrg;
1673  if(phi < 0) phi+=TMath::TwoPi();
1674 
1675  if(calo == kPHOS )
1676  {
1677  Int_t mod = 0 ;
1678  Double_t x = 0, z = 0 ;
1679  Double_t vtx[]={0,0,0} ;
1680  return GetPHOSGeometry()->ImpactOnEmc(vtx, theta, phi, mod, z, x) ;
1681  }
1682  else if(calo == kEMCAL)
1683  {
1684  Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(eta,phi,absID);
1685  if(ok)
1686  {
1687  Int_t icol = -1, irow = -1, iRCU = -1;
1688  Int_t nModule = GetModuleNumberCellIndexes(absID,calo, icol, irow, iRCU);
1689  Int_t status = GetEMCALChannelStatus(nModule,icol,irow);
1690  if(status > 0) ok = kFALSE;
1691  }
1692 
1693  return ok ;
1694  }
1695 
1696  return kFALSE ;
1697 }
1698 
1699 //_______________________________________________________________________
1702 //_______________________________________________________________________
1703 Bool_t AliCalorimeterUtils::MaskFrameCluster(Int_t iSM, Int_t ieta) const
1704 {
1705  Int_t icol = ieta;
1706  if ( iSM%2 ) icol+=48; // Impair SM, shift index [0-47] to [48-96]
1707 
1709  {
1710  for (Int_t imask = 0; imask < fNMaskCellColumns; imask++)
1711  {
1712  if(icol==fMaskCellColumns[imask]) return kTRUE;
1713  }
1714  }
1715 
1716  return kFALSE;
1717 }
1718 
1719 //_________________________________________________________
1721 //_________________________________________________________
1722 void AliCalorimeterUtils::Print(const Option_t * opt) const
1723 {
1724  if(! opt)
1725  return;
1726 
1727  printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
1728  printf("Remove Clusters with bad channels? %d\n",fRemoveBadChannels);
1729  printf("Remove Clusters with max cell at less than %d cells from EMCAL border and %d cells from PHOS border\n",
1730  fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder(), fNCellsFromPHOSBorder);
1731  if(fEMCALRecoUtils->IsEMCALNoBorderAtEta0()) printf("Do not remove EMCAL clusters at Eta = 0\n");
1732  printf("Recalibrate Clusters? %d, run by run %d\n",fRecalibration,fRunDependentCorrection);
1733  printf("Recalculate Clusters Position? %d\n",fRecalculatePosition);
1734  printf("Recalculate Clusters Energy? %d\n",fCorrectELinearity);
1735  printf("Matching criteria: dR < %2.2f[cm], dZ < %2.2f[cm]\n",fCutR,fCutZ);
1736 
1737  printf("Recalibrate time? %d, With L1 phase run by run? %d\n",IsTimeRecalibrationOn(),IsL1PhaseInTimeRecalibrationOn());
1738 
1739  printf("Loc. Max. E > %2.2f\n", fLocMaxCutE);
1740  printf("Loc. Max. E Diff > %2.2f\n", fLocMaxCutEDiff);
1741 
1742  printf(" \n") ;
1743 }
1744 
1745 //_____________________________________________________________________________________________
1747 //_____________________________________________________________________________________________
1748 void AliCalorimeterUtils::RecalibrateCellAmplitude(Float_t & amp, Int_t calo, Int_t id) const
1749 {
1750  Int_t icol = -1; Int_t irow = -1; Int_t iRCU = -1;
1751  Int_t nModule = GetModuleNumberCellIndexes(id,calo, icol, irow, iRCU);
1752 
1753  if (IsRecalibrationOn())
1754  {
1755  if(calo == kPHOS)
1756  {
1757  amp *= GetPHOSChannelRecalibrationFactor(nModule,icol,irow);
1758  }
1759  else
1760  {
1761  amp *= GetEMCALChannelRecalibrationFactor(nModule,icol,irow);
1762  }
1763  }
1764 }
1765 
1766 //____________________________________________________________________________________________________
1768 //____________________________________________________________________________________________________
1769 void AliCalorimeterUtils::RecalibrateCellTime(Double_t & time, Int_t calo, Int_t id, Int_t bc) const
1770 {
1771  if ( calo == kEMCAL && GetEMCALRecoUtils()->IsTimeRecalibrationOn() )
1772  {
1773  GetEMCALRecoUtils()->RecalibrateCellTime(id,bc,time);
1774  }
1775 }
1776 
1777 
1778 //____________________________________________________________________________________________________
1780 //____________________________________________________________________________________________________
1781 void AliCalorimeterUtils::RecalibrateCellTimeL1Phase(Double_t & time, Int_t calo, Int_t iSM, Int_t bunchCrossNumber) const
1782 {
1784  {
1785  GetEMCALRecoUtils()->RecalibrateCellTimeL1Phase(iSM, bunchCrossNumber, time);
1786  }
1787 }
1788 
1789 
1790 //__________________________________________________________________________
1792 //__________________________________________________________________________
1793 Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliVCluster * cluster,
1794  AliVCaloCells * cells)
1795 {
1796  // Initialize some used variables
1797  Float_t frac = 0., energy = 0.;
1798 
1799  if(cells)
1800  {
1801  //Get the cluster number of cells and list of absId, check what kind of cluster do we have.
1802 
1803  UShort_t * index = cluster->GetCellsAbsId() ;
1804  Double_t * fraction = cluster->GetCellsAmplitudeFraction() ;
1805 
1806  Int_t ncells = cluster->GetNCells();
1807 
1808  Int_t calo = kEMCAL;
1809  if(cluster->IsPHOS()) calo = kPHOS ;
1810 
1811  // Loop on the cells, get the cell amplitude and recalibration factor, multiply and and to the new energy
1812  for(Int_t icell = 0; icell < ncells; icell++)
1813  {
1814  Int_t absId = index[icell];
1815 
1816  frac = fraction[icell];
1817  if(frac < 1e-3) frac = 1; //in case of EMCAL, this is set as 0, not used.
1818 
1819  Float_t amp = cells->GetCellAmplitude(absId);
1820  RecalibrateCellAmplitude(amp,calo, absId);
1821 
1822  AliDebug(2,Form("Recalibrate cell: calo <%d>, cell fraction %f, cell energy: before cal %f; after cal %f",
1823  calo,frac,cells->GetCellAmplitude(absId),amp));
1824 
1825  energy += amp*frac;
1826  }
1827 
1828  AliDebug(1,Form("Energy before %f, after %f",cluster->E(),energy));
1829 
1830  } // cells available
1831  else
1832  {
1833  AliFatal("Cells pointer does not exist!");
1834  }
1835 
1836  return energy;
1837 }
1838 
1839 //_______________________________________________________________________________________________________
1842 //_______________________________________________________________________________________________________
1844  AliVCaloCells * cells, Float_t energyOrg)
1845 {
1846  //Initialize some used variables
1847  Float_t frac = 0., energy = 0.;
1848 
1849  if(cells)
1850  {
1851  // Get the cluster number of cells and list of absId, check what kind of cluster do we have.
1852 
1853  UShort_t * index = cluster->GetCellsAbsId() ;
1854  Double_t * fraction = cluster->GetCellsAmplitudeFraction() ;
1855 
1856  Int_t ncells = cluster->GetNCells();
1857 
1858  Int_t calo = kEMCAL;
1859  if(cluster->IsPHOS()) calo = kPHOS ;
1860 
1861  // Loop on the cells, get the cell amplitude and recalibration factor, multiply and and to the new energy
1862  for(Int_t icell = 0; icell < ncells; icell++)
1863  {
1864  Int_t absId = index[icell];
1865 
1866  frac = fraction[icell];
1867  if(frac < 1e-3) frac = 1; //in case of EMCAL, this is set as 0, not used.
1868 
1869  Float_t amp = cells->GetCellAmplitude(absId);
1870  RecalibrateCellAmplitude(amp,calo, absId);
1871 
1872  amp*=GetMCECellClusFracCorrection(amp,energyOrg);
1873 
1874  AliDebug(2,Form("Recalibrate cell: calo <%d>, cell fraction %f, cell energy %f",
1875  calo,frac,cells->GetCellAmplitude(absId)));
1876 
1877  energy += amp*frac;
1878  }
1879 
1880  AliDebug(1,Form("Energy before %f, after %f",cluster->E(),energy));
1881  } // cells available
1882  else
1883  {
1884  AliFatal("Cells pointer does not exist!");
1885  }
1886 
1887  return energy;
1888 }
1889 
1890 //__________________________________________________________________________________________
1893 //__________________________________________________________________________________________
1894 void AliCalorimeterUtils::RecalculateClusterPosition(AliVCaloCells* cells, AliVCluster* clu)
1895 {
1896  fEMCALRecoUtils->RecalculateClusterPosition((AliEMCALGeometry*)fEMCALGeo, cells,clu);
1897 }
1898 
1899 //________________________________________________________________________________
1905 //________________________________________________________________________________
1907  TObjArray* clusterArray)
1908 {
1909  if (!fRecalculateMatching) return ;
1910 
1911  fEMCALRecoUtils->FindMatches(event,clusterArray,fEMCALGeo) ;
1912 
1913  Float_t dZ = 2000;
1914  Float_t dR = 2000;
1915 
1916  Int_t nClusters = event->GetNumberOfCaloClusters();
1917  if(clusterArray) nClusters = clusterArray->GetEntriesFast();
1918 
1919  AliVCluster * clus = 0;
1920 
1921  for (Int_t iclus = 0; iclus < nClusters ; iclus++)
1922  {
1923  if ( clusterArray ) clus = (AliVCluster*) clusterArray->At(iclus) ;
1924  else clus = event->GetCaloCluster(iclus) ;
1925 
1926  if (!clus->IsEMCAL()) continue ;
1927 
1928  //
1929  // Put track residuals in cluster
1930  //
1931  fEMCALRecoUtils->GetMatchedResiduals(clus->GetID(),dZ,dR);
1932 
1933  if ( TMath::Abs(clus->GetTrackDx()) < 500 )
1934  AliDebug(2,Form("Residuals (Old, New): z (%2.4f,%2.4f), x (%2.4f,%2.4f)\n",
1935  clus->GetTrackDz(),dZ,clus->GetTrackDx(),dR));
1936 
1937  clus->SetTrackDistance(dR,dZ);
1938 
1939  //
1940  // Remove old matches in cluster
1941  //
1942  if(clus->GetNTracksMatched() > 0)
1943  {
1944  if(!strcmp("AliESDCaloCluster",Form("%s",clus->ClassName())))
1945  {
1946  TArrayI arrayTrackMatched(0);
1947  ((AliESDCaloCluster*)clus)->AddTracksMatched(arrayTrackMatched);
1948  }
1949  else
1950  {
1951  for(Int_t iTrack = 0; iTrack < clus->GetNTracksMatched(); iTrack++)
1952  {
1953  ((AliAODCaloCluster*)clus)->RemoveTrackMatched((TObject*)((AliAODCaloCluster*)clus)->GetTrackMatched(iTrack));
1954  }
1955  }
1956  }
1957 
1958  //
1959  // Now put first track index in cluster.
1960  //
1961  Int_t trackIndex = fEMCALRecoUtils->GetMatchedTrackIndex(iclus);
1962  if ( trackIndex >= 0 )
1963  {
1964  if(!strcmp("AliESDCaloCluster",Form("%s",clus->ClassName())))
1965  {
1966  TArrayI arrayTrackMatched(1);
1967  arrayTrackMatched[0] = trackIndex;
1968  ((AliESDCaloCluster*)clus)->AddTracksMatched(arrayTrackMatched);
1969  }
1970  else
1971  {
1972  ((AliAODCaloCluster*)clus)->AddTrackMatched((TObject*)event->GetTrack(trackIndex));
1973  }
1974  }
1975 
1976  } // cluster loop
1977 }
1978 
1979 //___________________________________________________________________________
1992 //___________________________________________________________________________
1993 void AliCalorimeterUtils::SplitEnergy(Int_t absId1, Int_t absId2,
1994  AliVCluster* cluster,
1995  AliVCaloCells* cells,
1996  //Float_t & e1, Float_t & e2,
1997  AliAODCaloCluster* cluster1,
1998  AliAODCaloCluster* cluster2,
1999  Int_t nMax, Int_t eventNumber)
2000 {
2001  TH2F* hClusterMap = 0 ;
2002  TH2F* hClusterLocMax = 0 ;
2003  TH2F* hCluster1 = 0 ;
2004  TH2F* hCluster2 = 0 ;
2005 
2006  if(fPlotCluster)
2007  {
2008  hClusterMap = new TH2F("hClusterMap","Cluster Map",48,0,48,24,0,24);
2009  hClusterLocMax = new TH2F("hClusterLocMax","Cluster 2 highest local maxima",48,0,48,24,0,24);
2010  hCluster1 = new TH2F("hCluster1","Cluster 1",48,0,48,24,0,24);
2011  hCluster2 = new TH2F("hCluster2","Cluster 2",48,0,48,24,0,24);
2012  hClusterMap ->SetXTitle("column");
2013  hClusterMap ->SetYTitle("row");
2014  hClusterLocMax ->SetXTitle("column");
2015  hClusterLocMax ->SetYTitle("row");
2016  hCluster1 ->SetXTitle("column");
2017  hCluster1 ->SetYTitle("row");
2018  hCluster2 ->SetXTitle("column");
2019  hCluster2 ->SetYTitle("row");
2020  }
2021 
2022  Int_t calorimeter = kEMCAL;
2023  if(cluster->IsPHOS())
2024  {
2025  calorimeter=kPHOS;
2026  AliWarning("Not supported for PHOS yet");
2027  return;
2028  }
2029 
2030  const Int_t ncells = cluster->GetNCells();
2031  Int_t absIdList[ncells];
2032 
2033  Float_t e1 = 0, e2 = 0 ;
2034  Int_t icol = -1, irow = -1, iRCU = -1, sm = -1;
2035  Float_t eCluster = 0;
2036  Float_t minCol = 100, minRow = 100, maxCol = -1, maxRow = -1;
2037  for(Int_t iDigit = 0; iDigit < ncells; iDigit++ )
2038  {
2039  absIdList[iDigit] = cluster->GetCellsAbsId()[iDigit];
2040 
2041  Float_t ec = cells->GetCellAmplitude(absIdList[iDigit]);
2042  RecalibrateCellAmplitude(ec,calorimeter, absIdList[iDigit]);
2043  eCluster+=ec;
2044 
2045  if(fPlotCluster)
2046  {
2047  //printf("iDigit %d, absId %d, Ecell %f\n",iDigit,absIdList[iDigit], cells->GetCellAmplitude(absIdList[iDigit]));
2048  sm = GetModuleNumberCellIndexes(absIdList[iDigit], calorimeter, icol, irow, iRCU) ;
2049  if(sm > -1 && sm < 12) // just to avoid compilation warning
2050  {
2051  if(icol > maxCol) maxCol = icol;
2052  if(icol < minCol) minCol = icol;
2053  if(irow > maxRow) maxRow = irow;
2054  if(irow < minRow) minRow = irow;
2055  hClusterMap->Fill(icol,irow,ec);
2056  }
2057  }
2058  }
2059 
2060  // Init counters and variables
2061  Int_t ncells1 = 1 ;
2062  UShort_t absIdList1[9] ;
2063  Double_t fracList1 [9] ;
2064  absIdList1[0] = absId1 ;
2065  fracList1 [0] = 1. ;
2066 
2067  Float_t ecell1 = cells->GetCellAmplitude(absId1);
2068  RecalibrateCellAmplitude(ecell1, calorimeter, absId1);
2069  e1 = ecell1;
2070 
2071  Int_t ncells2 = 1 ;
2072  UShort_t absIdList2[9] ;
2073  Double_t fracList2 [9] ;
2074  absIdList2[0] = absId2 ;
2075  fracList2 [0] = 1. ;
2076 
2077  Float_t ecell2 = cells->GetCellAmplitude(absId2);
2078  RecalibrateCellAmplitude(ecell2, calorimeter, absId2);
2079  e2 = ecell2;
2080 
2081  if(fPlotCluster)
2082  {
2083  Int_t icol1 = -1, irow1 = -1, icol2 = -1, irow2 = -1;
2084  sm = GetModuleNumberCellIndexes(absId1, calorimeter, icol1, irow1, iRCU) ;
2085  hClusterLocMax->Fill(icol1,irow1,ecell1);
2086  sm = GetModuleNumberCellIndexes(absId2, calorimeter, icol2, irow2, iRCU) ;
2087  hClusterLocMax->Fill(icol2,irow2,ecell2);
2088  }
2089 
2090  // Very rough way to share the cluster energy
2091  Float_t eRemain = (eCluster-ecell1-ecell2)/2;
2092  Float_t shareFraction1 = ecell1/eCluster+eRemain/eCluster;
2093  Float_t shareFraction2 = ecell2/eCluster+eRemain/eCluster;
2094 
2095  for(Int_t iDigit = 0; iDigit < ncells; iDigit++)
2096  {
2097  Int_t absId = absIdList[iDigit];
2098 
2099  if ( absId==absId1 || absId==absId2 || absId < 0 ) continue;
2100 
2101  Float_t ecell = cells->GetCellAmplitude(absId);
2102  RecalibrateCellAmplitude(ecell, calorimeter, absId);
2103 
2104  if(AreNeighbours(calorimeter, absId1,absId ))
2105  {
2106  absIdList1[ncells1]= absId;
2107 
2108  if(AreNeighbours(calorimeter, absId2,absId ))
2109  {
2110  fracList1[ncells1] = shareFraction1;
2111  e1 += ecell*shareFraction1;
2112  }
2113  else
2114  {
2115  fracList1[ncells1] = 1.;
2116  e1 += ecell;
2117  }
2118 
2119  ncells1++;
2120 
2121  } // neigbour to cell1
2122 
2123  if(AreNeighbours(calorimeter, absId2,absId ))
2124  {
2125  absIdList2[ncells2]= absId;
2126 
2127  if(AreNeighbours(calorimeter, absId1,absId ))
2128  {
2129  fracList2[ncells2] = shareFraction2;
2130  e2 += ecell*shareFraction2;
2131  }
2132  else
2133  {
2134  fracList2[ncells2] = 1.;
2135  e2 += ecell;
2136  }
2137 
2138  ncells2++;
2139 
2140  } // neigbour to cell2
2141  }
2142 
2143  AliDebug(1,Form("N Local Max %d, Cluster energy = %f, Ecell1 = %f, Ecell2 = %f, Enew1 = %f, Enew2 = %f, Remain %f, \n ncells %d, ncells1 %d, ncells2 %d, f1 %f, f2 %f, sum f12 = %f",
2144  nMax, eCluster,ecell1,ecell2,e1,e2,eCluster-e1-e2,ncells,ncells1,ncells2,shareFraction1,shareFraction2,shareFraction1+shareFraction2));
2145 
2146  cluster1->SetE(e1);
2147  cluster2->SetE(e2);
2148 
2149  cluster1->SetNCells(ncells1);
2150  cluster2->SetNCells(ncells2);
2151 
2152  cluster1->SetCellsAbsId(absIdList1);
2153  cluster2->SetCellsAbsId(absIdList2);
2154 
2155  cluster1->SetCellsAmplitudeFraction(fracList1);
2156  cluster2->SetCellsAmplitudeFraction(fracList2);
2157 
2158  // Correct linearity
2159  CorrectClusterEnergy(cluster1) ;
2160  CorrectClusterEnergy(cluster2) ;
2161 
2162  if(calorimeter==kEMCAL)
2163  {
2164  GetEMCALRecoUtils()->RecalculateClusterPosition(GetEMCALGeometry(), cells, cluster1);
2165  GetEMCALRecoUtils()->RecalculateClusterPosition(GetEMCALGeometry(), cells, cluster2);
2166  }
2167 
2168  if(fPlotCluster)
2169  {
2170  //printf("Cells of cluster1: ");
2171  for(Int_t iDigit = 0; iDigit < ncells1; iDigit++ )
2172  {
2173  //printf(" %d ",absIdList1[iDigit]);
2174 
2175  sm = GetModuleNumberCellIndexes(absIdList1[iDigit], calorimeter, icol, irow, iRCU) ;
2176 
2177  Float_t ecell = cells->GetCellAmplitude(absIdList1[iDigit]);
2178  RecalibrateCellAmplitude(ecell, calorimeter, absIdList1[iDigit]);
2179 
2180  if( AreNeighbours(calorimeter, absId2,absIdList1[iDigit]) && absId1!=absIdList1[iDigit])
2181  hCluster1->Fill(icol,irow,ecell*shareFraction1);
2182  else
2183  hCluster1->Fill(icol,irow,ecell);
2184  }
2185 
2186  //printf(" \n ");
2187  //printf("Cells of cluster2: ");
2188 
2189  for(Int_t iDigit = 0; iDigit < ncells2; iDigit++ )
2190  {
2191  //printf(" %d ",absIdList2[iDigit]);
2192 
2193  sm = GetModuleNumberCellIndexes(absIdList2[iDigit], calorimeter, icol, irow, iRCU) ;
2194 
2195  Float_t ecell = cells->GetCellAmplitude(absIdList2[iDigit]);
2196  RecalibrateCellAmplitude(ecell, calorimeter, absIdList2[iDigit]);
2197 
2198  if( AreNeighbours(calorimeter, absId1,absIdList2[iDigit]) && absId2!=absIdList2[iDigit])
2199  hCluster2->Fill(icol,irow,ecell*shareFraction2);
2200  else
2201  hCluster2->Fill(icol,irow,ecell);
2202  }
2203  //printf(" \n ");
2204 
2205  gStyle->SetPadRightMargin(0.1);
2206  gStyle->SetPadLeftMargin(0.1);
2207  gStyle->SetOptStat(0);
2208  gStyle->SetOptFit(000000);
2209 
2210  if(maxCol-minCol > maxRow-minRow)
2211  {
2212  maxRow+= maxCol-minCol;
2213  }
2214  else
2215  {
2216  maxCol+= maxRow-minRow;
2217  }
2218 
2219  TCanvas * c= new TCanvas("canvas", "canvas", 4000, 4000) ;
2220  c->Divide(2,2);
2221  c->cd(1);
2222  gPad->SetGridy();
2223  gPad->SetGridx();
2224  gPad->SetLogz();
2225  hClusterMap ->SetAxisRange(minCol, maxCol,"X");
2226  hClusterMap ->SetAxisRange(minRow, maxRow,"Y");
2227  hClusterMap ->Draw("colz TEXT");
2228  c->cd(2);
2229  gPad->SetGridy();
2230  gPad->SetGridx();
2231  gPad->SetLogz();
2232  hClusterLocMax ->SetAxisRange(minCol, maxCol,"X");
2233  hClusterLocMax ->SetAxisRange(minRow, maxRow,"Y");
2234  hClusterLocMax ->Draw("colz TEXT");
2235  c->cd(3);
2236  gPad->SetGridy();
2237  gPad->SetGridx();
2238  gPad->SetLogz();
2239  hCluster1 ->SetAxisRange(minCol, maxCol,"X");
2240  hCluster1 ->SetAxisRange(minRow, maxRow,"Y");
2241  hCluster1 ->Draw("colz TEXT");
2242  c->cd(4);
2243  gPad->SetGridy();
2244  gPad->SetGridx();
2245  gPad->SetLogz();
2246  hCluster2 ->SetAxisRange(minCol, maxCol,"X");
2247  hCluster2 ->SetAxisRange(minRow, maxRow,"Y");
2248  hCluster2 ->Draw("colz TEXT");
2249 
2250  if(eCluster > 6 )c->Print(Form("clusterFigures/Event%d_E%1.0f_nMax%d_NCell1_%d_NCell2_%d.eps",
2251  eventNumber,cluster->E(),nMax,ncells1,ncells2));
2252 
2253  delete c;
2254  delete hClusterMap;
2255  delete hClusterLocMax;
2256  delete hCluster1;
2257  delete hCluster2;
2258  }
2259 }
2260 
Bool_t fRecalculatePosition
Recalculate cluster position.
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
AliEMCALGeometry * fEMCALGeo
! EMCAL geometry pointer.
void InitPHOSRecalibrationFactors()
Init PHOS recalibration factors.
Bool_t IsRecalculationOfClusterTrackMatchingOn() const
TGeoHMatrix * fEMCALMatrix[22]
Geometry matrices with alignments.
Int_t GetPHOSChannelStatus(Int_t imod, Int_t iCol, Int_t iRow) const
Float_t fLocMaxCutEDiff
Local maxima cut, when aggregating cells, next can be a bit higher.
TGeoHMatrix * fPHOSMatrix[5]
Geometry matrices with alignments.
Bool_t ClusterContainsBadChannel(Int_t calo, UShort_t *cellList, Int_t nCells)
AliPHOSGeoUtils * fPHOSGeo
! PHOS geometry pointer.
AliEMCALRecoUtils * GetEMCALRecoUtils() const
void SetEMCALL1PhaseInTimeRecalibrationForAllSM(TObjArray *map)
TString fileName
void SwitchOnDistToBadChannelRecalculation()
AliPHOSGeoUtils * GetPHOSGeometry() const
Bool_t fOADBForEMCAL
Get calibration from OADB for EMCAL.
Float_t GetPHOSChannelRecalibrationFactor(Int_t imod, Int_t iCol, Int_t iRow) const
void RecalculateClusterTrackMatching(AliVEvent *event, TObjArray *clusterArray=0x0)
Float_t fLocMaxCutE
Local maxima cut must have more than this energy.
Float_t GetMCECellClusFracCorrection(Float_t eCell, Float_t eCluster) const
void SetEMCALChannelStatusMap(Int_t iSM, TH2I *h)
Bool_t fRunDependentCorrection
Switch on or off the recalibration dependent on T.
TObjArray * fPHOSRecalibrationFactors
Array of histograms with map of recalibration factors, PHOS.
TString fEMCALGeoName
Name of geometry to use for EMCAL.
TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const
Bool_t fRecalibration
Switch on or off the recalibration.
Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM, Int_t iCol, Int_t iRow) const
TH1F * GetEMCALChannelTimeRecalibrationFactors(Int_t bc) const
const TString calorimeter
Definition: anaM.C:35
Int_t fDebug
Debugging level.
TH1C * GetEMCALL1PhaseInTimeRecalibrationForAllSM() const
Bool_t IsRecalibrationOn() const
Bool_t IsMCParticleInCalorimeterAcceptance(Int_t calo, TParticle *particle)
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
Int_t GetModuleNumber(AliAODPWG4Particle *particle, AliVEvent *inputEvent) const
Get the EMCAL/PHOS module number that corresponds to this particle.
Bool_t fLoadEMCALMatrices
Matrices set from configuration, not get from geometry.root or from ESDs/AODs.
AliEMCALGeometry * GetEMCALGeometry() const
Bool_t IsL1PhaseInTimeRecalibrationOn() const
Bool_t fRecalculateMatching
Recalculate cluster position.
Bool_t MaskFrameCluster(Int_t iSM, Int_t ieta) const
Bool_t fOADBForPHOS
Get calibration from OADB for PHOS.
Int_t * fMaskCellColumns
List of masked cells collumn index.
Bool_t fRemoveBadChannels
Check the channel status provided and remove clusters with bad channels.
void InitPHOSBadChannelStatusMap()
Init PHOS bad channels map.
AliCalorimeterUtils()
Constructor. Initialize parameters.
virtual void InitParameters()
Initialize the parameters of the analysis.
Int_t fNMaskCellColumns
Number of masked columns.
Bool_t IsClusterSharedByTwoSuperModules(const AliEMCALGeometry *geom, AliVCluster *cluster)
Int_t GetNumberOfLocalMaxima(AliVCluster *cluster, AliVCaloCells *cells)
Find the number of local maxima in cluster.
Float_t fMCECellClusFracCorrParam[4]
Parameters for the function correcting the weight of the cells in the cluster.
Bool_t fEMCALGeoMatrixSet
Check if the transformation matrix is set for EMCAL.
TH2I * GetPHOSChannelStatusMap(Int_t imod) const
void SetEMCALChannelRecalibrationFactor(Int_t iSM, Int_t iCol, Int_t iRow, Double_t c=1)
TString GetPass()
Get passx from filename.
energy
void RecalculateClusterPosition(AliVCaloCells *cells, AliVCluster *clu)
Bool_t fImportGeometryFromFile
Import geometry settings in geometry.root file.
Bool_t fCorrectELinearity
Correct cluster energy linearity.
Bool_t fPHOSGeoMatrixSet
Check if the transformation matrix is set for PHOS.
TString fOADBFilePathPHOS
Default path $ALICE_PHYSICS/OADB/PHOS, if needed change.
void CorrectClusterEnergy(AliVCluster *cl)
Correct cluster energy non linearity.
Float_t fCutZ
dZ cut on matching (EMCAL/PHOS).
Bool_t fLoadPHOSMatrices
Matrices set from configuration, not get from geometry.root or from ESDs/AODs.
void SetPHOSChannelStatusMap(Int_t imod, TH2I *h)
Int_t fNCellsFromPHOSBorder
Number of cells from PHOS border the cell with maximum amplitude has to be.
AliVTrack * GetMatchedTrack(AliVCluster *cluster, AliVEvent *event, Int_t index=-1) const
void RecalibrateCellTimeL1Phase(Double_t &time, Int_t calo, Int_t iSM, Int_t bunchCrossNumber) const
Recalculate time L1 phase shift if time recalibration available for EMCAL.
Bool_t fMCECellClusFracCorrOn
Correct or not the weight of cells in cluster.
Int_t fNSuperModulesUsed
Number of supermodules to be used in analysis, can be different than the real geo, to be used at initialization of histograms.
TString fImportGeometryFilePath
Path fo geometry.root file.
Bool_t fPlotCluster
Plot cluster in splitting method.
Int_t fRunNumber
Run number of the data, take it from data itself unless set by user.
void RecalibrateCellAmplitude(Float_t &amp, Int_t calo, Int_t absId) const
Recalculate cell energy if recalibration factor.
void SetEMCALChannelTimeRecalibrationFactors(TObjArray *map)
Bool_t IsPHOSGeoMatrixSet() const
Bool_t IsTimeRecalibrationOn() const
Bool_t fOADBSet
AODB parameters already set.
TObjArray * fPHOSBadChannelMap
Array of histograms with map of bad channels, PHOS.
TString fPHOSGeoName
Name of geometry to use for PHOS.
Bool_t AreNeighbours(Int_t calo, Int_t absId1, Int_t absId2) const
Int_t GetEMCALChannelStatus(Int_t iSM, Int_t iCol, Int_t iRow) const
Bool_t IsEMCALGeoMatrixSet() const
Class with utils specific to calorimeter clusters/cells.
void AccessGeometry(AliVEvent *inputEvent)
AliEMCALRecoUtils * fEMCALRecoUtils
EMCAL utils for cluster rereconstruction.
void SetEMCALChannelRecalibrationFactors(Int_t iSM, TH2F *h)
void AccessOADB(AliVEvent *event)
TString fOADBFilePathEMCAL
Default path $ALICE_PHYSICS/OADB/EMCAL, if needed change.
void RecalibrateCellTime(Double_t &time, Int_t calo, Int_t absId, Int_t bunchCrossNumber) const
Recalculate time if time recalibration available for EMCAL not ready for PHOS.
Int_t GetMaxEnergyCell(AliVCaloCells *cells, AliVCluster *clu, Float_t &fraction) const
For a given CaloCluster, it gets the absId of the cell with maximum energy deposit.
Float_t fCutR
dR cut on matching (PHOS).
Float_t RecalibrateClusterEnergyWeightCell(AliVCluster *cluster, AliVCaloCells *cells, Float_t energyOrg)
void SplitEnergy(Int_t absId1, Int_t absId2, AliVCluster *cluster, AliVCaloCells *cells, AliAODCaloCluster *cluster1, AliAODCaloCluster *cluster2, Int_t nMax, Int_t eventNumber=0)
Int_t GetModuleNumberCellIndexes(Int_t absId, Int_t calo, Int_t &icol, Int_t &irow, Int_t &iRCU) const
Get the EMCAL/PHOS module, columns, row and RCU/DDL number that corresponds to this absId...
TH2I * GetEMCALChannelStatusMap(Int_t iSM) const
void SetPHOSChannelRecalibrationFactor(Int_t imod, Int_t iCol, Int_t iRow, Double_t c=1)
Float_t RecalibrateClusterEnergy(AliVCluster *cluster, AliVCaloCells *cells)
Recalibrate the cluster energy, considering the recalibration map and the energy of the cells that co...
void GetEMCALSubregion(AliVCluster *clus, AliVCaloCells *cells, Int_t &regEta, Int_t &regPhi) const
Bool_t CheckCellFiducialRegion(AliVCluster *cluster, AliVCaloCells *cells) const
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