]>
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 | ||
159 | // setters | |
160 | void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;} | |
161 | void SetDeconvPad(Bool_t f) {fDeconvPad=f;} | |
162 | void SetDeconvTime(Bool_t f) {fDeconvTime=f;} | |
163 | void SetUnsorted(Int_t unsorted){fUnsorted=unsorted;} | |
164 | void SetPatch(Int_t patch){fCurrentPatch=patch;} | |
165 | void SetDoPadSelection(Bool_t input){fDoPadSelection=input;} | |
166 | void SetLastTimeBin(Int_t ltb){fLastTimeBin=ltb;} | |
167 | void SetFirstTimeBin(Int_t ftb){fFirstTimeBin=ftb;} | |
168 | void UpdateLastTimeBin(){fLastTimeBin=AliHLTTPCTransform::GetNTimeBins();} | |
169 | ||
170 | //---------------------------------- Under this line the old sorted clusterfinder functions can be found -------------------------------- | |
171 | void Read(void* ptr,unsigned long size); | |
172 | void ProcessDigits(); | |
8f8bf0af | 173 | void WriteClusters(Int_t n_clusters,AliClusterData *list); |
a912b63b | 174 | void WriteClusters(Int_t nclusters,AliHLTTPCClusters *list); |
8252a538 | 175 | void PrintClusters(); |
8f8bf0af | 176 | void SetXYError(Float_t f) {fXYErr=f;} |
177 | void SetZError(Float_t f) {fZErr=f;} | |
8f8bf0af | 178 | void SetThreshold(UInt_t i) {fThreshold=i;} |
179 | void SetOccupancyLimit(Float_t f) {fOccupancyLimit=f;} | |
8f8bf0af | 180 | void SetMatchWidth(UInt_t i) {fMatch=i;} |
181 | void SetSTDOutput(Bool_t f=kFALSE) {fStdout=f;} | |
182 | void SetCalcErr(Bool_t f=kTRUE) {fCalcerr=f;} | |
183 | void SetRawSP(Bool_t f=kFALSE) {fRawSP=f;} | |
184 | void SetReader(AliHLTTPCDigitReader* f){fDigitReader = f;} | |
2fdb1ae7 | 185 | |
186 | vector<AliHLTUInt16_t> fClustersHWAddressVector; //! transient | |
187 | ||
188 | typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector; | |
189 | ||
190 | vector<AliHLTTPCPadVector> fRowPadVector; //! transient | |
191 | ||
98034d0d | 192 | protected: |
8f8bf0af | 193 | /** copy constructor prohibited */ |
194 | AliHLTTPCClusterFinder(const AliHLTTPCClusterFinder&); | |
195 | /** assignment operator prohibited */ | |
196 | AliHLTTPCClusterFinder& operator=(const AliHLTTPCClusterFinder&); | |
197 | ||
2a083ac4 | 198 | AliHLTTPCSpacePointData *fSpacePointData; //! array of space points |
199 | AliHLTTPCDigitReader *fDigitReader; //! reader instance | |
a38a7850 | 200 | |
a912b63b | 201 | UChar_t* fPtr; //! pointer to packed block |
202 | unsigned long fSize; //! packed block size | |
203 | Bool_t fDeconvTime; //! deconv in time direction | |
204 | Bool_t fDeconvPad; //! deconv in pad direction | |
205 | Bool_t fStdout; //! have print out in write clusters | |
206 | Bool_t fCalcerr; //! calculate centroid sigmas | |
207 | Bool_t fRawSP; //! store centroids in raw system | |
208 | ||
209 | ||
210 | Int_t fFirstRow; //! first row | |
211 | Int_t fLastRow; //! last row | |
212 | Int_t fCurrentRow; //! current active row | |
213 | Int_t fCurrentSlice; //! current slice | |
214 | Int_t fCurrentPatch; //! current patch | |
215 | Int_t fMatch; //! size of match | |
216 | UInt_t fThreshold; //! threshold for clusters | |
217 | Int_t fNClusters; //! number of found clusters | |
218 | Int_t fMaxNClusters; //! max. number of clusters | |
219 | Float_t fXYErr; //! fixed error in XY | |
220 | Float_t fZErr; //! fixed error in Z | |
5235c3e9 | 221 | |
a912b63b | 222 | Float_t fOccupancyLimit; //! Occupancy Limit |
8252a538 | 223 | |
a912b63b | 224 | Int_t fUnsorted; //! enable for processing of unsorted digit data |
225 | Bool_t fVectorInitialized; //! flag to check if pad vector is initialized | |
226 | ||
8252a538 | 227 | vector<AliHLTTPCClusters> fClusters; //! transient |
228 | ||
229 | UInt_t* fNumberOfPadsInRow; //! transient | |
230 | ||
231 | UInt_t fNumberOfRows; //! transient | |
232 | ||
2fdb1ae7 | 233 | UInt_t fRowOfFirstCandidate; //! transient |
234 | ||
235 | Bool_t fDoPadSelection; //! transient | |
a38a7850 | 236 | |
6b15c309 | 237 | Int_t fFirstTimeBin; //! transient |
238 | ||
239 | Int_t fLastTimeBin; //! transient | |
240 | ||
241 | UInt_t fTotalChargeOfPreviousClusterCandidate; //! transient | |
242 | ||
243 | Bool_t fChargeOfCandidatesFalling; //! transient | |
244 | ||
64defa03 | 245 | |
a38a7850 | 246 | #ifdef do_mc |
247 | void GetTrackID(Int_t pad,Int_t time,Int_t *trackID); | |
248 | #endif | |
249 | ||
6b15c309 | 250 | ClassDef(AliHLTTPCClusterFinder,6) //Fast cluster finder |
a38a7850 | 251 | }; |
252 | #endif |