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