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