1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 //_________________________________________________________________________
18 // Class utility for Calorimeter specific selection methods ///
22 //-- Author: Gustavo Conesa (LPSC-Grenoble)
23 //////////////////////////////////////////////////////////////////////////////
26 // --- ROOT system ---
27 #include "TGeoManager.h"
29 //---- ANALYSIS system ----
30 #include "AliCalorimeterUtils.h"
31 #include "AliESDEvent.h"
32 #include "AliMCEvent.h"
34 #include "AliAODPWG4Particle.h"
35 #include "AliVCluster.h"
36 #include "AliVCaloCells.h"
37 #include "AliMixedEvent.h"
39 ClassImp(AliCalorimeterUtils)
42 //____________________________________________
43 AliCalorimeterUtils::AliCalorimeterUtils() :
45 fEMCALGeoName("EMCAL_COMPLETEV1"),fPHOSGeoName("PHOSgeo"),
46 fEMCALGeo(0x0), fPHOSGeo(0x0),
47 fEMCALGeoMatrixSet(kFALSE), fPHOSGeoMatrixSet(kFALSE),
48 fLoadEMCALMatrices(kFALSE), fLoadPHOSMatrices(kFALSE),
49 fRemoveBadChannels(kFALSE), fPHOSBadChannelMap(0x0),
50 fNCellsFromPHOSBorder(0),
51 fNMaskCellColumns(0), fMaskCellColumns(0x0),
52 fRecalibration(kFALSE), fPHOSRecalibrationFactors(),
53 fEMCALRecoUtils(new AliEMCALRecoUtils),
54 fRecalculatePosition(kFALSE), fCorrectELinearity(kFALSE),
55 fRecalculateMatching(kFALSE),
57 fCutEta(20), fCutPhi(20)
61 //Initialize parameters
63 for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ;
64 for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix[i] = 0 ;
68 //_________________________________________
69 AliCalorimeterUtils::~AliCalorimeterUtils()
73 //if(fPHOSGeo) delete fPHOSGeo ;
74 if(fEMCALGeo) delete fEMCALGeo ;
76 if(fPHOSBadChannelMap) {
77 fPHOSBadChannelMap->Clear();
78 delete fPHOSBadChannelMap;
81 if(fPHOSRecalibrationFactors) {
82 fPHOSRecalibrationFactors->Clear();
83 delete fPHOSRecalibrationFactors;
86 if(fEMCALRecoUtils) delete fEMCALRecoUtils ;
87 if(fNMaskCellColumns) delete [] fMaskCellColumns;
91 //_____________________________________________________________________________________
92 Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster,
94 AliVEvent * event, Int_t iev) const
97 // Given the list of AbsId of the cluster, get the maximum cell and
98 // check if there are fNCellsFromBorder from the calorimeter border
100 //If the distance to the border is 0 or negative just exit accept all clusters
101 if(cells->GetType()==AliVCaloCells::kEMCALCell && fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder() <= 0 ) return kTRUE;
102 if(cells->GetType()==AliVCaloCells::kPHOSCell && fNCellsFromPHOSBorder <= 0 ) return kTRUE;
107 AliMixedEvent * mixEvent = dynamic_cast<AliMixedEvent*> (event);
108 Int_t nMixedEvents = 0 ;
109 Int_t * cellsCumul = NULL ;
110 Int_t numberOfCells = 0 ;
112 nMixedEvents = mixEvent->GetNumberOfEvents() ;
113 if (cells->GetType()==AliVCaloCells::kEMCALCell) {
114 cellsCumul = mixEvent->GetEMCALCellsCumul() ;
115 numberOfCells = mixEvent->GetNumberOfEMCALCells() ;
118 else if (cells->GetType()==AliVCaloCells::kPHOSCell) {
119 cellsCumul = mixEvent->GetPHOSCellsCumul() ;
120 numberOfCells = mixEvent->GetNumberOfPHOSCells() ;
125 Int_t startCell = cellsCumul[iev] ;
126 Int_t endCell = (iev+1 < nMixedEvents)?cellsCumul[iev+1]:numberOfCells;
127 //Find cells with maximum amplitude
128 for(Int_t i = 0; i < cluster->GetNCells() ; i++){
129 Int_t absId = cluster->GetCellAbsId(i) ;
130 for (Int_t j = startCell; j < endCell ; j++) {
134 cells->GetCell(j, cellNumber, amp, time) ;
135 if (absId == cellNumber) {
142 }//loop on cluster cells
143 }// cells cumul available
145 printf("AliCalorimeterUtils::CheckCellFiducialRegion() - CellsCumul is NULL!!!\n");
148 } else {//Normal SE Events
149 for(Int_t i = 0; i < cluster->GetNCells() ; i++){
150 Int_t absId = cluster->GetCellAbsId(i) ;
151 Float_t amp = cells->GetCellAmplitude(absId);
160 printf("AliCalorimeterUtils::CheckCellFiducialRegion() - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n",
161 absIdMax, ampMax, cluster->E());
163 if(absIdMax==-1) return kFALSE;
165 //Check if the cell is close to the borders:
166 Bool_t okrow = kFALSE;
167 Bool_t okcol = kFALSE;
169 if(cells->GetType()==AliVCaloCells::kEMCALCell){
171 Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1;
172 fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta);
173 fEMCALGeo->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta);
174 if(iSM < 0 || iphi < 0 || ieta < 0 ) {
175 Fatal("CheckCellFidutialRegion","Negative value for super module: %d, or cell ieta: %d, or cell iphi: %d, check EMCAL geometry name\n",iSM,ieta,iphi);
179 Int_t nborder = fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder();
181 if(iphi >= nborder && iphi < 24-nborder) okrow =kTRUE;
184 if(iphi >= nborder && iphi < 12-nborder) okrow =kTRUE;
188 if(!fEMCALRecoUtils->IsEMCALNoBorderAtEta0()){
189 if(ieta > nborder && ieta < 48-nborder) okcol =kTRUE;
193 if(ieta >= nborder) okcol = kTRUE;
196 if(ieta < 48-nborder) okcol = kTRUE;
201 printf("AliCalorimeterUtils::CheckCellFiducialRegion() - EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ?",
202 nborder, ieta, iphi, iSM);
203 if (okcol && okrow ) printf(" YES \n");
204 else printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
207 else if(cells->GetType()==AliVCaloCells::kPHOSCell){
209 Int_t irow = -1, icol = -1;
210 fPHOSGeo->AbsToRelNumbering(absIdMax,relId);
214 if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE;
215 if(icol >= fNCellsFromPHOSBorder && icol < 56-fNCellsFromPHOSBorder) okcol =kTRUE;
218 printf("AliCalorimeterUtils::CheckCellFiducialRegion() - PHOS Cluster in %d cells fiducial volume: icol %d, irow %d, Module %d?",
219 fNCellsFromPHOSBorder, icol, irow, relId[0]-1);
220 if (okcol && okrow ) printf(" YES \n");
221 else printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
225 if (okcol && okrow) return kTRUE;
230 //_________________________________________________________________________________________________________
231 Bool_t AliCalorimeterUtils::ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells)
233 // Check that in the cluster cells, there is no bad channel of those stored
234 // in fEMCALBadChannelMap or fPHOSBadChannelMap
236 if (!fRemoveBadChannels) return kFALSE;
237 //printf("fEMCALBadChannelMap %p, fPHOSBadChannelMap %p \n",fEMCALBadChannelMap,fPHOSBadChannelMap);
238 if(calorimeter == "EMCAL" && !fEMCALRecoUtils->GetEMCALChannelStatusMap(0)) return kFALSE;
239 if(calorimeter == "PHOS" && !fPHOSBadChannelMap) return kFALSE;
244 for(Int_t iCell = 0; iCell<nCells; iCell++){
246 //Get the column and row
247 if(calorimeter == "EMCAL"){
248 return fEMCALRecoUtils->ClusterContainsBadChannel((AliEMCALGeometry*)fEMCALGeo,cellList,nCells);
250 else if(calorimeter=="PHOS"){
252 fPHOSGeo->AbsToRelNumbering(cellList[iCell],relId);
256 if(fPHOSBadChannelMap->GetEntries() <= imod)continue;
257 if(GetPHOSChannelStatus(imod, icol, irow)) return kTRUE;
261 }// cell cluster loop
267 //_______________________________________________________________
268 void AliCalorimeterUtils::CorrectClusterEnergy(AliVCluster *clus)
270 // Correct cluster energy non linearity
272 clus->SetE(fEMCALRecoUtils->CorrectClusterEnergyLinearity(clus));
276 //___________________________________________________________________________________________________________________
277 Int_t AliCalorimeterUtils::GetMaxEnergyCell(AliVCaloCells* cells, AliVCluster* clu, Float_t & clusterFraction) const
280 //For a given CaloCluster gets the absId of the cell
281 //with maximum energy deposit.
283 if( !clu || !cells ){
284 AliInfo("Cluster or cells pointer is null!");
291 Float_t fraction = 1.;
292 Float_t recalFactor = 1.;
293 Int_t cellAbsId =-1 , absId =-1 ;
294 Int_t iSupMod =-1 , ieta =-1 , iphi = -1, iRCU = -1;
296 TString calo = "EMCAL";
297 if(clu->IsPHOS()) calo = "PHOS";
299 for (Int_t iDig=0; iDig< clu->GetNCells(); iDig++) {
301 cellAbsId = clu->GetCellAbsId(iDig);
303 fraction = clu->GetCellAmplitudeFraction(iDig);
304 if(fraction < 1e-4) fraction = 1.; // in case unfolding is off
306 iSupMod = GetModuleNumberCellIndexes(cellAbsId, calo, ieta, iphi, iRCU);
308 if(IsRecalibrationOn()) {
309 if(calo=="EMCAL") recalFactor = GetEMCALChannelRecalibrationFactor(iSupMod,ieta,iphi);
310 else recalFactor = GetPHOSChannelRecalibrationFactor(iSupMod,ieta,iphi);
313 eCell = cells->GetCellAmplitude(cellAbsId)*fraction*recalFactor;
324 clusterFraction = (eTot-eMax)/eTot; //Do not use cluster energy in case it was corrected for non linearity.
330 //_____________________________________________________________________________________________________
331 Int_t AliCalorimeterUtils::GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent * inputEvent) const
333 //Get the EMCAL/PHOS module number that corresponds to this particle
336 if(particle->GetDetector()=="EMCAL"){
337 fEMCALGeo->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(), absId);
339 printf("AliCalorimeterUtils::GetModuleNumber(PWG4AOD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
340 particle->Eta(), particle->Phi()*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId));
341 return fEMCALGeo->GetSuperModuleNumber(absId) ;
343 else if(particle->GetDetector()=="PHOS"){
344 // In case we use the MC reader, the input are TParticles,
345 // in this case use the corresponing method in PHOS Geometry to get the particle.
346 if(strcmp(inputEvent->ClassName(), "AliMCEvent") == 0 )
349 Double_t z = 0., x=0.;
350 TParticle* primary = 0x0;
351 AliStack * stack = ((AliMCEvent*)inputEvent)->Stack();
353 primary = stack->Particle(particle->GetCaloLabel(0));
356 Fatal("GetModuleNumber(PWG4AOD)", "Stack not available, stop!");
360 fPHOSGeo->ImpactOnEmc(primary,mod,z,x) ;
363 Fatal("GetModuleNumber(PWG4AOD)", "Primary not available, stop!");
367 // Input are ESDs or AODs, get the PHOS module number like this.
370 //AliVCluster *cluster = inputEvent->GetCaloCluster(particle->GetCaloLabel(0));
371 //return GetModuleNumber(cluster);
380 //_____________________________________________________________________
381 Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const
383 //Get the EMCAL/PHOS module number that corresponds to this cluster
385 Double_t v[]={0.,0.,0.}; //not necessary to pass the real vertex.
387 if(fDebug > 1) printf("AliCalorimeterUtils::GetModuleNumber() - NUL Cluster, please check!!!");
390 cluster->GetMomentum(lv,v);
391 Float_t phi = lv.Phi();
392 if(phi < 0) phi+=TMath::TwoPi();
394 if(cluster->IsEMCAL()){
395 fEMCALGeo->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId);
397 printf("AliCalorimeterUtils::GetModuleNumber() - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
398 lv.Eta(), phi*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId));
399 return fEMCALGeo->GetSuperModuleNumber(absId) ;
401 else if(cluster->IsPHOS()) {
403 if ( cluster->GetNCells() > 0) {
404 absId = cluster->GetCellAbsId(0);
406 printf("AliCalorimeterUtils::GetModuleNumber() - PHOS: cluster eta %f, phi %f, e %f, absId %d\n",
407 lv.Eta(), phi*TMath::RadToDeg(), lv.E(), absId);
412 fPHOSGeo->AbsToRelNumbering(absId,relId);
414 printf("AliCalorimeterUtils::GetModuleNumber() - PHOS: Module %d\n",relId[0]-1);
423 //___________________________________________________________________________________________________
424 Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(const Int_t absId, const TString calo,
425 Int_t & icol, Int_t & irow, Int_t & iRCU) const
427 //Get the EMCAL/PHOS module, columns, row and RCU number that corresponds to this absId
431 Int_t iTower = -1, iIphi = -1, iIeta = -1;
432 fEMCALGeo->GetCellIndex(absId,imod,iTower,iIphi,iIeta);
433 fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol);
434 if(imod < 0 || irow < 0 || icol < 0 ) {
435 Fatal("GetModuleNumberCellIndexes()","Negative value for super module: %d, or cell icol: %d, or cell irow: %d, check EMCAL geometry name\n",imod,icol,irow);
439 if (0<=irow&&irow<8) iRCU=0; // first cable row
440 else if (8<=irow&&irow<16 && 0<=icol&&icol<24) iRCU=0; // first half;
443 else if(8<=irow&&irow<16 && 24<=icol&&icol<48) iRCU=1; // second half;
445 else if(16<=irow&&irow<24) iRCU=1; // third cable row
447 if (imod%2==1) iRCU = 1 - iRCU; // swap for odd=C side, to allow us to cable both sides the same
449 Fatal("GetModuleNumberCellIndexes()","Wrong EMCAL RCU number = %d\n", iRCU);
456 fPHOSGeo->AbsToRelNumbering(absId,relId);
460 iRCU= (Int_t)(relId[2]-1)/16 ;
461 //Int_t iBranch= (Int_t)(relid[3]-1)/28 ; //0 to 1
463 Fatal("GetModuleNumberCellIndexes()","Wrong PHOS RCU number = %d\n", iRCU);
472 //________________________________________
473 void AliCalorimeterUtils::InitParameters()
475 //Initialize the parameters of the analysis.
476 fEMCALGeoName = "EMCAL_COMPLETEV1";
477 fPHOSGeoName = "PHOSgeo";
478 fEMCALGeoMatrixSet = kFALSE;
479 fPHOSGeoMatrixSet = kFALSE;
480 fRemoveBadChannels = kFALSE;
481 fNCellsFromPHOSBorder = 0;
483 // fMaskCellColumns = new Int_t[fNMaskCellColumns];
484 // fMaskCellColumns[0] = 6 ; fMaskCellColumns[1] = 7 ; fMaskCellColumns[2] = 8 ;
485 // fMaskCellColumns[3] = 35; fMaskCellColumns[4] = 36; fMaskCellColumns[5] = 37;
486 // fMaskCellColumns[6] = 12+AliEMCALGeoParams::fgkEMCALCols; fMaskCellColumns[7] = 13+AliEMCALGeoParams::fgkEMCALCols;
487 // fMaskCellColumns[8] = 40+AliEMCALGeoParams::fgkEMCALCols; fMaskCellColumns[9] = 41+AliEMCALGeoParams::fgkEMCALCols;
488 // fMaskCellColumns[10]= 42+AliEMCALGeoParams::fgkEMCALCols;
493 //_____________________________________________________
494 void AliCalorimeterUtils::InitPHOSBadChannelStatusMap()
496 //Init PHOS bad channels map
497 if(fDebug > 0 )printf("AliCalorimeterUtils::InitPHOSBadChannelStatusMap()\n");
498 //In order to avoid rewriting the same histograms
499 Bool_t oldStatus = TH1::AddDirectoryStatus();
500 TH1::AddDirectory(kFALSE);
502 fPHOSBadChannelMap = new TObjArray(5);
503 for (int i = 0; i < 5; i++)fPHOSBadChannelMap->Add(new TH2I(Form("PHOSBadChannelMap_Mod%d",i),Form("PHOSBadChannelMap_Mod%d",i), 56, 0, 56, 64, 0, 64));
505 fPHOSBadChannelMap->SetOwner(kTRUE);
506 fPHOSBadChannelMap->Compress();
508 //In order to avoid rewriting the same histograms
509 TH1::AddDirectory(oldStatus);
512 //______________________________________________________
513 void AliCalorimeterUtils::InitPHOSRecalibrationFactors()
515 //Init EMCAL recalibration factors
516 if(fDebug > 0 )printf("AliCalorimeterUtils::InitPHOSRecalibrationFactors()\n");
517 //In order to avoid rewriting the same histograms
518 Bool_t oldStatus = TH1::AddDirectoryStatus();
519 TH1::AddDirectory(kFALSE);
521 fPHOSRecalibrationFactors = new TObjArray(5);
522 for (int i = 0; i < 5; i++)fPHOSRecalibrationFactors->Add(new TH2F(Form("PHOSRecalFactors_Mod%d",i),Form("PHOSRecalFactors_Mod%d",i), 56, 0, 56, 64, 0, 64));
523 //Init the histograms with 1
524 for (Int_t m = 0; m < 5; m++) {
525 for (Int_t i = 0; i < 56; i++) {
526 for (Int_t j = 0; j < 64; j++) {
527 SetPHOSChannelRecalibrationFactor(m,i,j,1.);
531 fPHOSRecalibrationFactors->SetOwner(kTRUE);
532 fPHOSRecalibrationFactors->Compress();
534 //In order to avoid rewriting the same histograms
535 TH1::AddDirectory(oldStatus);
539 //___________________________________________
540 void AliCalorimeterUtils::InitEMCALGeometry()
542 //Initialize EMCAL geometry if it did not exist previously
544 fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName);
546 printf("AliCalorimeterUtils::InitEMCALGeometry()");
547 if (!gGeoManager) printf(" - Careful!, gGeoManager not loaded, load misalign matrices");
553 //__________________________________________
554 void AliCalorimeterUtils::InitPHOSGeometry()
556 //Initialize PHOS geometry if it did not exist previously
558 fPHOSGeo = new AliPHOSGeoUtils(fPHOSGeoName);
560 printf("AliCalorimeterUtils::InitPHOSGeometry()");
561 if (!gGeoManager) printf(" - Careful!, gGeoManager not loaded, load misalign matrices");
567 //_________________________________________________________
568 void AliCalorimeterUtils::Print(const Option_t * opt) const
571 //Print some relevant parameters set for the analysis
575 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
576 printf("Remove Clusters with bad channels? %d\n",fRemoveBadChannels);
577 printf("Remove Clusters with max cell at less than %d cells from EMCAL border and %d cells from PHOS border\n",
578 fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder(), fNCellsFromPHOSBorder);
579 if(fEMCALRecoUtils->IsEMCALNoBorderAtEta0()) printf("Do not remove EMCAL clusters at Eta = 0\n");
580 printf("Recalibrate Clusters? %d\n",fRecalibration);
581 printf("Recalculate Clusters Position? %d\n",fRecalculatePosition);
582 printf("Recalculate Clusters Energy? %d\n",fCorrectELinearity);
583 printf("Matching criteria: dR < %2.2f[cm], dZ < %2.2f[cm]\n",fCutR,fCutZ);
588 //__________________________________________________________________
589 Bool_t AliCalorimeterUtils::MaskFrameCluster(const Int_t iSM,
590 const Int_t ieta) const
592 //Check if cell is in one of the regions where we have significant amount
593 //of material in front. Only EMCAL
596 if(iSM%2) icol+=48; // Impair SM, shift index [0-47] to [48-96]
598 if (fNMaskCellColumns && fMaskCellColumns) {
599 for (Int_t imask = 0; imask < fNMaskCellColumns; imask++) {
600 if(icol==fMaskCellColumns[imask]) return kTRUE;
609 //__________________________________________________________________________
610 Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliVCluster * cluster,
611 AliVCaloCells * cells)
613 // Recalibrate the cluster energy, considering the recalibration map and the energy of the cells that compose the cluster.
615 //Initialize some used variables
618 Int_t icol = -1, irow = -1, iRCU = -1, module=1;
619 Float_t factor = 1, frac = 0;
623 //Get the cluster number of cells and list of absId, check what kind of cluster do we have.
624 UShort_t * index = cluster->GetCellsAbsId() ;
625 Double_t * fraction = cluster->GetCellsAmplitudeFraction() ;
626 Int_t ncells = cluster->GetNCells();
627 TString calo = "EMCAL";
628 if(cluster->IsPHOS()) calo = "PHOS";
630 //Loop on the cells, get the cell amplitude and recalibration factor, multiply and and to the new energy
631 for(Int_t icell = 0; icell < ncells; icell++){
632 absId = index[icell];
633 frac = fraction[icell];
634 if(frac < 1e-3) frac = 1; //in case of EMCAL, this is set as 0, not used.
635 module = GetModuleNumberCellIndexes(absId,calo,icol,irow,iRCU);
636 if(cluster->IsPHOS()) factor = GetPHOSChannelRecalibrationFactor (module,icol,irow);
637 else factor = GetEMCALChannelRecalibrationFactor(module,icol,irow);
639 printf("AliCalorimeterUtils::RecalibrateClusterEnergy() - recalibrate cell: %s, module %d, col %d, row %d, cell fraction %f, recalibration factor %f, cell energy %f\n",
640 calo.Data(),module,icol,irow,frac,factor,cells->GetCellAmplitude(absId));
642 energy += cells->GetCellAmplitude(absId)*factor*frac;
646 printf("AliCalorimeterUtils::RecalibrateClusterEnergy() - Energy before %f, after %f\n",cluster->E(),energy);
650 Fatal("RecalibrateClusterEnergy()","Cells pointer does not exist!");
656 //________________________________________________________________________________
657 void AliCalorimeterUtils::SetGeometryTransformationMatrices(AliVEvent* inputEvent)
659 //Set the calorimeters transformation matrices
661 //Get the EMCAL transformation geometry matrices from ESD
662 if(!fEMCALGeoMatrixSet && fEMCALGeo){
663 if(fLoadEMCALMatrices){
664 printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load user defined geometry matrices\n");
665 for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
666 if(fEMCALMatrix[mod]){
668 fEMCALMatrix[mod]->Print();
669 fEMCALGeo->SetMisalMatrix(fEMCALMatrix[mod],mod) ;
672 fEMCALGeoMatrixSet = kTRUE;//At least one, so good
675 else if (!gGeoManager) {
678 printf(" AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load EMCAL misalignment matrices. \n");
679 if(!strcmp(inputEvent->GetName(),"AliESDEvent")) {
680 for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
681 //printf("Load ESD matrix %d, %p\n",mod,((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod));
682 if(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod)) {
683 fEMCALGeo->SetMisalMatrix(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod),mod) ;
685 }// loop over super modules
686 fEMCALGeoMatrixSet = kTRUE;//At least one, so good
691 printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n");
693 }//Get matrix from data
694 else if(gGeoManager){
695 fEMCALGeoMatrixSet = kTRUE;
697 }//EMCAL geo && no geoManager
699 //Get the PHOS transformation geometry matrices from ESD
700 if(!fPHOSGeoMatrixSet && fPHOSGeo){
701 if(fLoadPHOSMatrices){
702 printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load user defined geometry matrices\n");
703 for(Int_t mod=0; mod < 5; mod++){
704 if(fPHOSMatrix[mod]){
706 fPHOSMatrix[mod]->Print();
707 fPHOSGeo->SetMisalMatrix(fPHOSMatrix[mod],mod) ;
710 fPHOSGeoMatrixSet = kTRUE;//At least one, so good
712 else if (!gGeoManager) {
714 printf(" AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load PHOS misalignment matrices. \n");
715 if(!strcmp(inputEvent->GetName(),"AliESDEvent")) {
716 for(Int_t mod=0; mod < 5; mod++){
717 if( ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod)) {
718 //printf("PHOS: mod %d, matrix %p\n",mod, ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod));
719 fPHOSGeo->SetMisalMatrix( ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod),mod) ;
721 }// loop over modules
722 fPHOSGeoMatrixSet = kTRUE; //At least one so good
726 printf("AliCalorimeterUtils::SetGeometryTransformationMatrices() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n");
728 }// get matrix from data
729 else if(gGeoManager){
730 fPHOSGeoMatrixSet = kTRUE;
732 }//PHOS geo and geoManager was not set
735 //__________________________________________________________________________________________
736 void AliCalorimeterUtils::RecalculateClusterPosition(AliVCaloCells* cells, AliVCluster* clu)
739 //Recalculate EMCAL cluster position
741 fEMCALRecoUtils->RecalculateClusterPosition((AliEMCALGeometry*)fEMCALGeo, cells,clu);
745 //________________________________________________________________________________
746 void AliCalorimeterUtils::RecalculateClusterTrackMatching(AliVEvent * event,
747 TObjArray* clusterArray)
749 //Recalculate track matching
751 if (fRecalculateMatching) {
752 fEMCALRecoUtils->FindMatches(event,clusterArray,fEMCALGeo) ;
753 //AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (event);
755 // fEMCALRecoUtils->SetClusterMatchedToTrack(esdevent) ;
756 // fEMCALRecoUtils->SetTracksMatchedToCluster(esdevent) ;