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