]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALClusterizerv1.h
Class version incremented
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizerv1.h
1 #ifndef ALIEMCALCLUSTERIZERV1_H
2 #define ALIEMCALCLUSTERIZERV1_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 //_________________________________________________________________________
9 //  Implementation version 1 of the clusterization algorithm                     
10 //  Performs clusterization (collects neighbouring active cells) and 
11 //  unfolding of the clusters with several local maxima.  
12 //  results are stored in TreeR#, branches PHOSEmcRP (EMC recPoints),
13 //  PHOSCpvRP (CPV RecPoints) and AliPHOSClusterizer
14 //
15 //*-- Author: Yves Schutz (SUBATECH)
16 // Modif: 
17 //  August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
18 //                           of new  IO (à la PHOS)
19
20 // --- ROOT system ---
21
22 // --- Standard library ---
23
24 // --- AliRoot header files ---
25
26 #include "AliEMCALClusterizer.h"
27 class AliEMCALTowerRecPoint ; 
28 class AliEMCALDigit ;
29 class AliEMCALDigitizer ;
30 class AliEMCALGeometry ;
31
32
33 class AliEMCALClusterizerv1 : public AliEMCALClusterizer {
34   
35 public:
36   
37   AliEMCALClusterizerv1() ;         
38   AliEMCALClusterizerv1(const char * headerFile, const char * name = "Default", const Bool_t toSplit=kFALSE);
39   virtual ~AliEMCALClusterizerv1()  ;
40   
41   virtual Int_t   AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const ; 
42                                // Checks if digits are in neighbour cells 
43
44   virtual Float_t Calibrate(Int_t amp, Int_t where)const ;  // Tranforms Amp to energy 
45
46   virtual void    GetNumberOfClustersFound(int * numb )const{ numb[0] = fNumberOfPREClusters ; 
47                                                               numb[1] = fNumberOfECClusters ; 
48                                                               numb[2] = fNumberOfHCClusters ; }
49
50   virtual Float_t GetPREClusteringThreshold()const{ return fPREClusteringThreshold;  } 
51   virtual Float_t GetECClusteringThreshold()const{ return fECClusteringThreshold;}
52   virtual Float_t GetHCClusteringThreshold()const{ return fHCClusteringThreshold;}
53
54   virtual Float_t GetPRELocalMaxCut()const       { return fPRELocMaxCut;} 
55   virtual Float_t GetPREShoLogWeight()const      { return fPREW0;}  
56   virtual Float_t GetECLocalMaxCut()const        { return fECLocMaxCut;} 
57   virtual Float_t GetECLogWeight()const          { return fECW0;}  
58   virtual Float_t GetHCLocalMaxCut()const        { return fHCLocMaxCut;} 
59   virtual Float_t GetHCLogWeight()const          { return fHCW0;}  
60
61   virtual Float_t GetTimeGate() const            { return fTimeGate ; }
62   virtual const char *  GetRecPointsBranch() const{ return GetName() ;}
63   virtual const Int_t GetRecPointsInRun() const   {return fRecPointsInRun ;} 
64
65   void    Exec(Option_t *option);                // Does the job
66
67   virtual void Print(Option_t * option)const ;
68
69   virtual void SetECClusteringThreshold(Float_t cluth)  { fECClusteringThreshold = cluth ; }
70   virtual void SetECLocalMaxCut(Float_t cut)            { fECLocMaxCut = cut ; }
71   virtual void SetECLogWeight(Float_t w)                { fECW0 = w ; }
72   virtual void SetHCClusteringThreshold(Float_t cluth)  { fHCClusteringThreshold = cluth ; }
73   virtual void SetHCLocalMaxCut(Float_t cut)            { fHCLocMaxCut = cut ; }
74   virtual void SetHCLogWeight(Float_t w)                { fHCW0 = w ; }
75   virtual void SetTimeGate(Float_t gate)                { fTimeGate = gate ;}
76   virtual void SetPREClusteringThreshold(Float_t cluth) { fPREClusteringThreshold = cluth ; }
77   virtual void SetPRELocalMaxCut(Float_t cut)           { fPRELocMaxCut = cut ; }
78   virtual void SetPRELogWeight(Float_t w)               { fPREW0 = w ; }
79   virtual void SetUnfolding(Bool_t toUnfold = kTRUE )      {fToUnfold = toUnfold ;}  
80   static Double_t ShowerShape(Double_t r) ; // Shape of EM shower used in unfolding; 
81                                             //class member function (not object member function)
82   static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)  ;
83                                             // Chi^2 of the fit. Should be static to be passes to MINUIT
84   virtual const char * Version() const { return "clu-v1" ; }  
85
86 protected:
87
88   void           WriteRecPoints(Int_t event) ;
89   virtual void   MakeClusters( ) ;            
90   
91 private:
92
93   const TString BranchName() const ; 
94   void    GetCalibrationParameters(void) ;
95   
96   Bool_t  FindFit(AliEMCALTowerRecPoint * emcRP, AliEMCALDigit ** MaxAt, Float_t * maxAtEnergy, 
97                   Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
98   void Init() ;
99   void InitParameters() ;
100
101   virtual void   MakeUnfolding() ;
102   void           UnfoldCluster(AliEMCALTowerRecPoint * iniEmc,Int_t Nmax, 
103                        AliEMCALDigit ** maxAt,Float_t * maxAtEnergy ) ; //Unfolds cluster using TMinuit package
104   void           PrintRecPoints(Option_t * option) ;
105
106 private:
107
108   Bool_t  fDefaultInit;              //! Says if the task was created by defaut ctor (only parameters are initialized)
109
110   Int_t   fNTowers ;                 // number of Towers in EMCAL
111
112   Bool_t  fToUnfold ;                // To perform unfolding 
113
114   Int_t   fNumberOfPREClusters ;     // number of clusters found in PRE section 
115   Int_t   fNumberOfECClusters ;      // number of clusters found in EC section
116   Int_t   fNumberOfHCClusters ;      // number of clusters found in HC section
117   
118   //Calibration parameters... to be replaced by database 
119   Float_t fADCchannelPRE ;          // width of one ADC channel for PRE section (GeV)
120   Float_t fADCpedestalPRE ;         // pedestal of ADC for PRE section (GeV)
121   Float_t fADCchannelEC ;           // width of one ADC channel for EC section (GeV)
122   Float_t fADCpedestalEC ;          // pedestal of ADC for EC section (GeV) 
123   Float_t fADCchannelHC ;           // width of one ADC channel for HC section (GeV)
124   Float_t fADCpedestalHC ;          // pedestal of ADC for HC section (GeV) 
125  
126   Float_t fECClusteringThreshold ;  // minimum energy to include a EC digit in a cluster
127   Float_t fHCClusteringThreshold ;  // minimum energy to include a HC digit in a cluster
128   Float_t fPREClusteringThreshold ; // minimum energy to include a PRE digit in a cluster
129   Float_t fECLocMaxCut ;            // minimum energy difference to distinguish local maxima in a cluster
130   Float_t fECW0 ;                   // logarithmic weight for the cluster center of gravity calculation
131   Float_t fHCLocMaxCut ;            // minimum energy difference to distinguish local maxima in a cluster
132   Float_t fHCW0 ;                   // logarithmic weight for the cluster center of gravity calculation
133   Float_t fPRELocMaxCut ;           //  minimum energy difference to distinguish local maxima in a CPV cluster
134   Float_t fPREW0 ;                  // logarithmic weight for the CPV cluster center of gravity calculation
135   Int_t fRecPointsInRun ;           //! Total number of recpoints in one run
136   Float_t fTimeGate ;               // Maximum time difference between the digits in ont EMC cluster
137     
138   ClassDef(AliEMCALClusterizerv1,2)   // Clusterizer implementation version 1
139
140 };
141
142 #endif // AliEMCALCLUSTERIZERV1_H