1 #ifndef ALICALORIMETERUTILS_H
2 #define ALICALORIMETERUTILS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
7 //_________________________________________________________________________
8 // Class utility for Calorimeter specific selection methods ///
12 //-- Author: Gustavo Conesa (LPSC-Grenoble)
13 //////////////////////////////////////////////////////////////////////////////
15 // --- ROOT system ---
18 #include "TObjArray.h"
22 //--- ANALYSIS system ---
24 class AliAODPWG4Particle;
25 class AliAODCaloCluster;
26 class AliAODCaloCells;
27 class AliESDCaloCluster;
28 class AliESDCaloCells;
29 #include "AliPHOSGeoUtils.h"
30 #include "AliEMCALGeoUtils.h"
32 class AliCalorimeterUtils : public TObject {
35 AliCalorimeterUtils() ; // ctor
36 virtual ~AliCalorimeterUtils() ;//virtual dtor
38 AliCalorimeterUtils(const AliCalorimeterUtils & g) ; // cpy ctor
39 AliCalorimeterUtils & operator = (const AliCalorimeterUtils & g) ;//cpy assignment
43 virtual void InitParameters();
44 virtual void Print(const Option_t * opt) const;
46 virtual Int_t GetDebug() const { return fDebug ; }
47 virtual void SetDebug(Int_t d) { fDebug = d ; }
49 //virtual void Init();
51 //Calorimeters Geometry Methods
52 AliEMCALGeoUtils * GetEMCALGeometry() const { return fEMCALGeo;}
53 TString EMCALGeometryName() const { return fEMCALGeoName ; }
54 void SetEMCALGeometryName(TString name) { fEMCALGeoName = name ; }
55 void InitEMCALGeometry() ;
56 Bool_t IsEMCALGeoMatrixSet() const { return fEMCALGeoMatrixSet; }
58 AliPHOSGeoUtils * GetPHOSGeometry() const { return fPHOSGeo;}
59 TString PHOSGeometryName() const { return fPHOSGeoName ; }
60 void SetPHOSGeometryName(TString name) { fPHOSGeoName = name ; }
61 void InitPHOSGeometry() ;
62 Bool_t IsPHOSGeoMatrixSet() const {return fPHOSGeoMatrixSet ; }
64 void SetGeometryTransformationMatrices(AliVEvent* inputEvent) ;
67 Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; }
68 void SwitchOnBadChannelsRemoval () {fRemoveBadChannels = kTRUE ; InitEMCALBadChannelStatusMap(); InitPHOSBadChannelStatusMap();}
69 void SwitchOffBadChannelsRemoval() {fRemoveBadChannels = kFALSE ; }
71 void InitEMCALBadChannelStatusMap() ;
72 void InitPHOSBadChannelStatusMap () ;
74 Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
75 if(fEMCALBadChannelMap->GetEntriesFast()>0) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow);
76 else return 0;}//Channel is ok by default
78 Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const {
79 if(fPHOSBadChannelMap->GetEntriesFast()>0)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow);
80 else return 0;}//Channel is ok by default
82 void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
83 if(!fEMCALBadChannelMap->GetEntriesFast())InitEMCALBadChannelStatusMap() ;
84 ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
86 void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
87 if(!fPHOSBadChannelMap->GetEntriesFast()) InitPHOSBadChannelStatusMap() ;
88 ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c);}
90 TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
91 TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap->At(imod);}
93 void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
94 void SetPHOSChannelStatusMap (TObjArray *map) {fPHOSBadChannelMap = map;}
96 Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
98 //Calorimeter indexes information
99 Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const;
100 Int_t GetModuleNumber(AliAODCaloCluster * cluster) const;
101 Int_t GetModuleNumber(AliESDCaloCluster * cluster) const;
103 Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
105 //Modules fiducial region
106 Bool_t CheckCellFiducialRegion(AliAODCaloCluster* cluster, AliAODCaloCells* cells) const ;
107 Bool_t CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const ;
109 void SetNumberOfCellsFromEMCALBorder(Int_t n) {fNCellsFromEMCALBorder = n; }
110 Int_t GetNumberOfCellsFromEMCALBorder() const {return fNCellsFromEMCALBorder; }
111 void SetNumberOfCellsFromPHOSBorder(Int_t n) {fNCellsFromPHOSBorder = n; }
112 Int_t GetNumberOfCellsFromPHOSBorder() const {return fNCellsFromPHOSBorder; }
114 void SwitchOnNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kTRUE; }
115 void SwitchOffNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kFALSE; }
118 Bool_t IsRecalibrationOn() const { return fRecalibration ; }
119 void SwitchOnRecalibration() {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors(); InitPHOSRecalibrationFactors();}
120 void SwitchOffRecalibration() {fRecalibration = kFALSE ; }
122 void InitEMCALRecalibrationFactors() ;
123 void InitPHOSRecalibrationFactors () ;
125 Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const {
126 if(fEMCALRecalibrationFactors) return (Float_t) ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->GetBinContent(iCol,iRow);
129 Float_t GetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow) const {
130 if(fPHOSRecalibrationFactors)return (Float_t) ((TH2F*)fPHOSRecalibrationFactors->At(imod))->GetBinContent(iCol,iRow);
133 void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
134 if(!fEMCALRecalibrationFactors) InitEMCALRecalibrationFactors();
135 ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c);}
137 void SetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
138 if(!fPHOSRecalibrationFactors) InitPHOSRecalibrationFactors();
139 ((TH2F*)fPHOSRecalibrationFactors->At(imod))->SetBinContent(iCol,iRow,c);}
141 void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) {fEMCALRecalibrationFactors->AddAt(h,iSM);}
142 void SetPHOSChannelRecalibrationFactors(Int_t imod , TH2F* h) {fPHOSRecalibrationFactors ->AddAt(h,imod);}
144 TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const {return (TH2F*)fEMCALRecalibrationFactors->At(iSM);}
145 TH2F * GetPHOSChannelRecalibrationFactors(Int_t imod) const {return (TH2F*)fPHOSRecalibrationFactors->At(imod);}
147 void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecalibrationFactors = map;}
148 void SetPHOSChannelRecalibrationFactors (TObjArray *map) {fPHOSRecalibrationFactors = map;}
150 Float_t RecalibrateClusterEnergy(AliESDCaloCluster* cluster, AliESDCaloCells * cells);
151 Float_t RecalibrateClusterEnergy(AliAODCaloCluster* cluster, AliAODCaloCells * cells);
155 Int_t fDebug; // Debugging level
156 TString fEMCALGeoName; // Name of geometry to use for EMCAL.
157 TString fPHOSGeoName; // Name of geometry to use for PHOS.
158 AliEMCALGeoUtils * fEMCALGeo ; //! EMCAL geometry pointer
159 AliPHOSGeoUtils * fPHOSGeo ; //! PHOS geometry pointer
160 Bool_t fEMCALGeoMatrixSet; // Check if the transformation matrix is set for EMCAL
161 Bool_t fPHOSGeoMatrixSet ; // Check if the transformation matrix is set for PHOS
162 Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels
163 TObjArray * fEMCALBadChannelMap; //! Array of histograms with map of bad channels, EMCAL
164 TObjArray * fPHOSBadChannelMap; //! Array of histograms with map of bad channels, PHOS
165 Int_t fNCellsFromEMCALBorder; // Number of cells from EMCAL border the cell with maximum amplitude has to be.
166 Int_t fNCellsFromPHOSBorder; // Number of cells from PHOS border the cell with maximum amplitude has to be.
167 Bool_t fNoEMCALBorderAtEta0; // Do fiducial cut in EMCAL region eta = 0?
168 Bool_t fRecalibration; // Switch on or off the recalibration
169 TObjArray * fEMCALRecalibrationFactors; //! Array of histograms with map of recalibration factors, EMCAL
170 TObjArray * fPHOSRecalibrationFactors; //! Array of histograms with map of recalibration factors, PHOS
172 ClassDef(AliCalorimeterUtils,2)
176 #endif //ALICALORIMETERUTILS_H