Reconstruction of raw data from beam test 2006 (B.Polichtchouk)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizerv1.h
CommitLineData
e9a88722 1#ifndef ALIPHOSCLUSTERIZERV1_H
d15a28e7 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
6ad0bfa0 6/* $Id$ */
7
702ab87e 8/* History of cvs commits:
9 *
10 * $Log$
02e48b45 11 * Revision 1.47 2006/08/25 16:56:30 kharlov
12 * Compliance with Effective C++
13 *
0378398c 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 *
f5eaa851 17 * Revision 1.45 2006/04/29 20:26:46 hristov
18 * Separate EMC and CPV calibration (Yu.Kharlov)
19 *
e95226ae 20 * Revision 1.44 2005/09/02 14:32:07 kharlov
21 * Calibration of raw data
22 *
44ae287e 23 * Revision 1.43 2005/05/28 14:19:04 schutz
24 * Compilation warnings fixed by T.P.
25 *
702ab87e 26 */
27
b2a60966 28//_________________________________________________________________________
29// Implementation version 1 of the clusterization algorithm
baef0810 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
b2a60966 34//
88cb7938 35//*-- Author: Yves Schutz (SUBATECH)
d15a28e7 36
37// --- ROOT system ---
ba898748 38class TClonesArray ;
d15a28e7 39// --- Standard library ---
40
41// --- AliRoot header files ---
42
43#include "AliPHOSClusterizer.h"
9a1398dd 44class AliPHOSEmcRecPoint ;
45class AliPHOSDigit ;
46class AliPHOSDigitizer ;
47class AliPHOSGeometry ;
44ae287e 48class AliPHOSCalibData ;
d15a28e7 49
50class AliPHOSClusterizerv1 : public AliPHOSClusterizer {
51
52public:
53
0378398c 54 AliPHOSClusterizerv1() ;
e191bb57 55 AliPHOSClusterizerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName());
0378398c 56 AliPHOSClusterizerv1(const AliPHOSClusterizerv1 & clu) ;
9688c1dd 57 virtual ~AliPHOSClusterizerv1() ;
d15a28e7 58
1f96ab2a 59 virtual Int_t AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ;
9a1398dd 60 // Checks if digits are in neighbour cells
3758d9fc 61
e95226ae 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
3758d9fc 64
baef0810 65 virtual void GetNumberOfClustersFound(int * numb )const{ numb[0] = fNumberOfEmcClusters ;
66 numb[1] = fNumberOfCpvClusters ; }
9a1398dd 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;}
9688c1dd 71 virtual Float_t GetEmcTimeGate() const { return fEmcTimeGate ; }
9a1398dd 72 virtual Float_t GetCpvClusteringThreshold()const{ return fCpvClusteringThreshold; }
73 virtual Float_t GetCpvLocalMaxCut()const { return fCpvLocMaxCut;}
74 virtual Float_t GetCpvLogWeight()const { return fW0CPV;}
fbf811ec 75 virtual const char * GetRecPointsBranch() const{ return GetName() ;}
a01512ba 76 virtual Int_t GetRecPointsInRun() const {return fRecPointsInRun ;}
9a1398dd 77
eabde521 78 virtual void Exec(Option_t *option); // Does the job
9a1398dd 79
702ab87e 80 void Print(const Option_t * = "")const ;
9a1398dd 81
ba898748 82 void SetEmcMinE(Float_t e){fEmcMinE = e ;}
83 void SetCpvMinE(Float_t e){fCpvMinE = e ;}
d72dfbc3 84 virtual void SetEmcClusteringThreshold(Float_t cluth) { fEmcClusteringThreshold = cluth ; }
9a1398dd 85 virtual void SetEmcLocalMaxCut(Float_t cut) { fEmcLocMaxCut = cut ; }
86 virtual void SetEmcLogWeight(Float_t w) { fW0 = w ; }
fbf811ec 87 virtual void SetEmcTimeGate(Float_t gate) { fEmcTimeGate = gate ;}
ed4205d8 88 virtual void SetCpvClusteringThreshold(Float_t cluth) { fCpvClusteringThreshold = cluth ; }
9a1398dd 89 virtual void SetCpvLocalMaxCut(Float_t cut) { fCpvLocMaxCut = cut ; }
90 virtual void SetCpvLogWeight(Float_t w) { fW0CPV = w ; }
ba898748 91 virtual void SetUnfolding(Bool_t toUnfold = kTRUE ) { fToUnfold = toUnfold ;}
92 //Switch to "on flyght" mode, without writing to TreeR and file
5d0435dd 93 void SetWriting(Bool_t toWrite = kFALSE){fWrite = toWrite;}
9a1398dd 94 static Double_t ShowerShape(Double_t r) ; // Shape of EM shower used in unfolding;
95 //class member function (not object member function)
7b7c1533 96 static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag) ;
ba898748 97 // Chi^2 of the fit. Should be static to be passed to MINUIT
88cb7938 98 void Unload() ;
99 virtual const char * Version() const { return "clu-v1"; }
9a1398dd 100
f5eaa851 101 virtual void SetOldRCUFormat(Bool_t rcuFormat = kFALSE)
102 { fIsOldRCUFormat = rcuFormat; };
103
1f96ab2a 104protected:
105
88cb7938 106 void WriteRecPoints() ;
1f96ab2a 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
ba898748 110 void CleanDigits(TClonesArray * digits) ;
02e48b45 111 void GetCalibrationParameters(void);
112
0378398c 113 AliPHOSClusterizerv1 & operator = (const AliPHOSClusterizerv1 & obj);
114
d15a28e7 115private:
7b7c1533 116
fbf811ec 117 const TString BranchName() const ;
3758d9fc 118
a0636361 119 Bool_t FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** MaxAt, Float_t * maxAtEnergy,
baef0810 120 Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
fbf811ec 121 void Init() ;
122 void InitParameters() ;
9a1398dd 123
9a1398dd 124 virtual void MakeUnfolding() ;
9a1398dd 125 void UnfoldCluster(AliPHOSEmcRecPoint * iniEmc,Int_t Nmax,
a0636361 126 AliPHOSDigit ** maxAt,Float_t * maxAtEnergy ) ; //Unfolds cluster using TMinuit package
9a1398dd 127 void PrintRecPoints(Option_t * option) ;
128
129private:
130
92f521a9 131 Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
9a1398dd 132
02e48b45 133 Int_t fEmcCrystals ; // number of EMC cristals in PHOS
3758d9fc 134
9a1398dd 135 Bool_t fToUnfold ; // To perform unfolding
ba898748 136 Bool_t fWrite ; // Write RecPoints to TreeR
02e48b45 137
138 Int_t fNumberOfEmcClusters ; // number of EMC clusters found
9688c1dd 139 Int_t fNumberOfCpvClusters ; // number of CPV clusters found
7b7c1533 140
c2cd5471 141 //Calibration parameters
02e48b45 142 AliPHOSCalibData * fCalibData ; //! Calibration database if aval.
3758d9fc 143 Float_t fADCchanelEmc ; // width of one ADC channel in GeV
88cb7938 144 Float_t fADCpedestalEmc ; //
3758d9fc 145 Float_t fADCchanelCpv ; // width of one ADC channel in CPV 'popugais'
88cb7938 146 Float_t fADCpedestalCpv ; //
147
ba898748 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
9a1398dd 152 Float_t fEmcLocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster
b2a60966 153 Float_t fW0 ; // logarithmic weight for the cluster center of gravity calculation
9a1398dd 154 Float_t fCpvLocMaxCut ; // minimum energy difference to distinguish local maxima in a CPV cluster
d72dfbc3 155 Float_t fW0CPV ; // logarithmic weight for the CPV cluster center of gravity calculation
2b60655b 156 Int_t fRecPointsInRun ; //! Total number of recpoints in one run
9688c1dd 157 Float_t fEmcTimeGate ; // Maximum time difference between the digits in ont EMC cluster
f5eaa851 158
159 Bool_t fIsOldRCUFormat; // assume old RCU raw data format
9688c1dd 160
f5eaa851 161 ClassDef(AliPHOSClusterizerv1,4) // Clusterizer implementation version 1
d15a28e7 162
163};
164
165#endif // AliPHOSCLUSTERIZERV1_H