]>
Commit | Line | Data |
---|---|---|
71d7c760 | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
9be2600f | 4 | * This file is property of and copyright by the ALICE HLT Project * |
5 | * ALICE Experiment at CERN, All rights reserved. * | |
71d7c760 | 6 | * * |
9be2600f | 7 | * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * |
8 | * Timm Steinbeck <timm@kip.uni-heidelberg.de> * | |
9 | * Jochen Thaeder <thaeder@kip.uni-heidelberg.de> * | |
10 | * for The ALICE HLT Project. * | |
71d7c760 | 11 | * * |
12 | * Permission to use, copy, modify and distribute this software and its * | |
13 | * documentation strictly for non-commercial purposes is hereby granted * | |
14 | * without fee, provided that the above copyright notice appears in all * | |
15 | * copies and that both the copyright notice and this permission notice * | |
16 | * appear in the supporting documentation. The authors make no claims * | |
17 | * about the suitability of this software for any purpose. It is * | |
18 | * provided "as is" without express or implied warranty. * | |
19 | **************************************************************************/ | |
20 | ||
96bda103 | 21 | /** @file AliHLTTPCClusterFinderComponent.cxx |
27f5f8ed | 22 | @author Timm Steinbeck, Matthias Richter, Jochen Thaeder, Kenneth Aamodt |
de554e07 | 23 | @date |
24 | @brief The TPC cluster finder processing component | |
25 | */ | |
a38a7850 | 26 | |
e67b0680 | 27 | // see header file for class documentation // |
28 | // or // | |
29 | // refer to README to build package // | |
30 | // or // | |
31 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt // | |
32 | ||
db16520a | 33 | #if __GNUC__>= 3 |
71d7c760 | 34 | using namespace std; |
35 | #endif | |
71d7c760 | 36 | #include "AliHLTTPCClusterFinderComponent.h" |
a38a7850 | 37 | #include "AliHLTTPCDigitReaderPacked.h" |
38 | #include "AliHLTTPCDigitReaderUnpacked.h" | |
db16520a | 39 | #include "AliHLTTPCDigitReaderRaw.h" |
a38a7850 | 40 | #include "AliHLTTPCClusterFinder.h" |
a6c02c85 | 41 | #include "AliHLTTPCSpacePointData.h" |
71d7c760 | 42 | #include "AliHLTTPCClusterDataFormat.h" |
a6c02c85 | 43 | #include "AliHLTTPCTransform.h" |
01f43166 | 44 | #include "AliHLTTPCClusters.h" |
e67b0680 | 45 | #include "AliHLTTPCDefinitions.h" |
46 | #include <cstdlib> | |
47 | #include <cerrno> | |
ecefc48a | 48 | #include "TString.h" |
01f43166 | 49 | #include <sys/time.h> |
71d7c760 | 50 | |
51 | // this is a global object used for automatic component registration, do not use this | |
2a083ac4 | 52 | // use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType" |
53 | // use fPackedSwitch = false for unpacked inputtype "gkUnpackedRawDataType" | |
a38a7850 | 54 | AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentPacked(true); |
55 | AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(false); | |
71d7c760 | 56 | |
57 | ClassImp(AliHLTTPCClusterFinderComponent) | |
58 | ||
a38a7850 | 59 | AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(bool packed) |
74c73e5a | 60 | : |
74c73e5a | 61 | fClusterFinder(NULL), |
62 | fReader(NULL), | |
63 | fClusterDeconv(true), | |
64 | fXYClusterError(-1), | |
2a083ac4 | 65 | fZClusterError(-1), |
01f43166 | 66 | fPackedSwitch(packed), |
01f43166 | 67 | fUnsorted(0), |
a1dbf058 | 68 | fPatch(0), |
b1c46961 | 69 | fPadArray(NULL), |
70 | fGetActivePads(0) | |
74c73e5a | 71 | { |
2a083ac4 | 72 | // see header file for class documentation |
73 | // or | |
74 | // refer to README to build package | |
75 | // or | |
76 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
74c73e5a | 77 | } |
78 | ||
71d7c760 | 79 | AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent() |
7e99beb3 | 80 | { |
2a083ac4 | 81 | // see header file for class documentation |
7e99beb3 | 82 | } |
71d7c760 | 83 | |
84 | // Public functions to implement AliHLTComponent's interface. | |
85 | // These functions are required for the registration process | |
86 | ||
87 | const char* AliHLTTPCClusterFinderComponent::GetComponentID() | |
7e99beb3 | 88 | { |
2a083ac4 | 89 | // see header file for class documentation |
7e99beb3 | 90 | if (fPackedSwitch) return "TPCClusterFinderPacked"; |
91 | else return "TPCClusterFinderUnpacked"; | |
92 | } | |
71d7c760 | 93 | |
8ede8717 | 94 | void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
7e99beb3 | 95 | { |
2a083ac4 | 96 | // see header file for class documentation |
7e99beb3 | 97 | list.clear(); |
98 | if (fPackedSwitch) list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType ); | |
99 | else list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType ); | |
a38a7850 | 100 | |
7e99beb3 | 101 | } |
71d7c760 | 102 | |
8ede8717 | 103 | AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType() |
7e99beb3 | 104 | { |
2a083ac4 | 105 | // see header file for class documentation |
7e99beb3 | 106 | return AliHLTTPCDefinitions::fgkClustersDataType; |
107 | } | |
71d7c760 | 108 | |
109 | void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
7e99beb3 | 110 | { |
2a083ac4 | 111 | // see header file for class documentation |
7e99beb3 | 112 | // XXX TODO: Find more realistic values. |
113 | constBase = 0; | |
114 | if (fPackedSwitch) inputMultiplier = (6 * 0.4); | |
115 | else inputMultiplier = 0.4; | |
116 | } | |
71d7c760 | 117 | |
118 | AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn() | |
7e99beb3 | 119 | { |
2a083ac4 | 120 | // see header file for class documentation |
7e99beb3 | 121 | return new AliHLTTPCClusterFinderComponent(fPackedSwitch); |
122 | } | |
71d7c760 | 123 | |
124 | int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv ) | |
7e99beb3 | 125 | { |
2a083ac4 | 126 | // see header file for class documentation |
7e99beb3 | 127 | if ( fClusterFinder ) |
128 | return EINPROGRESS; | |
129 | ||
130 | fClusterFinder = new AliHLTTPCClusterFinder(); | |
131 | ||
132 | Int_t rawreadermode = -1; | |
133 | Int_t sigthresh = -1; | |
b1c46961 | 134 | Double_t sigmathresh= -1; |
7e99beb3 | 135 | Float_t occulimit = 1.0; |
136 | Int_t oldRCUFormat=0; | |
137 | // Data Format version numbers: | |
138 | // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word. | |
139 | // 1: As 0, but pads/padrows are delivered "as is", without sorting | |
140 | // 2: As 0, but RCU trailer is 3 32 bit words. | |
141 | // 3: As 1, but RCU trailer is 3 32 bit words. | |
142 | // -1: use offline raw reader | |
143 | ||
144 | Int_t i = 0; | |
145 | Char_t* cpErr; | |
146 | ||
147 | while ( i < argc ) { | |
148 | ||
149 | // -- raw reader mode option | |
150 | if ( !strcmp( argv[i], "rawreadermode" ) ) { | |
151 | if ( argc <= i+1 ) { | |
152 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified" ); | |
153 | return ENOTSUP; | |
154 | } | |
f3f599e0 | 155 | |
7e99beb3 | 156 | // Decodes the rawreader mode: either number or string and returns the rawreadermode |
157 | // -1 on failure, -2 for offline | |
158 | rawreadermode = AliHLTTPCDigitReaderRaw::DecodeMode( argv[i+1] ); | |
f3f599e0 | 159 | |
7e99beb3 | 160 | if (rawreadermode == -1 ) { |
161 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Cannot convert rawreadermode specifier '%s'.", argv[i+1] ); | |
162 | return EINVAL; | |
db16520a | 163 | } |
164 | ||
7e99beb3 | 165 | i += 2; |
166 | continue; | |
167 | } | |
db16520a | 168 | |
7e99beb3 | 169 | // -- pp run option |
170 | if ( !strcmp( argv[i], "pp-run" ) ) { | |
171 | fClusterDeconv = false; | |
172 | i++; | |
173 | continue; | |
174 | } | |
175 | ||
176 | // -- zero suppression threshold | |
177 | if ( !strcmp( argv[i], "adc-threshold" ) ) { | |
178 | sigthresh = strtoul( argv[i+1], &cpErr ,0); | |
179 | if ( *cpErr ) { | |
180 | HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]); | |
181 | return EINVAL; | |
84645eb0 | 182 | } |
7e99beb3 | 183 | i+=2; |
184 | continue; | |
185 | } | |
84645eb0 | 186 | |
7e99beb3 | 187 | // -- pad occupancy limit |
188 | if ( !strcmp( argv[i], "occupancy-limit" ) ) { | |
d0173e83 | 189 | occulimit = strtod( argv[i+1], &cpErr); |
7e99beb3 | 190 | if ( *cpErr ) { |
191 | HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]); | |
192 | return EINVAL; | |
5235c3e9 | 193 | } |
7e99beb3 | 194 | i+=2; |
195 | continue; | |
196 | } | |
5235c3e9 | 197 | |
7e99beb3 | 198 | // -- number of timebins (default 1024) |
199 | if ( !strcmp( argv[i], "timebins" ) ) { | |
200 | TString parameter(argv[i+1]); | |
201 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
202 | if (parameter.IsDigit()) { | |
203 | AliHLTTPCTransform::SetNTimeBins(parameter.Atoi()); | |
74511e22 | 204 | HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth()); |
7e99beb3 | 205 | } else { |
206 | HLTError("Cannot timebin specifier '%s'.", argv[i+1]); | |
207 | return EINVAL; | |
ecefc48a | 208 | } |
7e99beb3 | 209 | i+=2; |
210 | continue; | |
211 | } | |
ecefc48a | 212 | |
7e99beb3 | 213 | // -- checking for rcu format |
214 | if ( !strcmp( argv[i], "oldrcuformat" ) ) { | |
215 | oldRCUFormat = strtoul( argv[i+1], &cpErr ,0); | |
216 | if ( *cpErr ){ | |
217 | HLTError("Cannot convert oldrcuformat specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
218 | return EINVAL; | |
27f5f8ed | 219 | } |
7e99beb3 | 220 | i+=2; |
221 | continue; | |
222 | } | |
27f5f8ed | 223 | |
01f43166 | 224 | // -- checking for unsorted clusterfinding |
225 | if ( !strcmp( argv[i], "unsorted" ) ) { | |
226 | fUnsorted = strtoul( argv[i+1], &cpErr ,0); | |
227 | if ( *cpErr ){ | |
228 | HLTError("Cannot convert unsorted specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
229 | return EINVAL; | |
230 | } | |
231 | i+=2; | |
232 | continue; | |
233 | } | |
234 | ||
235 | // -- checking for unsorted clusterfinding | |
236 | if ( !strcmp( argv[i], "patch" ) ) { | |
237 | fPatch = strtoul( argv[i+1], &cpErr ,0); | |
238 | if ( *cpErr ){ | |
239 | HLTError("Cannot convert patch specifier '%s'. Should be between 0 and 5, must be integer", argv[i+1]); | |
240 | return EINVAL; | |
241 | } | |
242 | i+=2; | |
243 | continue; | |
244 | } | |
245 | ||
b1c46961 | 246 | // -- checking for active pads, used in 2007 December run |
247 | if ( !strcmp( argv[i], "activepads" ) ) { | |
248 | fGetActivePads = strtoul( argv[i+1], &cpErr ,0); | |
249 | if ( *cpErr ){ | |
250 | HLTError("Cannot convert activepads specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
251 | return EINVAL; | |
252 | } | |
253 | i+=2; | |
254 | continue; | |
255 | } | |
256 | ||
257 | // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression | |
258 | if ( !strcmp( argv[i], "nsigma-threshold" ) ) { | |
259 | sigmathresh = strtoul( argv[i+1], &cpErr ,0); | |
260 | if ( *cpErr ){ | |
261 | HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]); | |
262 | return EINVAL; | |
263 | } | |
264 | i+=2; | |
265 | continue; | |
266 | } | |
267 | ||
7e99beb3 | 268 | Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); |
269 | return EINVAL; | |
27f5f8ed | 270 | |
7e99beb3 | 271 | } |
db16520a | 272 | |
7e99beb3 | 273 | // Choose reader |
db16520a | 274 | |
7e99beb3 | 275 | if (fPackedSwitch) { |
276 | if (rawreadermode == -2) { | |
74c73e5a | 277 | #if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) |
f44e97dc | 278 | HLTDebug("using AliHLTTPCDigitReaderPacked"); |
7e99beb3 | 279 | fReader = new AliHLTTPCDigitReaderPacked(); |
280 | if(oldRCUFormat==1){ | |
281 | fReader->SetOldRCUFormat(kTRUE); | |
282 | } | |
283 | else if(oldRCUFormat!=0){ | |
284 | HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat); | |
285 | } | |
01f43166 | 286 | if(fUnsorted){ |
287 | fReader->SetUnsorted(kTRUE); | |
288 | } | |
7e99beb3 | 289 | fClusterFinder->SetReader(fReader); |
74c73e5a | 290 | #else // ! defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) |
7e99beb3 | 291 | HLTFatal("DigitReaderPacked not available - check your build"); |
292 | return -ENODEV; | |
74c73e5a | 293 | #endif // defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) |
7e99beb3 | 294 | } else { |
db16520a | 295 | #if defined(HAVE_TPC_MAPPING) |
f44e97dc | 296 | HLTDebug("using AliHLTTPCDigitReaderRaw mode %d", rawreadermode); |
7e99beb3 | 297 | fReader = new AliHLTTPCDigitReaderRaw(rawreadermode); |
298 | fClusterFinder->SetReader(fReader); | |
db16520a | 299 | #else //! defined(HAVE_TPC_MAPPING) |
300 | HLTFatal("DigitReaderRaw not available - check your build"); | |
301 | return -ENODEV; | |
302 | #endif //defined(HAVE_TPC_MAPPING) | |
a38a7850 | 303 | } |
7e99beb3 | 304 | } |
305 | else { | |
f44e97dc | 306 | HLTDebug("using AliHLTTPCDigitReaderUnpacked"); |
7e99beb3 | 307 | fReader = new AliHLTTPCDigitReaderUnpacked(); |
308 | fClusterFinder->SetReader(fReader); | |
309 | } | |
310 | ||
311 | // if pp-run use occupancy limit else set to 1. ==> use all | |
312 | if ( !fClusterDeconv ) | |
313 | fClusterFinder->SetOccupancyLimit(occulimit); | |
314 | else | |
315 | fClusterFinder->SetOccupancyLimit(1.0); | |
db16520a | 316 | |
7e99beb3 | 317 | // Variables to setup the Clusterfinder |
318 | // TODO: this sounds strange and has to be verified; is the cluster finder not working when | |
319 | // fClusterDeconv = false ? | |
320 | fClusterDeconv = true; | |
321 | fXYClusterError = -1; | |
322 | fZClusterError = -1; | |
a38a7850 | 323 | |
db16520a | 324 | |
7e99beb3 | 325 | fClusterFinder->SetDeconv( fClusterDeconv ); |
326 | fClusterFinder->SetXYError( fXYClusterError ); | |
327 | fClusterFinder->SetZError( fZClusterError ); | |
328 | if ( (fXYClusterError>0) && (fZClusterError>0) ) | |
329 | fClusterFinder->SetCalcErr( false ); | |
330 | fClusterFinder->SetSignalThreshold(sigthresh); | |
b1c46961 | 331 | fClusterFinder->SetNSigmaThreshold(sigmathresh); |
01f43166 | 332 | if(fUnsorted&&fPatch>-1&&fPatch<6){ |
333 | fPadArray = new AliHLTTPCPadArray(fPatch); | |
334 | fPadArray->InitializeVector(); | |
335 | } | |
336 | ||
7e99beb3 | 337 | return 0; |
338 | } | |
71d7c760 | 339 | |
340 | int AliHLTTPCClusterFinderComponent::DoDeinit() | |
7e99beb3 | 341 | { |
2a083ac4 | 342 | // see header file for class documentation |
a38a7850 | 343 | |
7e99beb3 | 344 | if ( fClusterFinder ) |
345 | delete fClusterFinder; | |
346 | fClusterFinder = NULL; | |
a38a7850 | 347 | |
7e99beb3 | 348 | if ( fReader ) |
349 | delete fReader; | |
350 | fReader = NULL; | |
a38a7850 | 351 | |
7e99beb3 | 352 | return 0; |
353 | } | |
71d7c760 | 354 | |
8ede8717 | 355 | int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, |
356 | const AliHLTComponentBlockData* blocks, | |
5d2abf3b | 357 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, |
a38a7850 | 358 | AliHLTUInt32_t& size, |
8ede8717 | 359 | vector<AliHLTComponentBlockData>& outputBlocks ) |
7e99beb3 | 360 | { |
2a083ac4 | 361 | // see header file for class documentation |
db16520a | 362 | |
7e99beb3 | 363 | // == init iter (pointer to datablock) |
364 | const AliHLTComponentBlockData* iter = NULL; | |
365 | unsigned long ndx; | |
a38a7850 | 366 | |
7e99beb3 | 367 | // == OUTdatatype pointer |
368 | AliHLTTPCClusterData* outPtr; | |
a38a7850 | 369 | |
7e99beb3 | 370 | AliHLTUInt8_t* outBPtr; |
371 | UInt_t offset, mysize, nSize, tSize = 0; | |
a38a7850 | 372 | |
7e99beb3 | 373 | outBPtr = outputPtr; |
374 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
a38a7850 | 375 | |
7e99beb3 | 376 | Int_t slice, patch, row[2]; |
377 | unsigned long maxPoints, realPoints = 0; | |
a38a7850 | 378 | |
7e99beb3 | 379 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
380 | { | |
381 | iter = blocks+ndx; | |
382 | mysize = 0; | |
383 | offset = tSize; | |
a38a7850 | 384 | |
385 | ||
7e99beb3 | 386 | if (fPackedSwitch) { |
387 | char tmp1[14], tmp2[14]; | |
388 | DataType2Text( iter->fDataType, tmp1 ); | |
389 | DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 ); | |
390 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Event received", | |
391 | "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
392 | evtData.fEventID, evtData.fEventID, tmp1, tmp2 ); | |
a38a7850 | 393 | |
7e99beb3 | 394 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue; |
a38a7850 | 395 | |
7e99beb3 | 396 | } |
397 | else { | |
398 | char tmp1[14], tmp2[14]; | |
399 | DataType2Text( iter->fDataType, tmp1 ); | |
400 | DataType2Text( AliHLTTPCDefinitions::fgkUnpackedRawDataType, tmp2 ); | |
401 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Event received", | |
402 | "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
403 | evtData.fEventID, evtData.fEventID, tmp1, tmp2 ); | |
a38a7850 | 404 | |
7e99beb3 | 405 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue; |
a38a7850 | 406 | |
7e99beb3 | 407 | } |
a38a7850 | 408 | |
7e99beb3 | 409 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
410 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
411 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); | |
412 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); | |
71d7c760 | 413 | |
7e99beb3 | 414 | outPtr = (AliHLTTPCClusterData*)outBPtr; |
a38a7850 | 415 | |
01f43166 | 416 | #ifndef KENNETH |
7e99beb3 | 417 | maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData); |
01f43166 | 418 | #else |
419 | maxPoints = (size-tSize-sizeof(AliHLTTPCClusters))/sizeof(AliHLTTPCSpacePointData); | |
420 | #endif | |
db16520a | 421 | |
7e99beb3 | 422 | fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints ); |
e83e889b | 423 | fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints ); |
01f43166 | 424 | |
425 | if(fUnsorted){ | |
426 | ||
427 | ||
428 | fClusterFinder->SetPadArray(fPadArray); | |
429 | ||
430 | double totalT=0; | |
431 | struct timeval startT, endT; | |
432 | gettimeofday( &startT, NULL ); | |
433 | ||
434 | fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize ); | |
435 | ||
436 | gettimeofday( &endT, NULL ); | |
437 | unsigned long long dt; | |
438 | dt = endT.tv_sec-startT.tv_sec; | |
439 | dt *= 1000000ULL; | |
440 | dt += endT.tv_usec-startT.tv_usec; | |
441 | double dtd = ((double)dt); | |
442 | totalT += dtd; | |
443 | // dtd = dtd / (double)eventIterations; | |
444 | // if ( iterations<=1 ) | |
445 | cout<<endl; | |
446 | printf( "Time needed to read data: %f microsec. / %f millisec. / %f s\n", | |
447 | dtd, dtd/1000.0, dtd/1000000.0 ); | |
448 | ||
449 | cout<<endl; | |
450 | fClusterFinder->FindClusters(); | |
451 | } | |
452 | else{ | |
453 | fClusterFinder->Read(iter->fPtr, iter->fSize ); | |
454 | fClusterFinder->ProcessDigits(); | |
455 | } | |
7e99beb3 | 456 | realPoints = fClusterFinder->GetNumberOfClusters(); |
71d7c760 | 457 | |
7e99beb3 | 458 | outPtr->fSpacePointCnt = realPoints; |
459 | nSize = sizeof(AliHLTTPCSpacePointData)*realPoints; | |
01f43166 | 460 | #ifndef KENNETH |
7e99beb3 | 461 | mysize += nSize+sizeof(AliHLTTPCClusterData); |
01f43166 | 462 | #else |
463 | mysize += nSize+sizeof(AliHLTTPCClusters); | |
464 | #endif | |
74511e22 | 465 | |
466 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", | |
7e99beb3 | 467 | "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.", |
468 | realPoints, slice, patch, row[0], row[1] ); | |
469 | AliHLTComponentBlockData bd; | |
470 | FillBlockData( bd ); | |
471 | bd.fOffset = offset; | |
472 | bd.fSize = mysize; | |
473 | bd.fSpecification = iter->fSpecification; | |
474 | //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes ); | |
475 | outputBlocks.push_back( bd ); | |
71d7c760 | 476 | |
7e99beb3 | 477 | tSize += mysize; |
478 | outBPtr += mysize; | |
479 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
71d7c760 | 480 | |
b1c46961 | 481 | if(fGetActivePads){ |
482 | AliHLTTPCPadArray::AliHLTTPCActivePads* outPtrActive; | |
483 | UInt_t activePadsSize, activePadsN = 0; | |
484 | outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr; | |
485 | offset=tSize; | |
486 | Int_t maxActivePads = (size-tSize)/sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads); | |
487 | activePadsSize= fClusterFinder->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)outPtrActive,maxActivePads)*sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads); | |
488 | ||
489 | AliHLTComponentBlockData bdActive; | |
490 | FillBlockData( bdActive ); | |
491 | bdActive.fOffset = offset; | |
492 | bdActive.fSize = activePadsSize; | |
493 | bdActive.fSpecification = iter->fSpecification; | |
494 | bdActive.fDataType = AliHLTTPCDefinitions::fgkActivePadsDataType; | |
495 | outputBlocks.push_back( bdActive ); | |
496 | ||
497 | tSize+=activePadsSize; | |
498 | outBPtr += activePadsSize; | |
499 | outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr; | |
500 | } | |
501 | ||
502 | ||
7e99beb3 | 503 | if ( tSize > size ) |
504 | { | |
505 | Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", | |
506 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
507 | tSize, size ); | |
508 | return EMSGSIZE; | |
71d7c760 | 509 | } |
71d7c760 | 510 | } |
7e99beb3 | 511 | |
512 | size = tSize; | |
71d7c760 | 513 | |
7e99beb3 | 514 | return 0; |
515 | } |