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 {
36 AliCalorimeterUtils() ; // ctor
37 AliCalorimeterUtils(const AliCalorimeterUtils & g) ; // cpy ctor
38 virtual ~AliCalorimeterUtils() ;//virtual dtor
41 AliCalorimeterUtils & operator = (const AliCalorimeterUtils & g) ;//cpy assignment
45 virtual void InitParameters();
46 virtual void Print(const Option_t * opt) const;
48 virtual Int_t GetDebug() const { return fDebug ; }
49 virtual void SetDebug(Int_t d) { fDebug = d ; }
51 //virtual void Init();
53 //Calorimeters Geometry Methods
54 AliEMCALGeoUtils * GetEMCALGeometry() const { return fEMCALGeo;}
55 TString EMCALGeometryName() const { return fEMCALGeoName ; }
56 void SetEMCALGeometryName(TString name) { fEMCALGeoName = name ; }
57 void InitEMCALGeometry() ;
58 Bool_t IsEMCALGeoMatrixSet() const { return fEMCALGeoMatrixSet; }
60 AliPHOSGeoUtils * GetPHOSGeometry() const { return fPHOSGeo;}
61 TString PHOSGeometryName() const { return fPHOSGeoName ; }
62 void SetPHOSGeometryName(TString name) { fPHOSGeoName = name ; }
63 void InitPHOSGeometry() ;
64 Bool_t IsPHOSGeoMatrixSet() const {return fPHOSGeoMatrixSet ; }
66 void SetGeometryTransformationMatrices(AliVEvent* inputEvent) ;
69 Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; }
70 void SwitchOnBadChannelsRemoval() {fRemoveBadChannels = kTRUE ; }
71 void SwitchOffBadChannelsRemoval() {fRemoveBadChannels = kFALSE ; }
73 void InitEMCALBadChannelStatusMap() ;
74 void InitPHOSBadChannelStatusMap () ;
76 Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
77 if(fEMCALBadChannelMap->GetEntries()>0) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow);
80 Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const {
81 if(fPHOSBadChannelMap->GetEntries()>0)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow);
84 void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
85 if(!fEMCALBadChannelMap->GetEntries())InitEMCALBadChannelStatusMap() ;
86 ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
88 void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
89 if(!fPHOSBadChannelMap->GetEntries()) InitPHOSBadChannelStatusMap() ;
90 ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c);}
92 TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
93 TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap->At(imod);}
95 void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
96 void SetPHOSChannelStatusMap (TObjArray *map) {fPHOSBadChannelMap = map;}
98 Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
100 //Calorimeter indexes information
101 Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const;
102 Int_t GetModuleNumber(AliAODCaloCluster * cluster) const;
103 Int_t GetModuleNumber(AliESDCaloCluster * cluster) const;
105 Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
107 //Modules fiducial region
108 Bool_t CheckCellFiducialRegion(AliAODCaloCluster* cluster, AliAODCaloCells* cells) const ;
109 Bool_t CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const ;
111 void SetNumberOfCellsFromEMCALBorder(Int_t n) {fNCellsFromEMCALBorder = n; }
112 Int_t GetNumberOfCellsFromEMCALBorder() const {return fNCellsFromEMCALBorder; }
113 void SetNumberOfCellsFromPHOSBorder(Int_t n) {fNCellsFromPHOSBorder = n; }
114 Int_t GetNumberOfCellsFromPHOSBorder() const {return fNCellsFromPHOSBorder; }
116 void SwitchOnNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kTRUE; }
117 void SwitchOffNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kFALSE; }
120 Bool_t IsRecalibrationOn() const { return fRecalibration ; }
121 void SwitchOnRecalibration() {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors(); InitPHOSRecalibrationFactors();}
122 void SwitchOffRecalibration() {fRecalibration = kFALSE ; }
124 void InitEMCALRecalibrationFactors() ;
125 void InitPHOSRecalibrationFactors () ;
127 Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const {
128 if(fEMCALRecalibrationFactors->GetEntries()>0) return (Float_t) ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->GetBinContent(iCol,iRow);
131 Float_t GetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow) const {
132 if(fPHOSRecalibrationFactors->GetEntries()>0)return (Float_t) ((TH2F*)fPHOSRecalibrationFactors->At(imod))->GetBinContent(iCol,iRow);
135 void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
136 ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c);}
138 void SetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
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