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