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