]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSClusterizerv1.h
Bug correction
[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 //_________________________________________________________________________
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
17 // --- ROOT system ---
18 class TClonesArray ;
19 // --- Standard library ---
20
21 // --- AliRoot header files ---
22
23 #include "AliPHOSClusterizer.h"
24 class AliPHOSEmcRecPoint ; 
25 class AliPHOSDigit ;
26 class AliPHOSDigitizer ;
27 class AliPHOSGeometry ;
28 class AliPHOSCalibrationDB ;
29
30 class AliPHOSClusterizerv1 : public AliPHOSClusterizer {
31   
32 public:
33   
34   AliPHOSClusterizerv1() ;         
35   AliPHOSClusterizerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName());
36   AliPHOSClusterizerv1(const AliPHOSClusterizerv1 & clu) : AliPHOSClusterizer(clu) {
37     // cpy ctor: no implementation yet
38     // requested by the Coding Convention
39     Fatal("cpy ctor", "not implemented") ;
40   }
41   virtual ~AliPHOSClusterizerv1()  ;
42   
43   virtual Int_t   AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ; 
44                                // Checks if digits are in neighbour cells 
45
46   virtual Float_t Calibrate(Int_t amp, Int_t absId)const ;  // Tranforms Amp to energy 
47
48   virtual void    GetNumberOfClustersFound(int * numb )const{  numb[0] = fNumberOfEmcClusters ; 
49                                                                numb[1] = fNumberOfCpvClusters ; }
50
51   virtual Float_t GetEmcClusteringThreshold()const{ return fEmcClusteringThreshold;}
52   virtual Float_t GetEmcLocalMaxCut()const        { return fEmcLocMaxCut;} 
53   virtual Float_t GetEmcLogWeight()const          { return fW0;}  
54   virtual Float_t GetEmcTimeGate() const          { return fEmcTimeGate ; }
55   virtual Float_t GetCpvClusteringThreshold()const{ return fCpvClusteringThreshold;  } 
56   virtual Float_t GetCpvLocalMaxCut()const        { return fCpvLocMaxCut;} 
57   virtual Float_t GetCpvLogWeight()const          { return fW0CPV;}  
58   virtual const char *  GetRecPointsBranch() const{ return GetName() ;}
59   virtual Int_t   GetRecPointsInRun() const       {return fRecPointsInRun ;} 
60
61   virtual void    Exec(Option_t *option);   // Does the job
62
63   void Print()const ;
64
65   void SetEmcMinE(Float_t e){fEmcMinE = e ;}
66   void SetCpvMinE(Float_t e){fCpvMinE = e ;}
67   virtual void SetEmcClusteringThreshold(Float_t cluth)  { fEmcClusteringThreshold = cluth ; }
68   virtual void SetEmcLocalMaxCut(Float_t cut)            { fEmcLocMaxCut = cut ; }
69   virtual void SetEmcLogWeight(Float_t w)                { fW0 = w ; }
70   virtual void SetEmcTimeGate(Float_t gate)              { fEmcTimeGate = gate ;}
71   virtual void SetCpvClusteringThreshold(Float_t cluth)  { fCpvClusteringThreshold = cluth ; }
72   virtual void SetCpvLocalMaxCut(Float_t cut)            { fCpvLocMaxCut = cut ; }
73   virtual void SetCpvLogWeight(Float_t w)                { fW0CPV = w ; }
74   virtual void SetUnfolding(Bool_t toUnfold = kTRUE )    { fToUnfold = toUnfold ;}
75   //Switch to "on flyght" mode, without writing to TreeR and file  
76   void SetWriting(const Bool_t toWrite = kFALSE){fWrite = toWrite;} 
77   static Double_t ShowerShape(Double_t r) ; // Shape of EM shower used in unfolding; 
78                                             //class member function (not object member function)
79   static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)  ;
80                                             // Chi^2 of the fit. Should be static to be passed to MINUIT
81   void Unload() ; 
82   virtual const char * Version() const { return "clu-v1"; }  
83
84 protected:
85
86   void           WriteRecPoints() ;
87   virtual void   MakeClusters( ) ;            
88   virtual Bool_t IsInEmc (AliPHOSDigit * digit)const ;     // Tells if id digit is in EMC
89   virtual Bool_t IsInCpv (AliPHOSDigit * digit)const ;     // Tells if id digit is in CPV
90   void           CleanDigits(TClonesArray * digits) ;
91   
92 private:
93
94   const   TString BranchName() const ; 
95   void    GetCalibrationParameters(void) ;
96   
97   Bool_t  FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** MaxAt, Float_t * maxAtEnergy, 
98                   Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
99   void    Init() ;
100   void    InitParameters() ;
101
102   virtual void   MakeUnfolding() ;
103   void           UnfoldCluster(AliPHOSEmcRecPoint * iniEmc,Int_t Nmax, 
104                        AliPHOSDigit ** maxAt,Float_t * maxAtEnergy ) ; //Unfolds cluster using TMinuit package
105   void           PrintRecPoints(Option_t * option) ;
106
107 private:
108
109   Bool_t  fDefaultInit;              //! Says if the task was created by defaut ctor (only parameters are initialized)
110
111   Int_t   fEmcCrystals ;             // number of EMC cristalls in PHOS
112
113   Bool_t  fToUnfold ;                // To perform unfolding 
114   Bool_t  fWrite ;                   // Write RecPoints to TreeR  
115
116   Int_t   fNumberOfEmcClusters ;     // number of EMC clusters found 
117   Int_t   fNumberOfCpvClusters ;     // number of CPV clusters found
118  
119   //Calibration parameters
120   AliPHOSCalibrationDB * fCalibrationDB ; //! Calibration database if aval
121   Float_t fADCchanelEmc ;           // width of one ADC channel in GeV
122   Float_t fADCpedestalEmc ;         //
123   Float_t fADCchanelCpv ;           // width of one ADC channel in CPV 'popugais'
124   Float_t fADCpedestalCpv ;         // 
125
126   Float_t fEmcClusteringThreshold ;  // minimum energy to start EMC cluster
127   Float_t fCpvClusteringThreshold ;  // minimum energy to start CPV cluster
128   Float_t fEmcMinE ;                 // minimum energy of digit to be included into cluster
129   Float_t fCpvMinE ;                 // minimum energy of digit to be included into cluster
130   Float_t fEmcLocMaxCut ;            // minimum energy difference to distinguish local maxima in a cluster
131   Float_t fW0 ;                      // logarithmic weight for the cluster center of gravity calculation
132   Float_t fCpvLocMaxCut ;            // minimum energy difference to distinguish local maxima in a CPV cluster
133   Float_t fW0CPV ;                   // logarithmic weight for the CPV cluster center of gravity calculation
134   Int_t fRecPointsInRun ;            //! Total number of recpoints in one run
135   Float_t fEmcTimeGate ;             // Maximum time difference between the digits in ont EMC cluster
136     
137   ClassDef(AliPHOSClusterizerv1,3)   // Clusterizer implementation version 1
138
139 };
140
141 #endif // AliPHOSCLUSTERIZERV1_H