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