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