]>
Commit | Line | Data |
---|---|---|
765d44e7 | 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 */ | |
765d44e7 | 5 | |
6 | //_________________________________________________________________________ | |
7 | // Class utility for Calorimeter specific selection methods /// | |
8 | // | |
9 | // | |
10 | // | |
11 | //-- Author: Gustavo Conesa (LPSC-Grenoble) | |
12 | ////////////////////////////////////////////////////////////////////////////// | |
13 | ||
14 | // --- ROOT system --- | |
de0b770d | 15 | #include <TObject.h> |
16 | #include <TString.h> | |
17 | #include <TObjArray.h> | |
765d44e7 | 18 | class TArrayF; |
de0b770d | 19 | #include <TH2I.h> |
20 | #include <TGeoMatrix.h> | |
765d44e7 | 21 | |
22 | //--- ANALYSIS system --- | |
23 | class AliVEvent; | |
d832b695 | 24 | class AliVTrack; |
765d44e7 | 25 | class AliAODPWG4Particle; |
c8fe2783 | 26 | class AliVCluster; |
27 | class AliVCaloCells; | |
c5693f62 | 28 | class AliPHOSGeoUtils; |
29 | class AliEMCALGeometry; | |
19db8f8c | 30 | #include "AliEMCALRecoUtils.h" |
765d44e7 | 31 | |
32 | class AliCalorimeterUtils : public TObject { | |
33 | ||
78219bac | 34 | public: |
765d44e7 | 35 | AliCalorimeterUtils() ; // ctor |
765d44e7 | 36 | virtual ~AliCalorimeterUtils() ;//virtual dtor |
765d44e7 | 37 | |
a5fb4114 | 38 | virtual void InitParameters(); |
39 | virtual void Print(const Option_t * opt) const ; | |
765d44e7 | 40 | |
a5fb4114 | 41 | virtual Int_t GetDebug() const { return fDebug ; } |
42 | virtual void SetDebug(Int_t d) { fDebug = d ; } | |
765d44e7 | 43 | |
44 | //virtual void Init(); | |
45 | ||
7db7dcb6 | 46 | // Cluster contents |
47 | ||
48 | Bool_t AreNeighbours(const TString calo, const Int_t absId1, const Int_t absId2) const ; | |
49 | ||
71e3889f | 50 | Int_t GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCaloCells* cells) ; |
51 | ||
7db7dcb6 | 52 | Int_t GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCaloCells* cells, |
53 | Int_t *absIdList, Float_t *maxEList) ; | |
54 | ||
55 | Float_t GetLocalMaximaCutE() const { return fLocMaxCutE ; } | |
56 | void SetLocalMaximaCutE(Float_t cut) { fLocMaxCutE = cut ; } | |
57 | ||
58 | Float_t GetLocalMaximaCutEDiff() const { return fLocMaxCutEDiff ; } | |
59 | void SetLocalMaximaCutEDiff(Float_t c) { fLocMaxCutEDiff = c ; } | |
60 | ||
c5693f62 | 61 | Int_t GetMaxEnergyCell(AliVCaloCells* cells, const AliVCluster* clu, Float_t & fraction) const ; |
13cd2872 | 62 | |
765d44e7 | 63 | //Calorimeters Geometry Methods |
a5fb4114 | 64 | AliEMCALGeometry * GetEMCALGeometry() const { return fEMCALGeo ; } |
65 | TString EMCALGeometryName() const { return fEMCALGeoName ; } | |
66 | void SetEMCALGeometryName(TString name) { fEMCALGeoName = name ; } | |
67 | void InitEMCALGeometry() ; | |
68 | Bool_t IsEMCALGeoMatrixSet() const { return fEMCALGeoMatrixSet ; } | |
765d44e7 | 69 | |
a5fb4114 | 70 | AliPHOSGeoUtils * GetPHOSGeometry() const { return fPHOSGeo ; } |
71 | TString PHOSGeometryName() const { return fPHOSGeoName ; } | |
72 | void SetPHOSGeometryName(TString name) { fPHOSGeoName = name ; } | |
73 | void InitPHOSGeometry() ; | |
74 | Bool_t IsPHOSGeoMatrixSet() const { return fPHOSGeoMatrixSet ; } | |
765d44e7 | 75 | |
a5fb4114 | 76 | void SetGeometryTransformationMatrices(AliVEvent* inputEvent) ; |
765d44e7 | 77 | |
a5fb4114 | 78 | void SwitchOnLoadOwnEMCALGeometryMatrices() { fLoadEMCALMatrices = kTRUE ; } |
79 | void SwitchOffLoadOwnEMCALGeometryMatrices() { fLoadEMCALMatrices = kFALSE ; } | |
80 | void SetEMCALGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fEMCALMatrix[i] = m ; } | |
3b13c34c | 81 | |
a5fb4114 | 82 | void SwitchOnLoadOwnPHOSGeometryMatrices() { fLoadPHOSMatrices = kTRUE ; } |
83 | void SwitchOffLoadOwnPHOSGeometryMatrices() { fLoadPHOSMatrices = kFALSE ; } | |
84 | void SetPHOSGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fPHOSMatrix[i] = m ; } | |
3b13c34c | 85 | |
765d44e7 | 86 | // Bad channels |
a5fb4114 | 87 | Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; } |
88 | void SwitchOnBadChannelsRemoval () { fRemoveBadChannels = kTRUE ; | |
89 | fEMCALRecoUtils->SwitchOnBadChannelsRemoval(); | |
90 | if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap() ; } | |
91 | void SwitchOffBadChannelsRemoval() { fRemoveBadChannels = kFALSE ; | |
92 | fEMCALRecoUtils->SwitchOffBadChannelsRemoval() ; } | |
c0b85449 | 93 | |
a5fb4114 | 94 | Bool_t IsDistanceToBadChannelRecalculated() const { return IsDistanceToBadChannelRecalculated() ; } |
95 | void SwitchOnDistToBadChannelRecalculation () { fEMCALRecoUtils->SwitchOnDistToBadChannelRecalculation() ; } | |
96 | void SwitchOffDistToBadChannelRecalculation() { fEMCALRecoUtils->SwitchOffDistToBadChannelRecalculation(); } | |
c0b85449 | 97 | |
a5fb4114 | 98 | void InitPHOSBadChannelStatusMap () ; |
765d44e7 | 99 | |
a5fb4114 | 100 | Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { |
101 | return fEMCALRecoUtils->GetEMCALChannelStatus(iSM,iCol,iRow); }//Channel is ok by default | |
765d44e7 | 102 | |
a5fb4114 | 103 | Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const { |
104 | if(fPHOSBadChannelMap)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow); | |
105 | else return 0 ; }//Channel is ok by default | |
765d44e7 | 106 | |
a5fb4114 | 107 | void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { |
108 | fEMCALRecoUtils->SetEMCALChannelStatus(iSM,iCol,iRow,c) ; } | |
765d44e7 | 109 | |
a5fb4114 | 110 | void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) { |
111 | if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap() ; | |
112 | ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c) ; } | |
765d44e7 | 113 | |
a5fb4114 | 114 | void SetEMCALChannelStatusMap(Int_t iSM , TH2I* h) { fEMCALRecoUtils->SetEMCALChannelStatusMap(iSM,h) ; } |
115 | void SetPHOSChannelStatusMap(Int_t imod , TH2I* h) { fPHOSBadChannelMap ->AddAt(h,imod) ; } | |
05b8f25a | 116 | |
a5fb4114 | 117 | TH2I * GetEMCALChannelStatusMap(Int_t iSM) const { return fEMCALRecoUtils->GetEMCALChannelStatusMap(iSM) ; } |
118 | TH2I * GetPHOSChannelStatusMap(Int_t imod) const { return (TH2I*)fPHOSBadChannelMap->At(imod) ; } | |
765d44e7 | 119 | |
a5fb4114 | 120 | void SetEMCALChannelStatusMap(TObjArray *map) { fEMCALRecoUtils->SetEMCALChannelStatusMap(map) ; } |
121 | void SetPHOSChannelStatusMap (TObjArray *map) { fPHOSBadChannelMap = map ; } | |
765d44e7 | 122 | |
a5fb4114 | 123 | Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells); |
765d44e7 | 124 | |
a5fb4114 | 125 | // Mask clusters in front of frame, EMCAL only |
126 | Int_t GetNMaskCellColumns() const { return fNMaskCellColumns;} | |
127 | void SetNMaskCellColumns(Int_t n) { | |
128 | if(n > fNMaskCellColumns) { delete [] fMaskCellColumns ; fMaskCellColumns = new Int_t[n] ; } | |
129 | fNMaskCellColumns = n ; } | |
130 | void SetMaskCellColumn(Int_t ipos, Int_t icol) { | |
131 | if(ipos < fNMaskCellColumns) fMaskCellColumns[ipos] = icol; | |
132 | else printf("Not set, position larger than allocated set size first") ; } | |
133 | Bool_t MaskFrameCluster(const Int_t iSM, const Int_t ieta) const ; | |
134 | ||
135 | ||
765d44e7 | 136 | //Calorimeter indexes information |
a5fb4114 | 137 | Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const; |
138 | Int_t GetModuleNumber(AliVCluster * cluster) const; | |
139 | Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ; | |
765d44e7 | 140 | |
141 | //Modules fiducial region | |
a5fb4114 | 142 | Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev=0) const ; |
143 | void SetNumberOfCellsFromPHOSBorder(Int_t n) { fNCellsFromPHOSBorder = n ; } | |
144 | Int_t GetNumberOfCellsFromPHOSBorder() const { return fNCellsFromPHOSBorder ; } | |
145 | void SetNumberOfCellsFromEMCALBorder(Int_t n) { fEMCALRecoUtils->SetNumberOfCellsFromEMCALBorder(n) ; } | |
146 | Int_t GetNumberOfCellsFromEMCALBorder() const { return fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder(); } | |
147 | void SwitchOnNoFiducialBorderInEMCALEta0() { fEMCALRecoUtils->SwitchOnNoFiducialBorderInEMCALEta0() ; } | |
148 | void SwitchOffNoFiducialBorderInEMCALEta0() { fEMCALRecoUtils->SwitchOffNoFiducialBorderInEMCALEta0() ; } | |
149 | Bool_t IsEMCALNoBorderAtEta0() const { return fEMCALRecoUtils->IsEMCALNoBorderAtEta0() ; } | |
247abff4 | 150 | |
09e819c9 | 151 | // Recalibration |
a5fb4114 | 152 | Bool_t IsRecalibrationOn() const { return fRecalibration ; } |
153 | void SwitchOnRecalibration() { fRecalibration = kTRUE ; | |
154 | InitPHOSRecalibrationFactors(); fEMCALRecoUtils->SwitchOnRecalibration() ; } | |
155 | void SwitchOffRecalibration() { fRecalibration = kFALSE; | |
156 | fEMCALRecoUtils->SwitchOffRecalibration() ; } | |
09e819c9 | 157 | |
a5fb4114 | 158 | void InitPHOSRecalibrationFactors () ; |
09e819c9 | 159 | |
a5fb4114 | 160 | Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const { |
161 | return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(iSM , iCol, iRow) ; } | |
78219bac | 162 | |
a5fb4114 | 163 | Float_t GetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow) const { |
164 | if(fPHOSRecalibrationFactors) | |
165 | return (Float_t) ((TH2F*)fPHOSRecalibrationFactors->At(imod))->GetBinContent(iCol,iRow); | |
166 | else return 1 ; } | |
78219bac | 167 | |
a5fb4114 | 168 | void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { |
169 | fEMCALRecoUtils->SetEMCALChannelRecalibrationFactor(iSM,iCol,iRow,c) ; } | |
09e819c9 | 170 | |
a5fb4114 | 171 | void SetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) { |
172 | if(!fPHOSRecalibrationFactors) InitPHOSRecalibrationFactors(); | |
173 | ((TH2F*)fPHOSRecalibrationFactors->At(imod))->SetBinContent(iCol,iRow,c) ; } | |
09e819c9 | 174 | |
a5fb4114 | 175 | void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) { fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(iSM,h) ; } |
176 | void SetPHOSChannelRecalibrationFactors(Int_t imod , TH2F* h) { fPHOSRecalibrationFactors ->AddAt(h,imod) ; } | |
09e819c9 | 177 | |
a5fb4114 | 178 | TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const { return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactors(iSM) ; } |
179 | TH2F * GetPHOSChannelRecalibrationFactors(Int_t imod) const { return (TH2F*)fPHOSRecalibrationFactors->At(imod) ; } | |
09e819c9 | 180 | |
a5fb4114 | 181 | void SetEMCALChannelRecalibrationFactors(TObjArray *map) { fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(map) ; } |
182 | void SetPHOSChannelRecalibrationFactors (TObjArray *map) { fPHOSRecalibrationFactors = map;} | |
09e819c9 | 183 | |
9369a2b1 | 184 | void RecalibrateCellTime (Double_t & time, const TString calo, const Int_t absId, const Int_t bunchCrossNumber) const ; |
185 | void RecalibrateCellAmplitude(Float_t & amp, const TString calo, const Int_t absId) const ; | |
a5fb4114 | 186 | Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells); |
765d44e7 | 187 | |
f2ccb5b8 | 188 | //EMCAL specific utils for the moment |
a5fb4114 | 189 | void SetEMCALRecoUtils(AliEMCALRecoUtils * ru) { fEMCALRecoUtils = ru ; } |
190 | AliEMCALRecoUtils* GetEMCALRecoUtils() const { return fEMCALRecoUtils ; } | |
9584c261 | 191 | |
a5fb4114 | 192 | Bool_t IsCorrectionOfClusterEnergyOn() const { return fCorrectELinearity ; } |
193 | void SwitchOnCorrectClusterLinearity() { fCorrectELinearity = kTRUE ; } | |
194 | void SwitchOffCorrectClusterLinearity() { fCorrectELinearity = kFALSE ; } | |
195 | void CorrectClusterEnergy(AliVCluster *cl); | |
9584c261 | 196 | |
a5fb4114 | 197 | Bool_t IsRecalculationOfClusterPositionOn() const { return fRecalculatePosition ; } |
198 | void SwitchOnRecalculateClusterPosition() { fRecalculatePosition = kTRUE ; } | |
199 | void SwitchOffRecalculateClusterPosition() { fRecalculatePosition = kFALSE ; } | |
200 | void RecalculateClusterPosition(AliVCaloCells* cells, AliVCluster* clu); | |
201 | void RecalculateClusterShowerShapeParameters(AliVCaloCells* cells, AliVCluster* clu){ | |
202 | fEMCALRecoUtils->RecalculateClusterShowerShapeParameters((AliEMCALGeometry*)fEMCALGeo, cells, clu) ; } | |
3b13c34c | 203 | |
a5fb4114 | 204 | void RecalculateClusterDistanceToBadChannel(AliVCaloCells* cells, AliVCluster* clu){ |
205 | fEMCALRecoUtils->RecalculateClusterDistanceToBadChannel((AliEMCALGeometry*)fEMCALGeo, cells, clu) ; } | |
3b13c34c | 206 | |
a5fb4114 | 207 | void RecalculateClusterPID(AliVCluster* clu) { fEMCALRecoUtils->RecalculateClusterPID(clu) ; } |
9584c261 | 208 | |
d832b695 | 209 | // *** Track Matching *** |
210 | ||
211 | AliVTrack * GetMatchedTrack(const AliVCluster * cluster, const AliVEvent * event, const Int_t index = 0) const ; | |
212 | ||
213 | // Recalculation | |
cb5780f4 | 214 | void RecalculateClusterTrackMatching(AliVEvent * event, TObjArray* clusterArray = 0x0) ; |
215 | ||
a5fb4114 | 216 | void GetMatchedResiduals(Int_t index, Float_t &dR, Float_t &dZ) { |
217 | if (fRecalculateMatching) fEMCALRecoUtils->GetMatchedResiduals(index,dR,dZ) ; } | |
9e8998b1 | 218 | |
f2ccb5b8 | 219 | //This could be used for PHOS ... |
a5fb4114 | 220 | void SwitchOnRecalculateClusterTrackMatching() { fRecalculateMatching = kTRUE ; } |
221 | void SwitchOffRecalculateClusterTrackMatching() { fRecalculateMatching = kFALSE ; } | |
222 | Bool_t IsRecalculationOfClusterTrackMatchingOn() const { return fRecalculateMatching ; } | |
f2ccb5b8 | 223 | |
9e8998b1 | 224 | Float_t GetCutZ() const { return fCutZ ; } // PHOS only |
225 | void SetCutZ(Float_t z) { fCutZ = z ; } // PHOS only | |
226 | ||
227 | ||
228 | Float_t GetCutR() const { return fCutR ; } // PHOS and EMCAL | |
229 | void SetCutR(Float_t r) { fCutR = r ; // PHOS and EMCA | |
230 | fEMCALRecoUtils->SetCutR(r) ; } | |
231 | ||
232 | Float_t GetCutEta() const { return fCutEta ; } // EMCAL only | |
233 | void SetCutEta(Float_t e) { fCutEta = e ; // EMCAL only | |
234 | fEMCALRecoUtils->SetCutEta(e) ; } | |
235 | ||
236 | Float_t GetCutPhi() const { return fCutPhi ; } // EMCAL only | |
237 | void SetCutPhi(Float_t p) { fCutPhi = p ; // EMCAL only | |
238 | fEMCALRecoUtils->SetCutPhi(p) ; } | |
f2ccb5b8 | 239 | |
765d44e7 | 240 | private: |
241 | ||
09e819c9 | 242 | Int_t fDebug; // Debugging level |
243 | TString fEMCALGeoName; // Name of geometry to use for EMCAL. | |
244 | TString fPHOSGeoName; // Name of geometry to use for PHOS. | |
a38a48f2 | 245 | AliEMCALGeometry * fEMCALGeo ; //! EMCAL geometry pointer |
09e819c9 | 246 | AliPHOSGeoUtils * fPHOSGeo ; //! PHOS geometry pointer |
247 | Bool_t fEMCALGeoMatrixSet; // Check if the transformation matrix is set for EMCAL | |
248 | Bool_t fPHOSGeoMatrixSet ; // Check if the transformation matrix is set for PHOS | |
3b13c34c | 249 | Bool_t fLoadEMCALMatrices; // Matrices set from configuration, not get from geometry.root or from ESDs/AODs |
90e32961 | 250 | TGeoHMatrix * fEMCALMatrix[12]; // Geometry matrices with alignments |
3b13c34c | 251 | Bool_t fLoadPHOSMatrices; // Matrices set from configuration, not get from geometry.root or from ESDs/AODs |
252 | TGeoHMatrix * fPHOSMatrix[5]; // Geometry matrices with alignments | |
09e819c9 | 253 | Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels |
2be3914b | 254 | TObjArray * fPHOSBadChannelMap; // Array of histograms with map of bad channels, PHOS |
09e819c9 | 255 | Int_t fNCellsFromPHOSBorder; // Number of cells from PHOS border the cell with maximum amplitude has to be. |
a5fb4114 | 256 | Int_t fNMaskCellColumns; // Number of masked columns |
257 | Int_t* fMaskCellColumns; //[fNMaskCellColumns] list of masked cell collumn | |
09e819c9 | 258 | Bool_t fRecalibration; // Switch on or off the recalibration |
2be3914b | 259 | TObjArray * fPHOSRecalibrationFactors; // Array of histograms with map of recalibration factors, PHOS |
9584c261 | 260 | AliEMCALRecoUtils* fEMCALRecoUtils; // EMCAL utils for cluster rereconstruction |
3b13c34c | 261 | Bool_t fRecalculatePosition; // Recalculate cluster position |
262 | Bool_t fCorrectELinearity ; // Correct cluster energy linearity | |
263 | Bool_t fRecalculateMatching; // Recalculate cluster position | |
9e8998b1 | 264 | Float_t fCutR; // dR cut on matching (PHOS) |
265 | Float_t fCutZ; // dZ cut on matching (EMCAL/PHOS) | |
266 | Float_t fCutEta; // dEta cut on matching (EMCAL) | |
267 | Float_t fCutPhi; // dPhi cut on matching (EMCAL) | |
7db7dcb6 | 268 | Float_t fLocMaxCutE; // Local maxima cut must have more than this energy |
269 | Float_t fLocMaxCutEDiff; // Local maxima cut, when aggregating cells, next can be a bit higher | |
3b13c34c | 270 | |
90e32961 | 271 | AliCalorimeterUtils( const AliCalorimeterUtils & cu) ; // cpy ctor |
272 | AliCalorimeterUtils & operator = (const AliCalorimeterUtils & cu) ; // cpy assignment | |
c5693f62 | 273 | |
71e3889f | 274 | ClassDef(AliCalorimeterUtils,11) |
765d44e7 | 275 | } ; |
276 | ||
277 | ||
278 | #endif //ALICALORIMETERUTILS_H | |
279 | ||
280 | ||
281 |