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