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