]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TRD/AliTRDclusterizer.h
More mods for embedding
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterizer.h
... / ...
CommitLineData
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 */
5
6/* $Id$ */
7
8////////////////////////////////////////////////////////////////////////////
9// //
10// TRD cluster finder //
11// //
12////////////////////////////////////////////////////////////////////////////
13
14#include <TNamed.h>
15
16class TFile;
17class TTree;
18class TClonesArray;
19
20class AliRunLoader;
21class AliRawReader;
22
23class AliTRD;
24class AliTRDcluster;
25
26class AliTRDarrayADC;
27class AliTRDarraySignal;
28class AliTRDdigitsManager;
29class AliTRDSignalIndex;
30class AliTRDtransform;
31class AliTRDCalROC;
32class AliTRDReconstructor;
33class AliTRDCalSingleChamberStatus;
34class AliTRDrawStream;
35class AliTRDrecoParam;
36
37class AliTRDclusterizer : public TNamed
38{
39
40 public:
41
42 // steering flags
43 // bits from 0-13 are reserved by ROOT (see TObject.h)
44 enum{
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 };
53
54 struct MaxStruct
55 {
56 Int_t row; // row of the current cluster candidate
57 Int_t col; // col of the current cluster candidate
58 Int_t time; // time -"-
59 Short_t signals[3]; // signals of the maximum pad and it's twon neigbours
60 UChar_t padStatus; // padStatus of the current cluster candidate
61 Bool_t fivePad; // is this cluster candidate part of a 5 pad cluster (two overlaping clusters)?
62 MaxStruct():row(-1),col(0),time(0),padStatus(0),fivePad(kFALSE)
63 {memset(signals, 0, 3*sizeof(Short_t));}
64 MaxStruct &operator=(const MaxStruct &a)
65 {memcpy(this, &a, sizeof(MaxStruct)); return *this;}
66 };
67
68 AliTRDclusterizer(const AliTRDReconstructor *const rec = 0x0);
69 AliTRDclusterizer(const Text_t* name, const Text_t* title, const AliTRDReconstructor *const rec = 0x0);
70 AliTRDclusterizer(const AliTRDclusterizer &c);
71 virtual ~AliTRDclusterizer();
72 AliTRDclusterizer &operator=(const AliTRDclusterizer &c);
73
74 void Copy(TObject &c) const;
75
76 Bool_t Open(const Char_t *name, Int_t nEvent = 0);
77 Bool_t OpenInput(Int_t nEvent = 0);
78 Bool_t OpenOutput();
79 Bool_t OpenOutput(TTree *const clusterTree);
80
81 Bool_t ReadDigits();
82 Bool_t ReadDigits(AliRawReader *rawReader);
83 Bool_t ReadDigits(TTree *digitsTree);
84
85 Bool_t WriteClusters(Int_t det);
86 void ResetRecPoints();
87 virtual TClonesArray *RecPoints();
88 virtual TClonesArray *TrackletsArray();
89 Bool_t WriteTracklets(Int_t det);
90
91 Bool_t Raw2Clusters(AliRawReader *rawReader);
92 Bool_t Raw2ClustersChamber(AliRawReader *rawReader);
93
94 Bool_t MakeClusters();
95 Bool_t MakeClusters(Int_t det);
96
97 Bool_t AddLabels();
98 Bool_t SetUseLabels(const Bool_t kset) { SetBit(kLabels, kset); return TestBit(kLabels); } // should we assign labels to clusters
99 void SetRawVersion(const Int_t iver) { fRawVersion = iver; } // set the expected raw data version
100 void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
101 static UChar_t GetStatus(Short_t &signal);
102 Int_t GetAddedClusters() const {return fNoOfClusters;}
103 Int_t GetNTimeBins() const {return fTimeTotal;}
104
105 Bool_t IsClustersOwner() const {return TestBit(kClOwner);}
106 virtual void SetClustersOwner(Bool_t own=kTRUE) {SetBit(kClOwner, own); if(!own) {fRecPoints = 0x0; fNoOfClusters=0;} }
107 void SetTrackletsOwner(Bool_t own=kTRUE) {SetBit(kTrOwner, own); if(!own) {fTracklets = 0x0; } }
108 void SetSkipTransform(Bool_t b=kTRUE) {SetBit(kSkipTrafo, b); }
109
110protected:
111
112 void DeConvExp (Short_t *const arr, const Int_t nTime, const Int_t nexp);
113 void TailCancelation(const AliTRDrecoParam* const recoParam);
114
115 Float_t Unfold(Double_t eps, Int_t layer, const Double_t *const padSignal) const;
116
117 void SetPadStatus(const UChar_t status, UChar_t &encoding) const;
118 UChar_t GetPadStatus(UChar_t encoding) const;
119 Int_t GetCorruption(UChar_t encoding) const;
120
121 Bool_t IsMaximum(const MaxStruct &Max, UChar_t &padStatus, Short_t *const Signals); //for const correctness reasons not const parameters are given separately
122 Bool_t FivePadCluster(MaxStruct &ThisMax, MaxStruct &NeighbourMax);
123 void CreateCluster(const MaxStruct &Max);
124
125 virtual void AddClusterToArray(AliTRDcluster* cluster);
126 virtual void AddTrackletsToArray();
127
128private:
129 inline void CalcAdditionalInfo(const MaxStruct &Max, Short_t *const signals, Int_t &nPadCount);
130
131protected:
132 const AliTRDReconstructor *fReconstructor; //! reconstructor
133 AliRunLoader *fRunLoader; //! Run Loader
134 TTree *fClusterTree; //! Tree with the cluster
135 TClonesArray *fRecPoints; //! Array of clusters
136 TClonesArray *fTracklets; //! Array of online tracklets
137
138 TTree *fTrackletTree; //! Tree for tracklets
139
140 AliTRDdigitsManager *fDigitsManager; //! TRD digits manager
141
142 UInt_t **fTrackletContainer; //! tracklet container
143
144 Int_t fRawVersion; // Expected raw version of the data - default is 2
145
146 AliTRDtransform *fTransform; //! Transforms the reconstructed space points
147
148 AliTRDarrayADC *fDigits; // Array holding the digits
149 AliTRDSignalIndex *fIndexes; // Array holding the indexes to the digits
150 Short_t fMaxThresh; // Threshold value for the maximum
151 Short_t fMaxThreshTest; // Threshold value for the maximum to test agains
152 Short_t fSigThresh; // Threshold value for the digit signal
153 Float_t fMinMaxCutSigma; // Threshold value for the maximum (cut noise)
154 Float_t fMinLeftRightCutSigma; // Threshold value for the sum pad (cut noise)
155 Int_t fLayer; // Current layer of the detector
156 Int_t fDet; // Current detecor
157 UShort_t fVolid; // Volume ID
158 Int_t fColMax; // Number of Colums in one detector
159 Int_t fTimeTotal; // Number of time bins
160 AliTRDCalROC *fCalGainFactorROC; // Calibration object with pad wise values for the gain factors
161 Float_t fCalGainFactorDetValue;// Calibration value for chamber wise noise
162 AliTRDCalROC *fCalNoiseROC; // Calibration object with pad wise values for the noise
163 Float_t fCalNoiseDetValue; // Calibration value for chamber wise noise
164 AliTRDCalSingleChamberStatus *fCalPadStatusROC; // Calibration object with the pad status
165 Int_t fClusterROC; // The index to the first cluster of a given ROC
166 Int_t firstClusterROC; // The number of cluster in a given ROC
167 Int_t fNoOfClusters; // Number of Clusters already processed and still owned by the clusterizer
168 Int_t fBaseline; // Baseline of the ADC values
169 AliTRDrawStream *fRawStream; // Raw data streamer
170
171 ClassDef(AliTRDclusterizer,6) // TRD clusterfinder
172
173};
174
175#endif