1 #ifndef ALITRDCLUSTERIZER_H
2 #define ALITRDCLUSTERIZER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 ////////////////////////////////////////////////////////////////////////////
10 // TRD cluster finder //
12 ////////////////////////////////////////////////////////////////////////////
27 class AliTRDarraySignal;
28 class AliTRDdigitsManager;
29 class AliTRDSignalIndex;
30 class AliTRDtransform;
32 class AliTRDReconstructor;
33 class AliTRDCalSingleChamberStatus;
34 class AliTRDrawStream;
35 class AliTRDrecoParam;
37 class AliTRDclusterizer : public TNamed
43 // bits from 0-13 are reserved by ROOT (see TObject.h)
45 kTrOwner = BIT(14) // toggle online tracklets ownership
46 ,kClOwner= BIT(15) // toggle cluster ownership
47 ,kLabels = BIT(16) // toggle MC labels for clusters
48 ,kSkipTrafo = BIT(17) // skip the coordinate transformation of clusters?
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?
52 ,kTracksOwner = BIT(21) // toggle GTU track ownership
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)?
63 MaxStruct():row(-1),col(0),time(0),padStatus(0),fivePad(kFALSE)
64 {memset(signals, 0, 3*sizeof(Short_t));}
65 MaxStruct &operator=(const MaxStruct &a)
66 {memcpy(this, &a, sizeof(MaxStruct)); return *this;}
69 AliTRDclusterizer(const AliTRDReconstructor *const rec = 0x0);
70 AliTRDclusterizer(const Text_t* name, const Text_t* title, const AliTRDReconstructor *const rec = 0x0);
71 AliTRDclusterizer(const AliTRDclusterizer &c);
72 virtual ~AliTRDclusterizer();
73 AliTRDclusterizer &operator=(const AliTRDclusterizer &c);
75 void Copy(TObject &c) const;
77 Bool_t Open(const Char_t *name, Int_t nEvent = 0);
78 Bool_t OpenInput(Int_t nEvent = 0);
80 Bool_t OpenOutput(TTree *const clusterTree);
83 Bool_t ReadDigits(AliRawReader *rawReader);
84 Bool_t ReadDigits(TTree *digitsTree);
86 Bool_t WriteClusters(Int_t det);
87 void ResetRecPoints();
88 virtual TClonesArray *RecPoints();
89 virtual TClonesArray *TrackletsArray();
90 virtual TClonesArray *TracksArray();
92 Bool_t Raw2Clusters(AliRawReader *rawReader);
93 Bool_t Raw2ClustersChamber(AliRawReader *rawReader);
95 Bool_t MakeClusters();
96 Bool_t MakeClusters(Int_t det);
99 Bool_t SetUseLabels(const Bool_t kset) { SetBit(kLabels, kset); return TestBit(kLabels); } // should we assign labels to clusters
100 void SetRawVersion(const Int_t iver) { fRawVersion = iver; } // set the expected raw data version
101 void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
102 static UChar_t GetStatus(Short_t &signal);
103 Int_t GetAddedClusters() const {return fNoOfClusters;}
104 Int_t GetNTimeBins() const {return fTimeTotal;}
106 Bool_t IsClustersOwner() const {return TestBit(kClOwner);}
107 virtual void SetClustersOwner(Bool_t own=kTRUE) {SetBit(kClOwner, own); if(!own) {fRecPoints = 0x0; fNoOfClusters=0;} }
108 void SetTrackletsOwner(Bool_t own=kTRUE) {SetBit(kTrOwner, own); if(!own) {fTracklets = 0x0; } }
109 void SetTracksOwner(Bool_t own=kTRUE) {SetBit(kTracksOwner, own); if(!own) {fTracks = 0x0; } }
110 void SetSkipTransform(Bool_t b=kTRUE) {SetBit(kSkipTrafo, b); }
114 void ApplyTCTM(Short_t *const arr, const Int_t nTime, const Int_t nexp);
115 void DeConvExp (Short_t *const arr, const Int_t nTime, const Int_t nexp);
116 void ConvExp(Short_t *const arr, const Int_t nTime);
117 void TailCancelation(const AliTRDrecoParam* const recoParam);
119 Float_t Unfold(Double_t eps, Int_t layer, const Double_t *const padSignal) const;
121 void SetPadStatus(const UChar_t status, UChar_t &encoding) const;
122 UChar_t GetPadStatus(UChar_t encoding) const;
123 Int_t GetCorruption(UChar_t encoding) const;
125 Bool_t IsMaximum(const MaxStruct &Max, UChar_t &padStatus, Short_t *const Signals); //for const correctness reasons not const parameters are given separately
126 Bool_t FivePadCluster(MaxStruct &ThisMax, MaxStruct &NeighbourMax);
127 void CreateCluster(const MaxStruct &Max);
129 virtual void AddClusterToArray(AliTRDcluster* cluster);
132 inline void CalcAdditionalInfo(const MaxStruct &Max, Short_t *const signals, Int_t &nPadCount);
135 const AliTRDReconstructor *fReconstructor; //! reconstructor
136 AliRunLoader *fRunLoader; //! Run Loader
137 TTree *fClusterTree; //! Tree with the cluster
138 TClonesArray *fRecPoints; //! Array of clusters
139 TClonesArray *fTracklets; //! Array of online tracklets
140 TClonesArray *fTracks; //! Array of GTU tracks
142 TTree *fTrackletTree; //! Tree for tracklets
144 AliTRDdigitsManager *fDigitsManager; //! TRD digits manager
146 UInt_t **fTrackletContainer; //! tracklet container
147 // legacy code to avoid breakint AliHLTTRDClusterizer
150 Int_t fRawVersion; // Expected raw version of the data - default is 2
152 AliTRDtransform *fTransform; //! Transforms the reconstructed space points
154 AliTRDarrayADC *fDigits; // Array holding the digits
155 AliTRDSignalIndex *fIndexes; // Array holding the indexes to the digits
156 Short_t fMaxThresh; // Threshold value for the maximum
157 Short_t fMaxThreshTest; // Threshold value for the maximum to test agains
158 Short_t fSigThresh; // Threshold value for the digit signal
159 Float_t fMinMaxCutSigma; // Threshold value for the maximum (cut noise)
160 Float_t fMinLeftRightCutSigma; // Threshold value for the sum pad (cut noise)
161 Int_t fLayer; // Current layer of the detector
162 Int_t fDet; // Current detecor
163 UShort_t fVolid; // Volume ID
164 Int_t fColMax; // Number of Colums in one detector
165 Int_t fTimeTotal; // Number of time bins
166 AliTRDCalROC *fCalGainFactorROC; // Calibration object with pad wise values for the gain factors
167 Float_t fCalGainFactorDetValue;// Calibration value for chamber wise noise
168 AliTRDCalROC *fCalNoiseROC; // Calibration object with pad wise values for the noise
169 Float_t fCalNoiseDetValue; // Calibration value for chamber wise noise
170 AliTRDCalSingleChamberStatus *fCalPadStatusROC; // Calibration object with the pad status
171 Int_t fClusterROC; // The index to the first cluster of a given ROC
172 Int_t firstClusterROC; // The number of cluster in a given ROC
173 Int_t fNoOfClusters; // Number of Clusters already processed and still owned by the clusterizer
174 Int_t fBaseline; // Baseline of the ADC values
175 AliTRDrawStream *fRawStream; // Raw data streamer
177 ClassDef(AliTRDclusterizer,6) // TRD clusterfinder