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;
27 #include "AliPHOSGeoUtils.h"
28 #include "AliEMCALGeoUtils.h"
29 class AliEMCALRecoUtils;
31 class AliCalorimeterUtils : public TObject {
34 AliCalorimeterUtils() ; // ctor
35 virtual ~AliCalorimeterUtils() ;//virtual dtor
37 AliCalorimeterUtils(const AliCalorimeterUtils & g) ; // cpy ctor
38 AliCalorimeterUtils & operator = (const AliCalorimeterUtils & g) ;//cpy assignment
42 virtual void InitParameters();
43 virtual void Print(const Option_t * opt) const;
45 virtual Int_t GetDebug() const { return fDebug ; }
46 virtual void SetDebug(Int_t d) { fDebug = d ; }
48 //virtual void Init();
50 //Calorimeters Geometry Methods
51 AliEMCALGeoUtils * GetEMCALGeometry() const { return fEMCALGeo;}
52 TString EMCALGeometryName() const { return fEMCALGeoName ; }
53 void SetEMCALGeometryName(TString name) { fEMCALGeoName = name ; }
54 void InitEMCALGeometry() ;
55 Bool_t IsEMCALGeoMatrixSet() const { return fEMCALGeoMatrixSet; }
57 AliPHOSGeoUtils * GetPHOSGeometry() const { return fPHOSGeo;}
58 TString PHOSGeometryName() const { return fPHOSGeoName ; }
59 void SetPHOSGeometryName(TString name) { fPHOSGeoName = name ; }
60 void InitPHOSGeometry() ;
61 Bool_t IsPHOSGeoMatrixSet() const {return fPHOSGeoMatrixSet ; }
63 void SetGeometryTransformationMatrices(AliVEvent* inputEvent) ;
66 Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; }
67 void SwitchOnBadChannelsRemoval () {fRemoveBadChannels = kTRUE ; InitEMCALBadChannelStatusMap(); InitPHOSBadChannelStatusMap();}
68 void SwitchOffBadChannelsRemoval() {fRemoveBadChannels = kFALSE ; }
70 void InitEMCALBadChannelStatusMap() ;
71 void InitPHOSBadChannelStatusMap () ;
73 Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
74 if(fEMCALBadChannelMap) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow);
75 else return 0;}//Channel is ok by default
77 Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const {
78 if(fPHOSBadChannelMap)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow);
79 else return 0;}//Channel is ok by default
81 void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
82 if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap() ;
83 ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
85 void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
86 if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap() ;
87 ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c);}
89 TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
90 TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap->At(imod);}
92 void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
93 void SetPHOSChannelStatusMap (TObjArray *map) {fPHOSBadChannelMap = map;}
95 Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
97 //Calorimeter indexes information
98 Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const;
99 Int_t GetModuleNumber(AliVCluster * cluster) const;
100 Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
102 //Modules fiducial region
103 Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev=0) const ;
105 void SetNumberOfCellsFromEMCALBorder(Int_t n) {fNCellsFromEMCALBorder = n; }
106 Int_t GetNumberOfCellsFromEMCALBorder() const {return fNCellsFromEMCALBorder; }
107 void SetNumberOfCellsFromPHOSBorder(Int_t n) {fNCellsFromPHOSBorder = n; }
108 Int_t GetNumberOfCellsFromPHOSBorder() const {return fNCellsFromPHOSBorder; }
110 void SwitchOnNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kTRUE; }
111 void SwitchOffNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kFALSE; }
114 Bool_t IsRecalibrationOn() const { return fRecalibration ; }
115 void SwitchOnRecalibration() {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors(); InitPHOSRecalibrationFactors();}
116 void SwitchOffRecalibration() {fRecalibration = kFALSE ; }
118 void InitEMCALRecalibrationFactors() ;
119 void InitPHOSRecalibrationFactors () ;
121 Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const {
122 if(fEMCALRecalibrationFactors) return (Float_t) ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->GetBinContent(iCol,iRow);
125 Float_t GetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow) const {
126 if(fPHOSRecalibrationFactors)return (Float_t) ((TH2F*)fPHOSRecalibrationFactors->At(imod))->GetBinContent(iCol,iRow);
129 void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
130 if(!fEMCALRecalibrationFactors) InitEMCALRecalibrationFactors();
131 ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c);}
133 void SetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
134 if(!fPHOSRecalibrationFactors) InitPHOSRecalibrationFactors();
135 ((TH2F*)fPHOSRecalibrationFactors->At(imod))->SetBinContent(iCol,iRow,c);}
137 void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) {fEMCALRecalibrationFactors->AddAt(h,iSM);}
138 void SetPHOSChannelRecalibrationFactors(Int_t imod , TH2F* h) {fPHOSRecalibrationFactors ->AddAt(h,imod);}
140 TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const {return (TH2F*)fEMCALRecalibrationFactors->At(iSM);}
141 TH2F * GetPHOSChannelRecalibrationFactors(Int_t imod) const {return (TH2F*)fPHOSRecalibrationFactors->At(imod);}
143 void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecalibrationFactors = map;}
144 void SetPHOSChannelRecalibrationFactors (TObjArray *map) {fPHOSRecalibrationFactors = map;}
146 Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells);
148 void SetEMCALRecoUtils(AliEMCALRecoUtils * ru) {fEMCALRecoUtils = ru;}
149 AliEMCALRecoUtils* GetEMCALRecoUtils() const {return fEMCALRecoUtils;}
151 Bool_t IsCorrectionOfClusterEnergyOn() const { return fCorrectELinearity ; }
152 void SwitchOnCorrectClusterLinearity() { fCorrectELinearity = kTRUE; }
153 void SwitchOffCorrectClusterLinearity() { fCorrectELinearity = kFALSE; }
154 void CorrectClusterEnergy(AliVCluster *cl);
156 Bool_t IsRecalculationOfClusterPositionOn() const { return fRecalculatePosition ; }
157 void SwitchOnRecalculateClusterPosition() { fRecalculatePosition = kTRUE; }
158 void SwitchOffRecalculateClusterPosition() { fRecalculatePosition = kFALSE; }
159 void RecalculateClusterPosition(AliVCaloCells* cells, AliVCluster* clu);
163 Int_t fDebug; // Debugging level
164 TString fEMCALGeoName; // Name of geometry to use for EMCAL.
165 TString fPHOSGeoName; // Name of geometry to use for PHOS.
166 AliEMCALGeoUtils * fEMCALGeo ; //! EMCAL geometry pointer
167 AliPHOSGeoUtils * fPHOSGeo ; //! PHOS geometry pointer
168 Bool_t fEMCALGeoMatrixSet; // Check if the transformation matrix is set for EMCAL
169 Bool_t fPHOSGeoMatrixSet ; // Check if the transformation matrix is set for PHOS
170 Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels
171 TObjArray * fEMCALBadChannelMap; // Array of histograms with map of bad channels, EMCAL
172 TObjArray * fPHOSBadChannelMap; // Array of histograms with map of bad channels, PHOS
173 Int_t fNCellsFromEMCALBorder; // Number of cells from EMCAL border the cell with maximum amplitude has to be.
174 Int_t fNCellsFromPHOSBorder; // Number of cells from PHOS border the cell with maximum amplitude has to be.
175 Bool_t fNoEMCALBorderAtEta0; // Do fiducial cut in EMCAL region eta = 0?
176 Bool_t fRecalibration; // Switch on or off the recalibration
177 TObjArray * fEMCALRecalibrationFactors; // Array of histograms with map of recalibration factors, EMCAL
178 TObjArray * fPHOSRecalibrationFactors; // Array of histograms with map of recalibration factors, PHOS
179 AliEMCALRecoUtils* fEMCALRecoUtils; // EMCAL utils for cluster rereconstruction
180 Bool_t fRecalculatePosition; // Recalculate cluster position
181 Bool_t fCorrectELinearity ; // Correct cluster energy linearity
183 ClassDef(AliCalorimeterUtils,3)
187 #endif //ALICALORIMETERUTILS_H