]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSClusterizerv1.h
Correct the way to access PHOS Calo Clusters from ESD
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizerv1.h
1 #ifndef ALIPHOSCLUSTERIZERV1_H
2 #define ALIPHOSCLUSTERIZERV1_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 /* History of cvs commits:
9  *
10  * $Log$
11  * Revision 1.53  2007/08/28 12:55:07  policheh
12  * Loaders removed from the reconstruction code (C.Cheshkov)
13  *
14  * Revision 1.52  2007/08/07 14:16:00  kharlov
15  * Quality assurance added (Yves Schutz)
16  *
17  * Revision 1.51  2007/04/11 11:55:45  policheh
18  * SetDistancesToBadChannels() added.
19  *
20  * Revision 1.50  2007/03/28 19:18:15  kharlov
21  * RecPoints recalculation in TSM removed
22  *
23  * Revision 1.49  2007/03/06 06:51:27  kharlov
24  * Calculation of cluster properties dep. on vertex posponed to TrackSegmentMaker
25  *
26  * Revision 1.48  2006/08/30 16:12:52  kharlov
27  * Reconstruction of raw data from beam test 2006 (B.Polichtchouk)
28  *
29  * Revision 1.47  2006/08/25 16:56:30  kharlov
30  * Compliance with Effective C++
31  *
32  * Revision 1.46  2006/08/01 12:20:17  cvetan
33  * 1. Adding a possibility to read and reconstruct an old rcu formatted raw data. This is controlled by an option of AliReconstruction and AliPHOSReconstructor. 2. In case of raw data processing (without galice.root) create the default AliPHOSGeometry object. Most likely this should be moved to the CDB
34  *
35  * Revision 1.45  2006/04/29 20:26:46  hristov
36  * Separate EMC and CPV calibration (Yu.Kharlov)
37  *
38  * Revision 1.44  2005/09/02 14:32:07  kharlov
39  * Calibration of raw data
40  *
41  * Revision 1.43  2005/05/28 14:19:04  schutz
42  * Compilation warnings fixed by T.P.
43  *
44  */
45
46 //_________________________________________________________________________
47 //  Implementation version 1 of the clusterization algorithm                     
48 //  Performs clusterization (collects neighbouring active cells) and 
49 //  unfolding of the clusters with several local maxima.  
50 //  results are stored in TreeR#, branches PHOSEmcRP (EMC recPoints),
51 //  PHOSCpvRP (CPV RecPoints) and AliPHOSClusterizer
52 //
53 //*-- Author: Yves Schutz (SUBATECH)
54
55 // --- ROOT system ---
56 class TClonesArray ;
57 class TVector3 ;
58 // --- Standard library ---
59
60 // --- AliRoot header files ---
61
62 #include "AliPHOSClusterizer.h"
63 class AliPHOSEmcRecPoint ; 
64 class AliPHOSDigit ;
65 class AliPHOSDigitizer ;
66 class AliPHOSGeometry ;
67
68 class AliPHOSClusterizerv1 : public AliPHOSClusterizer {
69   
70 public:
71   
72   AliPHOSClusterizerv1() ;
73   AliPHOSClusterizerv1(AliPHOSGeometry *geom);
74   virtual ~AliPHOSClusterizerv1()  ;
75   
76   virtual Int_t   AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ; 
77                                // Checks if digits are in neighbour cells 
78
79   virtual Float_t CalibrateCPV(Int_t   amp, Int_t absId) ;  // Tranforms CPV Amp to energy 
80   virtual Float_t CalibrateEMC(Float_t amp, Int_t absId) ;  // Tranforms EMC Amp to energy 
81
82   virtual void    GetNumberOfClustersFound(int * numb )const{  numb[0] = fNumberOfEmcClusters ; 
83                                                                numb[1] = fNumberOfCpvClusters ; }
84
85   virtual Float_t GetEmcClusteringThreshold()const{ return fEmcClusteringThreshold;}
86   virtual Float_t GetEmcLocalMaxCut()const        { return fEmcLocMaxCut;} 
87   virtual Float_t GetEmcLogWeight()const          { return fW0;}  
88   virtual Float_t GetEmcTimeGate() const          { return fEmcTimeGate ; }
89   virtual Float_t GetCpvClusteringThreshold()const{ return fCpvClusteringThreshold;  } 
90   virtual Float_t GetCpvLocalMaxCut()const        { return fCpvLocMaxCut;} 
91   virtual Float_t GetCpvLogWeight()const          { return fW0CPV;}  
92   //  virtual const char *  GetRecPointsBranch() const{ return GetName() ;}
93
94   virtual void    Digits2Clusters(Option_t *option);
95
96   void Print(const Option_t * = "")const ;
97
98   void SetEmcMinE(Float_t e){fEmcMinE = e ;}
99   void SetCpvMinE(Float_t e){fCpvMinE = e ;}
100   virtual void SetEmcClusteringThreshold(Float_t cluth)  { fEmcClusteringThreshold = cluth ; }
101   virtual void SetEmcLocalMaxCut(Float_t cut)            { fEmcLocMaxCut = cut ; }
102   virtual void SetEmcLogWeight(Float_t w)                { fW0 = w ; }
103   virtual void SetEmcTimeGate(Float_t gate)              { fEmcTimeGate = gate ;}
104   virtual void SetCpvClusteringThreshold(Float_t cluth)  { fCpvClusteringThreshold = cluth ; }
105   virtual void SetCpvLocalMaxCut(Float_t cut)            { fCpvLocMaxCut = cut ; }
106   virtual void SetCpvLogWeight(Float_t w)                { fW0CPV = w ; }
107   virtual void SetUnfolding(Bool_t toUnfold = kTRUE )    { fToUnfold = toUnfold ;}
108   //Switch to "on flyght" mode, without writing to TreeR and file  
109   void SetWriting(Bool_t toWrite = kFALSE){fWrite = toWrite;} 
110   static Double_t ShowerShape(Double_t x, Double_t z) ; // Shape of EM shower used in unfolding; 
111                                             //class member function (not object member function)
112   static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)  ;
113                                             // Chi^2 of the fit. Should be static to be passed to MINUIT
114   //  void Unload() ; 
115   virtual const char * Version() const { return "clu-v1"; }  
116
117   virtual void SetOldRCUFormat(Bool_t rcuFormat = kFALSE)
118     { fIsOldRCUFormat = rcuFormat; };
119
120 protected:
121
122   void           WriteRecPoints() ;
123   virtual void   MakeClusters( ) ;            
124   virtual Bool_t IsInEmc (AliPHOSDigit * digit)const ;     // Tells if id digit is in EMC
125   virtual Bool_t IsInCpv (AliPHOSDigit * digit)const ;     // Tells if id digit is in CPV
126   void           CleanDigits(TClonesArray * digits) ;
127   void           GetCalibrationParameters(void);
128   void           SetDistancesToBadChannels();
129
130 private:
131   AliPHOSClusterizerv1(const AliPHOSClusterizerv1 & clu) ;
132   AliPHOSClusterizerv1 & operator = (const AliPHOSClusterizerv1 & obj);
133
134   Bool_t  FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** MaxAt, Float_t * maxAtEnergy, 
135                   Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
136   void    Init() ;
137   void    InitParameters() ;
138
139   virtual void   MakeUnfolding() ;
140   void           UnfoldCluster(AliPHOSEmcRecPoint * iniEmc,Int_t Nmax, 
141                        AliPHOSDigit ** maxAt,Float_t * maxAtEnergy ) ; //Unfolds cluster using TMinuit package
142   void           PrintRecPoints(Option_t * option) ;
143
144 private:
145
146   Bool_t  fDefaultInit;              //! Says if the task was created by defaut ctor (only parameters are initialized)
147   Int_t   fEmcCrystals ;             // number of EMC cristals in PHOS
148
149   Bool_t  fToUnfold ;                // To perform unfolding 
150   Bool_t  fWrite ;                   // Write RecPoints to TreeR  
151  
152   Int_t   fNumberOfEmcClusters ;     // number of EMC clusters found
153   Int_t   fNumberOfCpvClusters ;     // number of CPV clusters found
154  
155   //Calibration parameters
156   Float_t fADCchanelEmc ;           // width of one ADC channel in GeV
157   Float_t fADCpedestalEmc ;         //
158   Float_t fADCchanelCpv ;           // width of one ADC channel in CPV 'popugais'
159   Float_t fADCpedestalCpv ;         // 
160
161   Float_t fEmcClusteringThreshold ;  // minimum energy to start EMC cluster
162   Float_t fCpvClusteringThreshold ;  // minimum energy to start CPV cluster
163   Float_t fEmcMinE ;                 // minimum energy of digit to be included into cluster
164   Float_t fCpvMinE ;                 // minimum energy of digit to be included into cluster
165   Float_t fEmcLocMaxCut ;            // minimum energy difference to distinguish local maxima in a cluster
166   Float_t fW0 ;                      // logarithmic weight for the cluster center of gravity calculation
167   Float_t fCpvLocMaxCut ;            // minimum energy difference to distinguish local maxima in a CPV cluster
168   Float_t fW0CPV ;                   // logarithmic weight for the CPV cluster center of gravity calculation
169   //  Int_t fRecPointsInRun ;            //! Total number of recpoints in one run
170   Float_t fEmcTimeGate ;             // Maximum time difference between the digits in ont EMC cluster
171
172   Bool_t  fIsOldRCUFormat;           // assume old RCU raw data format
173
174   ClassDef(AliPHOSClusterizerv1,5)   // Clusterizer implementation version 1
175
176 };
177
178 #endif // AliPHOSCLUSTERIZERV1_H