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