]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCalorimeterUtils.h
Remove unnecessary print from QA class
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCalorimeterUtils.h
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"
19 class TArrayF;  
20 #include "TH2I.h"
21
22 //--- ANALYSIS system ---
23 class AliVEvent;
24 class AliAODPWG4Particle;
25 class AliVCluster;
26 class AliVCaloCells;
27 #include "AliPHOSGeoUtils.h"
28 #include "AliEMCALGeometry.h"
29 #include "AliEMCALRecoUtils.h"
30
31 class AliCalorimeterUtils : public TObject {
32
33  public:   
34   AliCalorimeterUtils() ; // ctor
35   virtual ~AliCalorimeterUtils() ;//virtual dtor
36  private:
37   AliCalorimeterUtils(const AliCalorimeterUtils & g) ; // cpy ctor
38   AliCalorimeterUtils & operator = (const AliCalorimeterUtils & g) ;//cpy assignment
39
40  public:
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   void SwitchOnLoadOwnEMCALGeometryMatrices()              { fLoadEMCALMatrices = kTRUE  ; }
66   void SwitchOffLoadOwnEMCALGeometryMatrices()             { fLoadEMCALMatrices = kFALSE ; }
67   void SetEMCALGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fEMCALMatrix[i]    = m      ; }
68   
69   void SwitchOnLoadOwnPHOSGeometryMatrices()               { fLoadPHOSMatrices = kTRUE  ; }
70   void SwitchOffLoadOwnPHOSGeometryMatrices()              { fLoadPHOSMatrices = kFALSE ; }
71   void SetPHOSGeometryMatrixInSM(TGeoHMatrix* m, Int_t i)  { fPHOSMatrix[i]    = m      ; }
72   
73   // Bad channels
74   Bool_t IsBadChannelsRemovalSwitchedOn()  const { return fRemoveBadChannels ; }
75   void SwitchOnBadChannelsRemoval ()  {fRemoveBadChannels = kTRUE  ; fEMCALRecoUtils->SwitchOnBadChannelsRemoval(); 
76     if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap();}
77   void SwitchOffBadChannelsRemoval()  {fRemoveBadChannels = kFALSE ; fEMCALRecoUtils->SwitchOffBadChannelsRemoval();}
78   
79   Bool_t IsDistanceToBadChannelRecalculated() const { return  IsDistanceToBadChannelRecalculated()         ; }
80   void SwitchOnDistToBadChannelRecalculation ()  {fEMCALRecoUtils->SwitchOnDistToBadChannelRecalculation() ; }
81   void SwitchOffDistToBadChannelRecalculation()  {fEMCALRecoUtils->SwitchOffDistToBadChannelRecalculation(); }
82   
83   void InitPHOSBadChannelStatusMap () ;
84
85   Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { 
86     return fEMCALRecoUtils->GetEMCALChannelStatus(iSM,iCol,iRow); }//Channel is ok by default
87
88   Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const { 
89     if(fPHOSBadChannelMap)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow); 
90     else return 0;}//Channel is ok by default
91   
92   void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { 
93     fEMCALRecoUtils->SetEMCALChannelStatus(iSM,iCol,iRow,c);}
94   
95   void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
96         if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap() ; 
97         ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c);}
98     
99   void SetEMCALChannelStatusMap(Int_t iSM , TH2I* h) {fEMCALRecoUtils->SetEMCALChannelStatusMap(iSM,h);}
100   void SetPHOSChannelStatusMap(Int_t imod , TH2I* h) {fPHOSBadChannelMap ->AddAt(h,imod);}
101   
102   TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return fEMCALRecoUtils->GetEMCALChannelStatusMap(iSM);}
103   TH2I * GetPHOSChannelStatusMap(Int_t imod) const {return (TH2I*)fPHOSBadChannelMap->At(imod);}
104
105   void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALRecoUtils->SetEMCALChannelStatusMap(map);}
106   void SetPHOSChannelStatusMap (TObjArray *map) {fPHOSBadChannelMap  = map;}
107         
108   Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
109         
110   //Calorimeter indexes information
111   Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const;
112   Int_t GetModuleNumber(AliVCluster * cluster) const;
113   Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
114         
115   //Modules fiducial region
116   Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev=0) const ;
117   void   SetNumberOfCellsFromPHOSBorder(Int_t n)  {fNCellsFromPHOSBorder = n; }
118   Int_t  GetNumberOfCellsFromPHOSBorder()  const  {return fNCellsFromPHOSBorder; }
119   void   SetNumberOfCellsFromEMCALBorder(Int_t n) {fEMCALRecoUtils->SetNumberOfCellsFromEMCALBorder(n)      ;}
120   Int_t  GetNumberOfCellsFromEMCALBorder() const  {return fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder();}
121   void   SwitchOnNoFiducialBorderInEMCALEta0()    {fEMCALRecoUtils->SwitchOnNoFiducialBorderInEMCALEta0()   ;}
122   void   SwitchOffNoFiducialBorderInEMCALEta0()   {fEMCALRecoUtils->SwitchOffNoFiducialBorderInEMCALEta0()  ;}
123   Bool_t IsEMCALNoBorderAtEta0()           const  {return fEMCALRecoUtils->IsEMCALNoBorderAtEta0()          ;}
124   
125   // Recalibration
126   Bool_t IsRecalibrationOn()  const { return fRecalibration ; }
127   void SwitchOnRecalibration()    {fRecalibration = kTRUE ; InitPHOSRecalibrationFactors(); fEMCALRecoUtils->SwitchOnRecalibration();}
128   void SwitchOffRecalibration()   {fRecalibration = kFALSE;fEMCALRecoUtils->SwitchOffRecalibration();}
129         
130   void InitPHOSRecalibrationFactors () ;
131         
132   Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const { return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(iSM , iCol, iRow);}
133   
134   Float_t GetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow) const { 
135     if(fPHOSRecalibrationFactors)return (Float_t) ((TH2F*)fPHOSRecalibrationFactors->At(imod))->GetBinContent(iCol,iRow); 
136     else return 1;}
137   
138   void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { 
139     fEMCALRecoUtils->SetEMCALChannelRecalibrationFactor(iSM,iCol,iRow,c);}
140         
141   void SetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) {
142     if(!fPHOSRecalibrationFactors)  InitPHOSRecalibrationFactors();
143     ((TH2F*)fPHOSRecalibrationFactors->At(imod))->SetBinContent(iCol,iRow,c);}
144     
145   void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) {fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(iSM,h);}
146   void SetPHOSChannelRecalibrationFactors(Int_t imod , TH2F* h) {fPHOSRecalibrationFactors ->AddAt(h,imod);}
147         
148   TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const {return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactors(iSM);}
149   TH2F * GetPHOSChannelRecalibrationFactors(Int_t imod) const {return (TH2F*)fPHOSRecalibrationFactors->At(imod);}
150         
151   void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(map);}
152   void SetPHOSChannelRecalibrationFactors (TObjArray *map) {fPHOSRecalibrationFactors  = map;}
153
154   Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells);
155
156   //EMCAL specific utils for the moment
157   void SetEMCALRecoUtils(AliEMCALRecoUtils * ru) {fEMCALRecoUtils = ru;}
158   AliEMCALRecoUtils* GetEMCALRecoUtils() const {return fEMCALRecoUtils;}
159   
160   Bool_t IsCorrectionOfClusterEnergyOn()  const    { return fCorrectELinearity ; }
161   void SwitchOnCorrectClusterLinearity()         { fCorrectELinearity = kTRUE; } 
162   void SwitchOffCorrectClusterLinearity()        { fCorrectELinearity = kFALSE; } 
163   void CorrectClusterEnergy(AliVCluster *cl);
164   
165   Bool_t IsRecalculationOfClusterPositionOn()  const { return fRecalculatePosition ; }
166   void SwitchOnRecalculateClusterPosition()      { fRecalculatePosition = kTRUE; } 
167   void SwitchOffRecalculateClusterPosition()     { fRecalculatePosition = kFALSE; } 
168   void RecalculateClusterPosition(AliVCaloCells* cells, AliVCluster* clu);
169   void RecalculateClusterShowerShapeParameters(AliVCaloCells* cells, AliVCluster* clu){
170     fEMCALRecoUtils->RecalculateClusterShowerShapeParameters((AliEMCALGeometry*)fEMCALGeo, cells, clu);
171   }
172   
173   void RecalculateClusterDistanceToBadChannel(AliVCaloCells* cells, AliVCluster* clu){
174     fEMCALRecoUtils->RecalculateClusterDistanceToBadChannel((AliEMCALGeometry*)fEMCALGeo, cells, clu);
175   }
176   
177   void RecalculateClusterPID(AliVCluster* clu) {fEMCALRecoUtils->RecalculateClusterPID(clu);}
178
179   //Track matching recalculation
180   void RecalculateClusterTrackMatching(AliVEvent * event)         {if (fRecalculateMatching) fEMCALRecoUtils->FindMatches(event);}
181   void GetMatchedResiduals(Int_t index, Float_t &dR, Float_t &dZ) {if (fRecalculateMatching) fEMCALRecoUtils->GetMatchedResiduals(index,dR,dZ);}
182   //This could be used for PHOS ...
183   void SwitchOnRecalculateClusterTrackMatching()      { fRecalculateMatching = kTRUE; } 
184   void SwitchOffRecalculateClusterTrackMatching()     { fRecalculateMatching = kFALSE; } 
185   Bool_t IsRecalculationOfClusterTrackMatchingOn()  const { return fRecalculateMatching ; }
186   Float_t GetCutR() const { return fCutR; }
187   Float_t GetCutZ() const { return fCutZ; }
188   
189   void SetCutR(Float_t cutR) { fCutR=cutR; fEMCALRecoUtils->SetCutR(cutR); }
190   void SetCutZ(Float_t cutZ) { fCutZ=cutZ; fEMCALRecoUtils->SetCutZ(cutZ);}
191   
192  private:
193
194   Int_t              fDebug;                 //  Debugging level
195   TString            fEMCALGeoName;          //  Name of geometry to use for EMCAL.
196   TString            fPHOSGeoName;           //  Name of geometry to use for PHOS.      
197   AliEMCALGeoUtils * fEMCALGeo ;             //! EMCAL geometry pointer
198   AliPHOSGeoUtils  * fPHOSGeo  ;             //! PHOS  geometry pointer  
199   Bool_t             fEMCALGeoMatrixSet;     //  Check if the transformation matrix is set for EMCAL
200   Bool_t             fPHOSGeoMatrixSet ;     //  Check if the transformation matrix is set for PHOS
201   Bool_t             fLoadEMCALMatrices;     //  Matrices set from configuration, not get from geometry.root or from ESDs/AODs
202   TGeoHMatrix *      fEMCALMatrix[10];       //  Geometry matrices with alignments
203   Bool_t             fLoadPHOSMatrices;      //  Matrices set from configuration, not get from geometry.root or from ESDs/AODs
204   TGeoHMatrix *      fPHOSMatrix[5];         //  Geometry matrices with alignments
205   Bool_t             fRemoveBadChannels;     //  Check the channel status provided and remove clusters with bad channels
206   TObjArray        * fPHOSBadChannelMap;     //  Array of histograms with map of bad channels, PHOS
207   Int_t              fNCellsFromPHOSBorder;  //  Number of cells from PHOS  border the cell with maximum amplitude has to be.
208   Bool_t             fRecalibration;         //  Switch on or off the recalibration
209   TObjArray        * fPHOSRecalibrationFactors;  // Array of histograms with map of recalibration factors, PHOS
210   AliEMCALRecoUtils* fEMCALRecoUtils;        //  EMCAL utils for cluster rereconstruction
211   Bool_t             fRecalculatePosition;   //  Recalculate cluster position
212   Bool_t             fCorrectELinearity  ;   //  Correct cluster energy linearity
213   Bool_t             fRecalculateMatching;   //  Recalculate cluster position
214   Float_t            fCutR;                  //  dR cut on matching
215   Float_t            fCutZ;                  //  dZ cut on matching
216
217   
218   ClassDef(AliCalorimeterUtils,5)
219 } ;
220
221
222 #endif //ALICALORIMETERUTILS_H
223
224
225