]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSClusterizerv1.h
Modifications needed to use PID framework based mass during tracking and
[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: AliPHOSClusterizerv1.h,v $
11  * Revision 1.54  2007/10/01 20:24:08  kharlov
12  * Memory leaks fixed
13  *
14  * Revision 1.53  2007/08/28 12:55:07  policheh
15  * Loaders removed from the reconstruction code (C.Cheshkov)
16  *
17  * Revision 1.52  2007/08/07 14:16:00  kharlov
18  * Quality assurance added (Yves Schutz)
19  *
20  * Revision 1.51  2007/04/11 11:55:45  policheh
21  * SetDistancesToBadChannels() added.
22  *
23  * Revision 1.50  2007/03/28 19:18:15  kharlov
24  * RecPoints recalculation in TSM removed
25  *
26  * Revision 1.49  2007/03/06 06:51:27  kharlov
27  * Calculation of cluster properties dep. on vertex posponed to TrackSegmentMaker
28  *
29  * Revision 1.48  2006/08/30 16:12:52  kharlov
30  * Reconstruction of raw data from beam test 2006 (B.Polichtchouk)
31  *
32  * Revision 1.47  2006/08/25 16:56:30  kharlov
33  * Compliance with Effective C++
34  *
35  * Revision 1.46  2006/08/01 12:20:17  cvetan
36  * 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
37  *
38  * Revision 1.45  2006/04/29 20:26:46  hristov
39  * Separate EMC and CPV calibration (Yu.Kharlov)
40  *
41  * Revision 1.44  2005/09/02 14:32:07  kharlov
42  * Calibration of raw data
43  *
44  * Revision 1.43  2005/05/28 14:19:04  schutz
45  * Compilation warnings fixed by T.P.
46  *
47  */
48
49 //_________________________________________________________________________
50 //  Implementation version 1 of the clusterization algorithm                     
51 //  Performs clusterization (collects neighbouring active cells) and 
52 //  unfolding of the clusters with several local maxima.  
53 //  results are stored in TreeR#, branches PHOSEmcRP (EMC recPoints),
54 //  PHOSCpvRP (CPV RecPoints) and AliPHOSClusterizer
55 //
56 //*-- Author: Yves Schutz (SUBATECH)
57
58 // --- ROOT system ---
59 class TClonesArray ;
60 class TVector3 ;
61 // --- Standard library ---
62
63 // --- AliRoot header files ---
64
65 #include "AliPHOSClusterizer.h"
66 class AliPHOSEmcRecPoint ; 
67 class AliPHOSDigit ;
68 class AliPHOSDigitizer ;
69 class AliPHOSGeometry ;
70
71 class AliPHOSClusterizerv1 : public AliPHOSClusterizer {
72   
73 public:
74   
75   AliPHOSClusterizerv1() ;
76   AliPHOSClusterizerv1(AliPHOSGeometry *geom);
77   virtual ~AliPHOSClusterizerv1()  ;
78
79   void    InitParameters() ;
80   
81   virtual Int_t   AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ; 
82                                // Checks if digits are in neighbour cells 
83
84   virtual void    GetNumberOfClustersFound(int * numb )const{  numb[0] = fNumberOfEmcClusters ; 
85                                                                numb[1] = fNumberOfCpvClusters ; }
86
87   virtual Float_t GetEmcClusteringThreshold()const{ return fEmcClusteringThreshold;}
88   virtual Float_t GetEmcLocalMaxCut()const        { return fEmcLocMaxCut;} 
89   virtual Float_t GetEmcLogWeight()const          { return fW0;}  
90   virtual Float_t GetCpvClusteringThreshold()const{ return fCpvClusteringThreshold;  } 
91   virtual Float_t GetCpvLocalMaxCut()const        { return fCpvLocMaxCut;} 
92   virtual Float_t GetCpvLogWeight()const          { return fW0CPV;}  
93   virtual Float_t GetEcoreRadius()const           { return fEcoreRadius;}  
94   //  virtual const char *  GetRecPointsBranch() const{ return GetName() ;}
95
96   virtual void    Digits2Clusters(Option_t *option);
97
98   void Print(const Option_t * = "")const ;
99
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 SetCpvClusteringThreshold(Float_t cluth)  { fCpvClusteringThreshold = cluth ; }
104   virtual void SetCpvLocalMaxCut(Float_t cut)            { fCpvLocMaxCut = cut ; }
105   virtual void SetCpvLogWeight(Float_t w)                { fW0CPV = w ; }
106   virtual void SetUnfolding(Bool_t toUnfold = kTRUE )    { fToUnfold = toUnfold ;}
107   virtual void SetCoreRadius(Float_t coreRadius)         { fEcoreRadius = coreRadius ;}
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 protected:
118
119   void           WriteRecPoints() ;
120   virtual void   MakeClusters( ) ;            
121   virtual Bool_t IsInEmc (AliPHOSDigit * digit)const ;     // Tells if id digit is in EMC
122   virtual Bool_t IsInCpv (AliPHOSDigit * digit)const ;     // Tells if id digit is in CPV
123   void           CleanDigits(TClonesArray * digits) ;
124   void           SetDistancesToBadChannels();
125   virtual Float_t Calibrate(Float_t amp, Int_t absId) const ;  // Tranforms ADC counts to energy   
126   virtual Float_t CalibrateT(Float_t amp, Int_t absId, Bool_t isLG) const ;  //Tranforms Sample counts to sec.
127   Bool_t CheckTimeGate(Float_t t1, Float_t amp1, Float_t t2, Float_t amp2)const ; //Checks if time difference is reasonable
128    
129 private:
130   AliPHOSClusterizerv1(const AliPHOSClusterizerv1 & clu) ;
131   AliPHOSClusterizerv1 & operator = (const AliPHOSClusterizerv1 & obj);
132
133   Bool_t  FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** MaxAt, Float_t * maxAtEnergy, 
134                   Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
135   void    Init() ;
136
137   virtual void   MakeUnfolding() ;
138   void           UnfoldCluster(AliPHOSEmcRecPoint * iniEmc,Int_t Nmax, 
139                        AliPHOSDigit ** maxAt,Float_t * maxAtEnergy ) ; //Unfolds cluster using TMinuit package
140   void           PrintRecPoints(Option_t * option) ;
141
142 private:
143
144   Bool_t  fDefaultInit;              //! Says if the task was created by defaut ctor (only parameters are initialized)
145   Int_t   fEmcCrystals ;             // number of EMC cristals in PHOS
146
147   Bool_t  fToUnfold ;                // To perform unfolding 
148   Bool_t  fWrite ;                   // Write RecPoints to TreeR  
149   Bool_t  fDigitsUsed[53760];        //Mark digits as already used in cluster (EMC:5*56*64 ; CPV: 5*56*128)
150  
151   Int_t   fNumberOfEmcClusters ;     // number of EMC clusters found
152   Int_t   fNumberOfCpvClusters ;     // number of CPV clusters found
153  
154   Float_t fEmcClusteringThreshold ;  // minimum energy to start EMC cluster
155   Float_t fCpvClusteringThreshold ;  // minimum energy to start CPV cluster
156   Float_t fEmcLocMaxCut ;            // minimum energy difference to distinguish local maxima in a cluster
157   Float_t fW0 ;                      // logarithmic weight for the cluster center of gravity calculation
158   Float_t fCpvLocMaxCut ;            // minimum energy difference to distinguish local maxima in a CPV cluster
159   Float_t fW0CPV ;                   // logarithmic weight for the CPV cluster center of gravity calculation
160   Float_t fTimeGateLowAmp ;          // Threshold for good/bad time measurement
161   Float_t fTimeGateLow ;             // Time difference between cells with low amplitude
162   Float_t fTimeGateHigh ;            // Time difference between cells with good time measurement
163  
164   Float_t fEcoreRadius ;             // Radius within which the core energy is calculated, in cm
165
166   ClassDef(AliPHOSClusterizerv1,8)   // Clusterizer implementation version 1
167
168 };
169
170 #endif // AliPHOSCLUSTERIZERV1_H