]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALClusterizerv1.h
revised geometry, fully parametrized and including HCAL possibility
[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, Bool_t inpresho)const ;  // Tranforms Amp to energy 
45
46   virtual void    GetNumberOfClustersFound(int * numb )const{  numb[0] = fNumberOfTowerClusters ; 
47                                                                numb[1] = fNumberOfPreShoClusters ; }
48
49   virtual Float_t GetTowerClusteringThreshold()const{ return fTowerClusteringThreshold;}
50   virtual Float_t GetTowerLocalMaxCut()const        { return fTowerLocMaxCut;} 
51   virtual Float_t GetTowerLogWeight()const          { return fW0;}  
52   virtual Float_t GetTimeGate() const             { return fTimeGate ; }
53   virtual Float_t GetPreShoClusteringThreshold()const{ return fPreShoClusteringThreshold;  } 
54   virtual Float_t GetPreShoLocalMaxCut()const        { return fPreShoLocMaxCut;} 
55   virtual Float_t GetPreShoLogWeight()const          { return fW0CPV;}  
56   virtual const char *  GetRecPointsBranch() const{ return GetName() ;}
57   virtual const Int_t GetRecPointsInRun() const   {return fRecPointsInRun ;} 
58
59   void    Exec(Option_t *option);                // Does the job
60
61   virtual void Print(Option_t * option)const ;
62
63   virtual void SetTowerClusteringThreshold(Float_t cluth)  { fTowerClusteringThreshold = cluth ; }
64   virtual void SetTowerLocalMaxCut(Float_t cut)            { fTowerLocMaxCut = cut ; }
65   virtual void SetTowerLogWeight(Float_t w)                { fW0 = w ; }
66   virtual void SetTimeGate(Float_t gate)                   { fTimeGate = gate ;}
67   virtual void SetPreShoClusteringThreshold(Float_t cluth) { fPreShoClusteringThreshold = cluth ; }
68   virtual void SetPreShoLocalMaxCut(Float_t cut)           { fPreShoLocMaxCut = cut ; }
69   virtual void SetPreShoLogWeight(Float_t w)               { fW0CPV = w ; }
70   virtual void SetUnfolding(Bool_t toUnfold = kTRUE )      {fToUnfold = toUnfold ;}  
71   static Double_t ShowerShape(Double_t r) ; // Shape of EM shower used in unfolding; 
72                                             //class member function (not object member function)
73   static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)  ;
74                                             // Chi^2 of the fit. Should be static to be passes to MINUIT
75   virtual const char * Version() const { return "clu-v1" ; }  
76
77 protected:
78
79   void           WriteRecPoints(Int_t event) ;
80   virtual void   MakeClusters( ) ;            
81   virtual Bool_t IsInTower (AliEMCALDigit * digit)const ;     // Tells if id digit is in Tower
82   virtual Bool_t IsInPreShower (AliEMCALDigit * digit)const ;     // Tells if id digit is in PreShower
83
84   
85 private:
86
87   const TString BranchName() const ; 
88   void    GetCalibrationParameters(void) ;
89   
90   Bool_t  FindFit(AliEMCALTowerRecPoint * emcRP, AliEMCALDigit ** MaxAt, Float_t * maxAtEnergy, 
91                   Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
92   void Init() ;
93   void InitParameters() ;
94
95   virtual void   MakeUnfolding() ;
96   void           UnfoldCluster(AliEMCALTowerRecPoint * iniEmc,Int_t Nmax, 
97                        AliEMCALDigit ** maxAt,Float_t * maxAtEnergy ) ; //Unfolds cluster using TMinuit package
98   void           PrintRecPoints(Option_t * option) ;
99
100 private:
101
102   Bool_t  fDefaultInit;              //! Says if the task was created by defaut ctor (only parameters are initialized)
103
104   Int_t   fNTowers ;                 // number of Towers in EMCAL
105
106   Bool_t  fToUnfold ;                // To perform unfolding 
107
108   Int_t   fNumberOfTowerClusters ;     // number of Tower clusters found 
109   Int_t   fNumberOfPreShoClusters ;    // number of PreShower clusters found
110  
111   //Calibration parameters... to be replaced by database 
112   Float_t fADCchannelTower ;           // width of one ADC channel for Tower (GeV)
113   Float_t fADCpedestalTower ;          // pedestal of ADC for Tower (GeV) 
114   Float_t fADCchannelPreSho ;          // width of one ADC channel for Pre Shower (GeV)
115   Float_t fADCpedestalPreSho ;         // pedestal of ADC for PreShower (GeV)
116
117   Float_t fTowerClusteringThreshold ;  // minimum energy to include a EMC digit in a cluster
118   Float_t fPreShoClusteringThreshold ; // minimum energy to include a CPV digit in a cluster
119   Float_t fTowerLocMaxCut ;            // minimum energy difference to distinguish local maxima in a cluster
120   Float_t fW0 ;                        // logarithmic weight for the cluster center of gravity calculation
121   Float_t fPreShoLocMaxCut ;           //  minimum energy difference to distinguish local maxima in a CPV cluster
122   Float_t fW0CPV ;                   // logarithmic weight for the CPV cluster center of gravity calculation
123   Int_t fRecPointsInRun ;            //! Total number of recpoints in one run
124   Float_t fTimeGate ;                // Maximum time difference between the digits in ont EMC cluster
125     
126   ClassDef(AliEMCALClusterizerv1,2)   // Clusterizer implementation version 1
127
128 };
129
130 #endif // AliEMCALCLUSTERIZERV1_H