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