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