]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrBase/AliCalorimeterUtils.h
Update in AliEMCALRecoUtils, some of its new functionalities moved from AliCalorimete...
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCalorimeterUtils.h
CommitLineData
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 */
5/* $Id: $ */
6
7//_________________________________________________________________________
8// Class utility for Calorimeter specific selection methods ///
9//
10//
11//
12//-- Author: Gustavo Conesa (LPSC-Grenoble)
13//////////////////////////////////////////////////////////////////////////////
14
15// --- ROOT system ---
16#include "TObject.h"
17#include "TString.h"
18#include "TObjArray.h"
19class TArrayF;
20#include "TH2I.h"
21
22//--- ANALYSIS system ---
23class AliVEvent;
24class AliAODPWG4Particle;
c8fe2783 25class AliVCluster;
26class AliVCaloCells;
765d44e7 27#include "AliPHOSGeoUtils.h"
28#include "AliEMCALGeoUtils.h"
19db8f8c 29#include "AliEMCALRecoUtils.h"
765d44e7 30
31class AliCalorimeterUtils : public TObject {
32
78219bac 33 public:
765d44e7 34 AliCalorimeterUtils() ; // ctor
765d44e7 35 virtual ~AliCalorimeterUtils() ;//virtual dtor
78219bac 36 private:
37 AliCalorimeterUtils(const AliCalorimeterUtils & g) ; // cpy ctor
765d44e7 38 AliCalorimeterUtils & operator = (const AliCalorimeterUtils & g) ;//cpy assignment
39
78219bac 40 public:
765d44e7 41
42 virtual void InitParameters();
43 virtual void Print(const Option_t * opt) const;
44
45 virtual Int_t GetDebug() const { return fDebug ; }
46 virtual void SetDebug(Int_t d) { fDebug = d ; }
47
48 //virtual void Init();
49
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; }
56
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 ; }
62
63 void SetGeometryTransformationMatrices(AliVEvent* inputEvent) ;
64
65 // Bad channels
66 Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; }
fa991e42 67 void SwitchOnBadChannelsRemoval () {fRemoveBadChannels = kTRUE ; InitEMCALBadChannelStatusMap(); InitPHOSBadChannelStatusMap();}
68 void SwitchOffBadChannelsRemoval() {fRemoveBadChannels = kFALSE ; }
765d44e7 69
70 void InitEMCALBadChannelStatusMap() ;
71 void InitPHOSBadChannelStatusMap () ;
72
73 Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
37c0bcde 74 if(fEMCALBadChannelMap) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow);
fa991e42 75 else return 0;}//Channel is ok by default
765d44e7 76
77 Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const {
37c0bcde 78 if(fPHOSBadChannelMap)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow);
fa991e42 79 else return 0;}//Channel is ok by default
765d44e7 80
81 void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
37c0bcde 82 if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap() ;
765d44e7 83 ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
84
85 void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
37c0bcde 86 if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap() ;
765d44e7 87 ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c);}
88
89 TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
90 TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap->At(imod);}
91
92 void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
93 void SetPHOSChannelStatusMap (TObjArray *map) {fPHOSBadChannelMap = map;}
94
95 Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
96
97 //Calorimeter indexes information
98 Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const;
c8fe2783 99 Int_t GetModuleNumber(AliVCluster * cluster) const;
765d44e7 100 Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
101
102 //Modules fiducial region
c8fe2783 103 Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev=0) const ;
765d44e7 104
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; }
109
110 void SwitchOnNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kTRUE; }
111 void SwitchOffNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kFALSE; }
09e819c9 112
113 // Recalibration
114 Bool_t IsRecalibrationOn() const { return fRecalibration ; }
19db8f8c 115 void SwitchOnRecalibration() {fRecalibration = kTRUE ; InitPHOSRecalibrationFactors(); fEMCALRecoUtils->SwitchOnRecalibration();}
116 void SwitchOffRecalibration() {fRecalibration = kFALSE;fEMCALRecoUtils->SwitchOffRecalibration();}
09e819c9 117
09e819c9 118 void InitPHOSRecalibrationFactors () ;
119
19db8f8c 120 Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const { return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(iSM , iCol, iRow);}
78219bac 121
09e819c9 122 Float_t GetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow) const {
78219bac 123 if(fPHOSRecalibrationFactors)return (Float_t) ((TH2F*)fPHOSRecalibrationFactors->At(imod))->GetBinContent(iCol,iRow);
124 else return 1;}
125
09e819c9 126 void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
19db8f8c 127 fEMCALRecoUtils->SetEMCALChannelRecalibrationFactor(iSM,iCol,iRow,c);}
09e819c9 128
129 void SetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
78219bac 130 if(!fPHOSRecalibrationFactors) InitPHOSRecalibrationFactors();
131 ((TH2F*)fPHOSRecalibrationFactors->At(imod))->SetBinContent(iCol,iRow,c);}
09e819c9 132
19db8f8c 133 void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) {fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(iSM,h);}
09e819c9 134 void SetPHOSChannelRecalibrationFactors(Int_t imod , TH2F* h) {fPHOSRecalibrationFactors ->AddAt(h,imod);}
135
19db8f8c 136 TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const {return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactors(iSM);}
09e819c9 137 TH2F * GetPHOSChannelRecalibrationFactors(Int_t imod) const {return (TH2F*)fPHOSRecalibrationFactors->At(imod);}
138
19db8f8c 139 void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(map);}
09e819c9 140 void SetPHOSChannelRecalibrationFactors (TObjArray *map) {fPHOSRecalibrationFactors = map;}
141
c8fe2783 142 Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells);
765d44e7 143
9584c261 144 void SetEMCALRecoUtils(AliEMCALRecoUtils * ru) {fEMCALRecoUtils = ru;}
145 AliEMCALRecoUtils* GetEMCALRecoUtils() const {return fEMCALRecoUtils;}
146
147 Bool_t IsCorrectionOfClusterEnergyOn() const { return fCorrectELinearity ; }
148 void SwitchOnCorrectClusterLinearity() { fCorrectELinearity = kTRUE; }
149 void SwitchOffCorrectClusterLinearity() { fCorrectELinearity = kFALSE; }
150 void CorrectClusterEnergy(AliVCluster *cl);
151
152 Bool_t IsRecalculationOfClusterPositionOn() const { return fRecalculatePosition ; }
153 void SwitchOnRecalculateClusterPosition() { fRecalculatePosition = kTRUE; }
154 void SwitchOffRecalculateClusterPosition() { fRecalculatePosition = kFALSE; }
155 void RecalculateClusterPosition(AliVCaloCells* cells, AliVCluster* clu);
156
765d44e7 157 private:
158
09e819c9 159 Int_t fDebug; // Debugging level
160 TString fEMCALGeoName; // Name of geometry to use for EMCAL.
161 TString fPHOSGeoName; // Name of geometry to use for PHOS.
162 AliEMCALGeoUtils * fEMCALGeo ; //! EMCAL geometry pointer
163 AliPHOSGeoUtils * fPHOSGeo ; //! PHOS geometry pointer
164 Bool_t fEMCALGeoMatrixSet; // Check if the transformation matrix is set for EMCAL
165 Bool_t fPHOSGeoMatrixSet ; // Check if the transformation matrix is set for PHOS
166 Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels
2be3914b 167 TObjArray * fEMCALBadChannelMap; // Array of histograms with map of bad channels, EMCAL
168 TObjArray * fPHOSBadChannelMap; // Array of histograms with map of bad channels, PHOS
09e819c9 169 Int_t fNCellsFromEMCALBorder; // Number of cells from EMCAL border the cell with maximum amplitude has to be.
170 Int_t fNCellsFromPHOSBorder; // Number of cells from PHOS border the cell with maximum amplitude has to be.
171 Bool_t fNoEMCALBorderAtEta0; // Do fiducial cut in EMCAL region eta = 0?
172 Bool_t fRecalibration; // Switch on or off the recalibration
2be3914b 173 TObjArray * fPHOSRecalibrationFactors; // Array of histograms with map of recalibration factors, PHOS
9584c261 174 AliEMCALRecoUtils* fEMCALRecoUtils; // EMCAL utils for cluster rereconstruction
175 Bool_t fRecalculatePosition; // Recalculate cluster position
176 Bool_t fCorrectELinearity ; // Correct cluster energy linearity
177
178 ClassDef(AliCalorimeterUtils,3)
765d44e7 179} ;
180
181
182#endif //ALICALORIMETERUTILS_H
183
184
185