The present commit corresponds to an important change in the way the
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterizer.h
CommitLineData
8230f242 1#ifndef ALITRDCLUSTERIZER_H
2#define ALITRDCLUSTERIZER_H
f7336fa3 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
6d50f529 8////////////////////////////////////////////////////////////////////////////
9// //
3fe61b77 10// TRD cluster finder //
6d50f529 11// //
12////////////////////////////////////////////////////////////////////////////
13
f7336fa3 14#include <TNamed.h>
793ff80c 15
16class TFile;
bdbb05bb 17class TTree;
66f6bfd9 18class TClonesArray;
6d50f529 19
88cb7938 20class AliRunLoader;
3fe61b77 21class AliRawReader;
6d50f529 22
bdbb05bb 23class AliTRD;
c85a4951 24class AliTRDcluster;
b65e5048 25
26class AliTRDarrayADC;
27class AliTRDarraySignal;
3fe61b77 28class AliTRDdigitsManager;
29class AliTRDSignalIndex;
30class AliTRDtransform;
31class AliTRDCalROC;
3a039a31 32class AliTRDReconstructor;
b65e5048 33
3a039a31 34class AliTRDclusterizer : public TNamed
35{
b65e5048 36
37 public:
38
66f6bfd9 39 // steering flags
40 enum{
41 kOwner = BIT(14)
42 };
486c2339 43
44 struct MaxStruct
45 {
46 Int_t Row;
47 Int_t Col;
48 Int_t Time;
49 UChar_t padStatus;
50 Float_t Signals[3];
51 MaxStruct():Row(0),Col(0),Time(0),padStatus(0)
52 {}
53 MaxStruct &operator=(const MaxStruct &a)
54 {Row=a.Row; Col=a.Col; Time=a.Time; padStatus=a.padStatus;
55 memcpy(Signals, a.Signals, 3*sizeof(Signals[0])); return *this;}
56 };
66f6bfd9 57
486c2339 58 AliTRDclusterizer(const AliTRDReconstructor *const rec = 0x0);
59 AliTRDclusterizer(const Text_t* name, const Text_t* title, const AliTRDReconstructor *const rec = 0x0);
dd9a6ee3 60 AliTRDclusterizer(const AliTRDclusterizer &c);
6d50f529 61 virtual ~AliTRDclusterizer();
dd9a6ee3 62 AliTRDclusterizer &operator=(const AliTRDclusterizer &c);
63
6d50f529 64 virtual void Copy(TObject &c) const;
3fe61b77 65
6d50f529 66 virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0);
67 virtual Bool_t OpenInput(Int_t nEvent = 0);
68 virtual Bool_t OpenOutput();
25ca55ce 69 virtual Bool_t OpenOutput(TTree *clusterTree);
3fe61b77 70
71 virtual Bool_t ReadDigits();
72 virtual Bool_t ReadDigits(AliRawReader *rawReader);
73 virtual Bool_t ReadDigits(TTree *digitsTree);
74
6d50f529 75 virtual Bool_t WriteClusters(Int_t det);
76 void ResetRecPoints();
66f6bfd9 77 TClonesArray *RecPoints();
9c7c9ec1 78 Bool_t WriteTracklets(Int_t det);
bdbb05bb 79
3fe61b77 80 virtual Bool_t Raw2Clusters(AliRawReader *rawReader);
81 virtual Bool_t Raw2ClustersChamber(AliRawReader *rawReader);
82
83 virtual Bool_t MakeClusters();
84 virtual Bool_t MakeClusters(Int_t det);
85
064d808d 86 virtual Bool_t AddLabels(const Int_t idet, const Int_t firstClusterROC, const Int_t nClusterROC);
87 virtual Bool_t SetAddLabels(const Bool_t kset) { fAddLabels = kset; return fAddLabels; } // should we assign labels to clusters
88 virtual void SetRawVersion(const Int_t iver) { fRawVersion = iver; } // set the expected raw data version
3a039a31 89 void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
66f6bfd9 90 static UChar_t GetStatus(Short_t &signal);
91
92 Bool_t IsClustersOwner() const {return TestBit(kOwner);}
93 void SetClustersOwner(Bool_t own=kTRUE) {SetBit(kOwner, own); if(!own) fRecPoints = 0x0;}
3a039a31 94
b65e5048 95 protected:
96
064d808d 97 void DeConvExp (const Double_t *const source, Double_t *const target
98 ,const Int_t nTimeTotal, const Int_t nexp);
99 void TailCancelation();
100
486c2339 101 virtual Float_t Unfold(Double_t eps, Int_t layer, Double_t *padSignal) const;
b65e5048 102 Double_t GetCOG(Double_t signal[5]) const;
103 void FillLUT();
104 Double_t LUTposition(Int_t ilayer, Double_t ampL, Double_t ampC, Double_t ampR) const;
6d9e79cc 105
064d808d 106 void SetPadStatus(const UChar_t status, UChar_t &encoding);
107 UChar_t GetPadStatus(UChar_t encoding) const;
108 Int_t GetCorruption(UChar_t encoding) const;
109
486c2339 110 Bool_t IsMaximum(const MaxStruct &Max, UChar_t &padStatus, Float_t *const Signals); //for const correctness reasons not const parameters are given separately
111 Bool_t IsFivePadCluster(const MaxStruct &ThisMax, const MaxStruct &NeighbourMax, Float_t &ratio); // ''
112 void CreateCluster(const MaxStruct &Max);
3fe61b77 113
3a039a31 114 const AliTRDReconstructor *fReconstructor; //! reconstructor
3fe61b77 115 AliRunLoader *fRunLoader; //! Run Loader
116 TTree *fClusterTree; //! Tree with the cluster
66f6bfd9 117 TClonesArray *fRecPoints; //! Array of clusters
3fe61b77 118
b65e5048 119 TTree *fTrackletTree; //! Tree for tracklets
9c7c9ec1 120
3fe61b77 121 AliTRDdigitsManager *fDigitsManager; //! TRD digits manager
122
b65e5048 123 UInt_t **fTrackletContainer; //! tracklet container
9c7c9ec1 124
3fe61b77 125 Bool_t fAddLabels; // Should clusters have MC labels?
126 Int_t fRawVersion; // Expected raw version of the data - default is 2
127
3fe61b77 128 AliTRDtransform *fTransform; //! Transforms the reconstructed space points
f7336fa3 129
fc546d21 130 Int_t fLUTbin; // Number of bins of the LUT
131 Double_t *fLUT; //! The lookup table
132
064d808d 133 AliTRDarrayADC *fDigitsIn;
134 AliTRDSignalIndex *fIndexes;
135 Float_t fADCthresh; // ADC thresholds: There is no ADC threshold anymore, and simParam should not be used in clusterizer. KO
136 Float_t fMaxThresh; // Threshold value for the maximum
137 Float_t fSigThresh; // Threshold value for the digit signal
138 Float_t fMinMaxCutSigma; // Threshold value for the maximum (cut noise)
139 Float_t fMinLeftRightCutSigma; // Threshold value for the sum pad (cut noise)
140 Int_t fLayer; // Current layer of the detector
141 Int_t fDet; // Current detecor
142 UShort_t fVolid; // Volume ID
143 Int_t fColMax; // Number of Colums in one detector
144 Int_t fTimeTotal; // Number of time bins
145 AliTRDCalROC *fCalGainFactorROC; // Calibration object with pad wise values for the gain factors
146 Float_t fCalGainFactorDetValue;// Calibration value for chamber wise noise
147 AliTRDCalROC *fCalNoiseROC; // Calibration object with pad wise values for the noise
148 Float_t fCalNoiseDetValue; // Calibration value for chamber wise noise
149 AliTRDarraySignal *fDigitsOut;
150 Int_t fClusterROC; // The index to the first cluster of a given ROC
151 Int_t firstClusterROC; // The number of cluster in a given ROC
152
fc546d21 153 ClassDef(AliTRDclusterizer,6) // TRD clusterfinder
f7336fa3 154
155};
156
f7336fa3 157#endif