]>
Commit | Line | Data |
---|---|---|
a38a7850 | 1 | // @(#) $Id$ |
4aa41877 | 2 | // Original: AliHLTClustFinderNew.h,v 1.13 2004/06/18 10:55:26 loizides |
a38a7850 | 3 | |
01f43166 | 4 | #ifndef AliHLTTPC_CLUSTERFINDER |
5 | #define AliHLTTPC_CLUSTERFINDER | |
297174de | 6 | //* This file is property of and copyright by the ALICE HLT Project * |
7 | //* ALICE Experiment at CERN, All rights reserved. * | |
8 | //* See cxx source for full Copyright notice * | |
a38a7850 | 9 | |
01f43166 | 10 | /** @file AliHLTTPCClusterFinder.h |
297174de | 11 | @author Anders Vestbo, Constantin Loizides |
01f43166 | 12 | Kenneth Aamodt kenneth.aamodt@student.uib.no |
01f43166 | 13 | @brief Cluster Finder for the TPC |
14 | */ | |
15 | ||
01f43166 | 16 | #include "AliHLTLogging.h" |
297174de | 17 | #include <vector> |
6b15c309 | 18 | #include "AliHLTTPCTransform.h" |
297174de | 19 | |
20 | class AliHLTTPCPad; | |
a38a7850 | 21 | class AliHLTTPCSpacePointData; |
22 | class AliHLTTPCDigitReader; | |
297174de | 23 | class AliHLTTPCClusters; |
a38a7850 | 24 | |
297174de | 25 | /** |
26 | * @class AliHLTTPCClusterFinder | |
27 | * | |
28 | * The current cluster finder for HLT | |
29 | * (Based on STAR L3) | |
30 | * | |
31 | * Basically we have two versions for the cluster finder now. | |
32 | * The default version, reads the data pad by pad, and find the | |
33 | * clusters as it reads the data. The other version has now been | |
34 | * developed to cope with unsorted data. New methods for the unsorted | |
35 | * version can be found at the end of the default one i the source file. | |
36 | * Currently the new version is only build to manage zero-suppressed data. | |
37 | * More functionality will be added later. | |
38 | * | |
39 | * The cluster finder is initialized with the Init function, | |
40 | * providing the slice and patch information to work on. | |
41 | * | |
42 | * The input is a provided by the AliHLTTPCDigitReader class, | |
43 | * using the init() funktion, and the next() funktion in order | |
44 | * to get the next bin. Either packed or unpacked data can be | |
45 | * processed, dependent if one uses AliHLTTPCDigitReaderPacked | |
46 | * class or AliHLTTPCDigitReaderUnpacked class in the | |
47 | * Clusterfinder Component. | |
48 | * The resulting space points will be in the | |
49 | * array given by the SetOutputArray function. | |
50 | * | |
51 | * There are several setters which control the behaviour: | |
52 | * | |
53 | * - SetXYError(Float_t): set fixed error in XY direction | |
54 | * - SetZError(Float_t): set fixed error in Z direction | |
55 | * (used if errors are not calculated) | |
56 | * - SetDeconv(Bool_t): switch on/off deconvolution | |
57 | * - SetThreshold(UInt_t): set charge threshold for cluster | |
58 | * - SetMatchWidth(UInt_t): set the match distance in | |
59 | * time for sequences to be merged | |
60 | * - SetSTDOutput(Bool_t): switch on/off output about found clusters | |
61 | * - SetCalcErr(Bool_t): switch on/off calculation of | |
62 | * space point errors (or widths in raw system) | |
63 | * - SetRawSP(Bool_t): switch on/off convertion to raw system | |
64 | * | |
65 | * | |
66 | * Example Usage: | |
67 | * | |
68 | * <pre> | |
69 | * AliHLTTPCFileHandler *file = new AliHLTTPCFileHandler(); | |
70 | * file->SetAliInput(digitfile); //give some input file | |
71 | * for(int slice=0; slice<=35; slice++){ | |
72 | * for(int patch=0; pat<6; pat++){ | |
73 | * file->Init(slice,patch); | |
74 | * UInt_t ndigits=0; | |
75 | * UInt_t maxclusters=100000; | |
76 | * UInt_t pointsize = maxclusters*sizeof(AliHLTTPCSpacePointData); | |
77 | * AliHLTTPCSpacePointData *points = (AliHLTTPCSpacePointData*)memory->Allocate(pointsize); | |
78 | * AliHLTTPCDigitRowData *digits = (AliHLTTPCDigitRowData*)file->AliAltroDigits2Memory(ndigits,event); | |
79 | * AliHLTTPCClusterFinder *cf = new AliHLTTPCClusterFinder(); | |
80 | * cf->SetMatchWidth(2); | |
81 | * cf->InitSlice( slice, patch, row[0], row[1], maxPoints ); | |
82 | * cf->SetSTDOutput(kTRUE); //Some output to standard IO | |
83 | * cf->SetRawSP(kFALSE); //Convert space points to local system | |
84 | * cf->SetThreshold(5); //Threshold of cluster charge | |
85 | * cf->SetDeconv(kTRUE); //Deconv in pad and time direction | |
86 | * cf->SetCalcErr(kTRUE); //Calculate the errors of the spacepoints | |
87 | * cf->SetOutputArray(points); //Move the spacepoints to the array | |
88 | * cf->Read(iter->fPtr, iter->fSize ); //give the data to the cf | |
89 | * cf->ProcessDigits(); //process the rows given by init | |
90 | * Int_t npoints = cf->GetNumberOfClusters(); | |
91 | * AliHLTTPCMemHandler *out= new AliHLTTPCMemHandler(); | |
92 | * out->SetBinaryOutput(fname); | |
93 | * out->Memory2Binary(npoints,points); //store the spacepoints | |
94 | * out->CloseBinaryOutput(); | |
95 | * delete out; | |
96 | * file->free(); | |
97 | * delete cf; | |
98 | * } | |
99 | * } | |
100 | * </pre> | |
101 | * @ingroup alihlt_tpc | |
102 | */ | |
46b33a24 | 103 | class AliHLTTPCClusterFinder : public AliHLTLogging { |
a38a7850 | 104 | |
105 | public: | |
106 | struct AliClusterData | |
107 | { | |
108 | UInt_t fTotalCharge; //tot charge of cluster | |
109 | UInt_t fPad; //pad value | |
110 | UInt_t fTime; //time value | |
111 | ULong64_t fPad2; //for error in XY direction | |
112 | ULong64_t fTime2; //for error in Z direction | |
113 | UInt_t fMean; //mean in time | |
114 | UInt_t fFlags; //different flags | |
115 | UInt_t fChargeFalling; //for deconvolution | |
116 | UInt_t fLastCharge; //for deconvolution | |
117 | UInt_t fLastMergedPad; //dont merge twice per pad | |
d8b2f74a | 118 | Int_t fRow; //row value |
6b15c309 | 119 | UInt_t fQMax; //qmax |
a38a7850 | 120 | }; |
121 | typedef struct AliClusterData AliClusterData; //! | |
122 | ||
8f8bf0af | 123 | /** standard constructor */ |
124 | AliHLTTPCClusterFinder(); | |
a912b63b | 125 | |
8f8bf0af | 126 | /** destructor */ |
127 | virtual ~AliHLTTPCClusterFinder(); | |
128 | ||
a912b63b | 129 | /** Initialize the slice */ |
8f8bf0af | 130 | void InitSlice(Int_t slice,Int_t patch,Int_t maxpoints); |
8f8bf0af | 131 | |
a912b63b | 132 | /** Initializes the pad array (vector)*/ |
133 | void InitializePadArray(); | |
134 | ||
135 | /** Deinitialize the pad array (vector)*/ | |
136 | Int_t DeInitializePadArray(); | |
137 | ||
138 | /** Read the data in unsorted format, storing the clustercandidates */ | |
139 | void ReadDataUnsorted(void* ptr,unsigned long size); | |
140 | ||
141 | /** Read the data in unsorted format, and deconvolute the signals for each pad in time direction */ | |
142 | void ReadDataUnsortedDeconvoluteTime(void* ptr,unsigned long size); | |
143 | ||
144 | /** Loops over all rows finding the clusters */ | |
145 | void FindClusters(); | |
146 | ||
147 | /** Compare two neighbouring pads for matching clustercandidates */ | |
148 | Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead); | |
149 | ||
150 | /** Fills the hw address list */ | |
151 | Int_t FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWAddress); | |
152 | ||
153 | /** Set the pointer to the outputbuffer */ | |
8f8bf0af | 154 | void SetOutputArray(AliHLTTPCSpacePointData *pt); |
a912b63b | 155 | |
156 | /** Returns the number of clusters */ | |
157 | Int_t GetNumberOfClusters() const {return fNClusters;} | |
158 | ||
3f0fd8f1 | 159 | /** Returns the Ocuppancy limit */ |
160 | Float_t GetOccupancyLimit() {return fOccupancyLimit;} | |
161 | ||
a912b63b | 162 | // setters |
163 | void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;} | |
164 | void SetDeconvPad(Bool_t f) {fDeconvPad=f;} | |
165 | void SetDeconvTime(Bool_t f) {fDeconvTime=f;} | |
166 | void SetUnsorted(Int_t unsorted){fUnsorted=unsorted;} | |
167 | void SetPatch(Int_t patch){fCurrentPatch=patch;} | |
168 | void SetDoPadSelection(Bool_t input){fDoPadSelection=input;} | |
169 | void SetLastTimeBin(Int_t ltb){fLastTimeBin=ltb;} | |
170 | void SetFirstTimeBin(Int_t ftb){fFirstTimeBin=ftb;} | |
171 | void UpdateLastTimeBin(){fLastTimeBin=AliHLTTPCTransform::GetNTimeBins();} | |
172 | ||
173 | //---------------------------------- Under this line the old sorted clusterfinder functions can be found -------------------------------- | |
174 | void Read(void* ptr,unsigned long size); | |
175 | void ProcessDigits(); | |
8f8bf0af | 176 | void WriteClusters(Int_t n_clusters,AliClusterData *list); |
a912b63b | 177 | void WriteClusters(Int_t nclusters,AliHLTTPCClusters *list); |
8252a538 | 178 | void PrintClusters(); |
8f8bf0af | 179 | void SetXYError(Float_t f) {fXYErr=f;} |
180 | void SetZError(Float_t f) {fZErr=f;} | |
8f8bf0af | 181 | void SetThreshold(UInt_t i) {fThreshold=i;} |
182 | void SetOccupancyLimit(Float_t f) {fOccupancyLimit=f;} | |
8f8bf0af | 183 | void SetMatchWidth(UInt_t i) {fMatch=i;} |
184 | void SetSTDOutput(Bool_t f=kFALSE) {fStdout=f;} | |
185 | void SetCalcErr(Bool_t f=kTRUE) {fCalcerr=f;} | |
186 | void SetRawSP(Bool_t f=kFALSE) {fRawSP=f;} | |
187 | void SetReader(AliHLTTPCDigitReader* f){fDigitReader = f;} | |
2fdb1ae7 | 188 | |
189 | vector<AliHLTUInt16_t> fClustersHWAddressVector; //! transient | |
190 | ||
191 | typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector; | |
192 | ||
193 | vector<AliHLTTPCPadVector> fRowPadVector; //! transient | |
194 | ||
98034d0d | 195 | protected: |
8f8bf0af | 196 | /** copy constructor prohibited */ |
197 | AliHLTTPCClusterFinder(const AliHLTTPCClusterFinder&); | |
198 | /** assignment operator prohibited */ | |
199 | AliHLTTPCClusterFinder& operator=(const AliHLTTPCClusterFinder&); | |
200 | ||
2a083ac4 | 201 | AliHLTTPCSpacePointData *fSpacePointData; //! array of space points |
202 | AliHLTTPCDigitReader *fDigitReader; //! reader instance | |
a38a7850 | 203 | |
a912b63b | 204 | UChar_t* fPtr; //! pointer to packed block |
205 | unsigned long fSize; //! packed block size | |
206 | Bool_t fDeconvTime; //! deconv in time direction | |
207 | Bool_t fDeconvPad; //! deconv in pad direction | |
208 | Bool_t fStdout; //! have print out in write clusters | |
209 | Bool_t fCalcerr; //! calculate centroid sigmas | |
210 | Bool_t fRawSP; //! store centroids in raw system | |
211 | ||
212 | ||
213 | Int_t fFirstRow; //! first row | |
214 | Int_t fLastRow; //! last row | |
215 | Int_t fCurrentRow; //! current active row | |
216 | Int_t fCurrentSlice; //! current slice | |
217 | Int_t fCurrentPatch; //! current patch | |
218 | Int_t fMatch; //! size of match | |
219 | UInt_t fThreshold; //! threshold for clusters | |
220 | Int_t fNClusters; //! number of found clusters | |
221 | Int_t fMaxNClusters; //! max. number of clusters | |
222 | Float_t fXYErr; //! fixed error in XY | |
223 | Float_t fZErr; //! fixed error in Z | |
5235c3e9 | 224 | |
a912b63b | 225 | Float_t fOccupancyLimit; //! Occupancy Limit |
8252a538 | 226 | |
a912b63b | 227 | Int_t fUnsorted; //! enable for processing of unsorted digit data |
228 | Bool_t fVectorInitialized; //! flag to check if pad vector is initialized | |
229 | ||
8252a538 | 230 | vector<AliHLTTPCClusters> fClusters; //! transient |
231 | ||
232 | UInt_t* fNumberOfPadsInRow; //! transient | |
233 | ||
234 | UInt_t fNumberOfRows; //! transient | |
235 | ||
2fdb1ae7 | 236 | UInt_t fRowOfFirstCandidate; //! transient |
237 | ||
238 | Bool_t fDoPadSelection; //! transient | |
a38a7850 | 239 | |
6b15c309 | 240 | Int_t fFirstTimeBin; //! transient |
241 | ||
242 | Int_t fLastTimeBin; //! transient | |
243 | ||
244 | UInt_t fTotalChargeOfPreviousClusterCandidate; //! transient | |
245 | ||
246 | Bool_t fChargeOfCandidatesFalling; //! transient | |
247 | ||
64defa03 | 248 | |
a38a7850 | 249 | #ifdef do_mc |
250 | void GetTrackID(Int_t pad,Int_t time,Int_t *trackID); | |
251 | #endif | |
252 | ||
6b15c309 | 253 | ClassDef(AliHLTTPCClusterFinder,6) //Fast cluster finder |
a38a7850 | 254 | }; |
255 | #endif |