]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDclusterizer.h
New function to calculate the RMS by rejecting uncalibrated chambers + an additional...
[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;
1b3a719f 33class AliTRDCalSingleChamberStatus;
8df1f8f5 34class AliTRDrawStream;
fc0882f3 35class AliTRDrecoParam;
b65e5048 36
3a039a31 37class AliTRDclusterizer : public TNamed
38{
b65e5048 39
40 public:
41
66f6bfd9 42 // steering flags
4806451b 43 // bits from 0-13 are reserved by ROOT (see TObject.h)
66f6bfd9 44 enum{
4806451b 45 kTrOwner = BIT(14) // toggle online tracklets ownership
46 ,kClOwner= BIT(15) // toggle cluster ownership
47 ,kLabels = BIT(16) // toggle MC labels for clusters
d03bfe2b 48 ,kSkipTrafo = BIT(17) // skip the coordinate transformation of clusters?
4806451b 49 ,kLUT = BIT(18) // using look up table for cluster's r-phi position
50 ,kGAUS = BIT(19) // using gauss approx. for cluster's r-phi position
51 ,knewDM = BIT(20) // was the digitsmanger created by raw2clusters?
a1c095f1 52 ,kTracksOwner = BIT(21) // toggle GTU track ownership
66f6bfd9 53 };
486c2339 54
55 struct MaxStruct
56 {
4dab9275 57 Int_t row; // row of the current cluster candidate
58 Int_t col; // col of the current cluster candidate
59 Int_t time; // time -"-
60 Short_t signals[3]; // signals of the maximum pad and it's twon neigbours
61 UChar_t padStatus; // padStatus of the current cluster candidate
62 Bool_t fivePad; // is this cluster candidate part of a 5 pad cluster (two overlaping clusters)?
615f0826 63 MaxStruct():row(-1),col(0),time(0),padStatus(0),fivePad(kFALSE)
64 {memset(signals, 0, 3*sizeof(Short_t));}
486c2339 65 MaxStruct &operator=(const MaxStruct &a)
6b0d4ad5 66 {memcpy(this, &a, sizeof(MaxStruct)); return *this;}
486c2339 67 };
66f6bfd9 68
486c2339 69 AliTRDclusterizer(const AliTRDReconstructor *const rec = 0x0);
70 AliTRDclusterizer(const Text_t* name, const Text_t* title, const AliTRDReconstructor *const rec = 0x0);
dd9a6ee3 71 AliTRDclusterizer(const AliTRDclusterizer &c);
6d50f529 72 virtual ~AliTRDclusterizer();
dd9a6ee3 73 AliTRDclusterizer &operator=(const AliTRDclusterizer &c);
74
0ab5ff49 75 void Copy(TObject &c) const;
3fe61b77 76
6cd9a21f 77 Bool_t Open(const Char_t *name, Int_t nEvent = 0);
78 Bool_t OpenInput(Int_t nEvent = 0);
79 Bool_t OpenOutput();
e7295a3a 80 Bool_t OpenOutput(TTree *const clusterTree);
3fe61b77 81
6cd9a21f 82 Bool_t ReadDigits();
83 Bool_t ReadDigits(AliRawReader *rawReader);
84 Bool_t ReadDigits(TTree *digitsTree);
3fe61b77 85
cb8b99ee 86 Bool_t ReadTracklets();
87 Bool_t ReadTracks();
88
6cd9a21f 89 Bool_t WriteClusters(Int_t det);
3d0c7d6d 90 void ResetRecPoints();
91 virtual TClonesArray *RecPoints();
cb8b99ee 92 virtual TClonesArray *TrackletsArray(const TString &trkltype = "");
a1c095f1 93 virtual TClonesArray *TracksArray();
bdbb05bb 94
6cd9a21f 95 Bool_t Raw2Clusters(AliRawReader *rawReader);
96 Bool_t Raw2ClustersChamber(AliRawReader *rawReader);
3fe61b77 97
6cd9a21f 98 Bool_t MakeClusters();
99 Bool_t MakeClusters(Int_t det);
3fe61b77 100
6cd9a21f 101 Bool_t AddLabels();
b72f4eaf 102 Bool_t SetUseLabels(const Bool_t kset) { SetBit(kLabels, kset); return TestBit(kLabels); } // should we assign labels to clusters
6cd9a21f 103 void SetRawVersion(const Int_t iver) { fRawVersion = iver; } // set the expected raw data version
3a039a31 104 void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
66f6bfd9 105 static UChar_t GetStatus(Short_t &signal);
e7295a3a 106 Int_t GetAddedClusters() const {return fNoOfClusters;}
293e8ba7 107 Int_t GetNTimeBins() const {return fTimeTotal;}
66f6bfd9 108
8c499dbf 109 Bool_t IsClustersOwner() const {return TestBit(kClOwner);}
29f3223b 110 virtual void SetClustersOwner(Bool_t own=kTRUE) {SetBit(kClOwner, own); if(!own) {fRecPoints = 0x0; fNoOfClusters=0;} }
8c499dbf 111 void SetTrackletsOwner(Bool_t own=kTRUE) {SetBit(kTrOwner, own); if(!own) {fTracklets = 0x0; } }
a1c095f1 112 void SetTracksOwner(Bool_t own=kTRUE) {SetBit(kTracksOwner, own); if(!own) {fTracks = 0x0; } }
d03bfe2b 113 void SetSkipTransform(Bool_t b=kTRUE) {SetBit(kSkipTrafo, b); }
3a039a31 114
b72f4eaf 115protected:
b65e5048 116
9dcc64cc 117 void ApplyTCTM(Short_t *const arr, const Int_t nTime, const Int_t nexp);
1ab4da8c 118 void DeConvExp (Short_t *const arr, const Int_t nTime, const Int_t nexp);
9dcc64cc 119 void ConvExp(Short_t *const arr, const Int_t nTime);
fc0882f3 120 void TailCancelation(const AliTRDrecoParam* const recoParam);
064d808d 121
8c499dbf 122 Float_t Unfold(Double_t eps, Int_t layer, const Double_t *const padSignal) const;
6d9e79cc 123
e7295a3a 124 void SetPadStatus(const UChar_t status, UChar_t &encoding) const;
064d808d 125 UChar_t GetPadStatus(UChar_t encoding) const;
126 Int_t GetCorruption(UChar_t encoding) const;
127
1b3a719f 128 Bool_t IsMaximum(const MaxStruct &Max, UChar_t &padStatus, Short_t *const Signals); //for const correctness reasons not const parameters are given separately
129 Bool_t FivePadCluster(MaxStruct &ThisMax, MaxStruct &NeighbourMax);
486c2339 130 void CreateCluster(const MaxStruct &Max);
8dbc94c7 131
e7295a3a 132 virtual void AddClusterToArray(AliTRDcluster* cluster);
3fe61b77 133
8dbc94c7 134private:
135 inline void CalcAdditionalInfo(const MaxStruct &Max, Short_t *const signals, Int_t &nPadCount);
136
137protected:
3d0c7d6d 138 const AliTRDReconstructor *fReconstructor; //! reconstructor
3fe61b77 139 AliRunLoader *fRunLoader; //! Run Loader
140 TTree *fClusterTree; //! Tree with the cluster
66f6bfd9 141 TClonesArray *fRecPoints; //! Array of clusters
a5b99acd 142 TClonesArray *fTracklets; //! Array of online tracklets
a1c095f1 143 TClonesArray *fTracks; //! Array of GTU tracks
3fe61b77 144
b65e5048 145 TTree *fTrackletTree; //! Tree for tracklets
9c7c9ec1 146
3fe61b77 147 AliTRDdigitsManager *fDigitsManager; //! TRD digits manager
148
b65e5048 149 UInt_t **fTrackletContainer; //! tracklet container
a1c095f1 150 // legacy code to avoid breakint AliHLTTRDClusterizer
151 // but it's useless
9c7c9ec1 152
3fe61b77 153 Int_t fRawVersion; // Expected raw version of the data - default is 2
154
3fe61b77 155 AliTRDtransform *fTransform; //! Transforms the reconstructed space points
f7336fa3 156
3d0c7d6d 157 AliTRDarrayADC *fDigits; // Array holding the digits
158 AliTRDSignalIndex *fIndexes; // Array holding the indexes to the digits
1ab4da8c 159 Short_t fMaxThresh; // Threshold value for the maximum
160 Short_t fMaxThreshTest; // Threshold value for the maximum to test agains
161 Short_t fSigThresh; // Threshold value for the digit signal
064d808d 162 Float_t fMinMaxCutSigma; // Threshold value for the maximum (cut noise)
163 Float_t fMinLeftRightCutSigma; // Threshold value for the sum pad (cut noise)
164 Int_t fLayer; // Current layer of the detector
165 Int_t fDet; // Current detecor
166 UShort_t fVolid; // Volume ID
167 Int_t fColMax; // Number of Colums in one detector
168 Int_t fTimeTotal; // Number of time bins
169 AliTRDCalROC *fCalGainFactorROC; // Calibration object with pad wise values for the gain factors
170 Float_t fCalGainFactorDetValue;// Calibration value for chamber wise noise
171 AliTRDCalROC *fCalNoiseROC; // Calibration object with pad wise values for the noise
172 Float_t fCalNoiseDetValue; // Calibration value for chamber wise noise
3d0c7d6d 173 AliTRDCalSingleChamberStatus *fCalPadStatusROC; // Calibration object with the pad status
064d808d 174 Int_t fClusterROC; // The index to the first cluster of a given ROC
175 Int_t firstClusterROC; // The number of cluster in a given ROC
3d0c7d6d 176 Int_t fNoOfClusters; // Number of Clusters already processed and still owned by the clusterizer
615f0826 177 Int_t fBaseline; // Baseline of the ADC values
8df1f8f5 178 AliTRDrawStream *fRawStream; // Raw data streamer
064d808d 179
3d0c7d6d 180 ClassDef(AliTRDclusterizer,6) // TRD clusterfinder
f7336fa3 181
182};
183
f7336fa3 184#endif