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