]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | ||
3 | //************************************************************************** | |
4 | //* This file is property of and copyright by the ALICE HLT Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* * | |
7 | //* Primary Authors: Timm Steinbeck, Matthias Richter * | |
8 | //* Developers: Kenneth Aamodt <kenneth.aamodt@student.uib.no> * | |
9 | //* for The ALICE HLT Project. * | |
10 | //* * | |
11 | //* Permission to use, copy, modify and distribute this software and its * | |
12 | //* documentation strictly for non-commercial purposes is hereby granted * | |
13 | //* without fee, provided that the above copyright notice appears in all * | |
14 | //* copies and that both the copyright notice and this permission notice * | |
15 | //* appear in the supporting documentation. The authors make no claims * | |
16 | //* about the suitability of this software for any purpose. It is * | |
17 | //* provided "as is" without express or implied warranty. * | |
18 | //************************************************************************** | |
19 | ||
20 | /** @file AliHLTTPCClusterFinderComponent.cxx | |
21 | @author Kenneth Aamodt <kenneth.aamodt@student.uib.no> | |
22 | @date | |
23 | @brief The TPC cluster finder processing component | |
24 | */ | |
25 | ||
26 | #if __GNUC__>= 3 | |
27 | using namespace std; | |
28 | #endif | |
29 | #include "AliHLTTPCClusterFinderComponent.h" | |
30 | #include "AliHLTTPCDigitReaderPacked.h" | |
31 | #include "AliHLTTPCDigitReaderUnpacked.h" | |
32 | #include "AliHLTTPCDigitReaderDecoder.h" | |
33 | #include "AliHLTTPCClusterFinder.h" | |
34 | #include "AliHLTTPCSpacePointData.h" | |
35 | #include "AliHLTTPCClusterDataFormat.h" | |
36 | #include "AliHLTTPCTransform.h" | |
37 | #include "AliHLTTPCClusters.h" | |
38 | #include "AliHLTTPCDefinitions.h" | |
39 | #include "AliCDBEntry.h" | |
40 | #include "AliCDBManager.h" | |
41 | ||
42 | #include <cstdlib> | |
43 | #include <cerrno> | |
44 | #include "TString.h" | |
45 | #include "TObjString.h" | |
46 | #include <sys/time.h> | |
47 | ||
48 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
49 | ClassImp(AliHLTTPCClusterFinderComponent) | |
50 | ||
51 | AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode) | |
52 | : | |
53 | fClusterFinder(NULL), | |
54 | fReader(NULL), | |
55 | fDeconvTime(kFALSE), | |
56 | fDeconvPad(kFALSE), | |
57 | fClusterDeconv(false), | |
58 | fXYClusterError(-1), | |
59 | fZClusterError(-1), | |
60 | fModeSwitch(mode), | |
61 | fUnsorted(1), | |
62 | fPatch(0), | |
63 | fGetActivePads(0), | |
64 | fFirstTimeBin(-1), | |
65 | fLastTimeBin(-1) | |
66 | { | |
67 | // see header file for class documentation | |
68 | // or | |
69 | // refer to README to build package | |
70 | // or | |
71 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
72 | } | |
73 | ||
74 | AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent() | |
75 | { | |
76 | // see header file for class documentation | |
77 | } | |
78 | ||
79 | // Public functions to implement AliHLTComponent's interface. | |
80 | // These functions are required for the registration process | |
81 | ||
82 | const char* AliHLTTPCClusterFinderComponent::GetComponentID() | |
83 | { | |
84 | // see header file for class documentation | |
85 | switch(fModeSwitch){ | |
86 | case kClusterFinderPacked: | |
87 | return "TPCClusterFinderPacked"; | |
88 | break; | |
89 | case kClusterFinderUnpacked: | |
90 | return "TPCClusterFinderUnpacked"; | |
91 | break; | |
92 | case kClusterFinderDecoder: | |
93 | return "TPCClusterFinderDecoder"; | |
94 | break; | |
95 | } | |
96 | HLTFatal("unknown digit reader type"); | |
97 | return ""; | |
98 | } | |
99 | ||
100 | void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
101 | { | |
102 | // see header file for class documentation | |
103 | list.clear(); | |
104 | switch(fModeSwitch){ | |
105 | case kClusterFinderPacked: | |
106 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); | |
107 | break; | |
108 | case kClusterFinderUnpacked: | |
109 | list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType ); | |
110 | break; | |
111 | case kClusterFinderDecoder: | |
112 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); | |
113 | break; | |
114 | } | |
115 | } | |
116 | ||
117 | AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType() | |
118 | { | |
119 | // see header file for class documentation | |
120 | return kAliHLTMultipleDataType; | |
121 | } | |
122 | ||
123 | int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
124 | ||
125 | { | |
126 | // see header file for class documentation | |
127 | tgtList.clear(); | |
128 | tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType); | |
129 | tgtList.push_back(kAliHLTDataTypeHwAddr16); | |
130 | return tgtList.size(); | |
131 | } | |
132 | ||
133 | void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
134 | { | |
135 | // see header file for class documentation | |
136 | // XXX TODO: Find more realistic values. | |
137 | constBase = 0; | |
138 | switch(fModeSwitch){ | |
139 | case 0: | |
140 | inputMultiplier = (6 * 0.4); | |
141 | break; | |
142 | case 1: | |
143 | inputMultiplier = 0.4; | |
144 | break; | |
145 | case 2: | |
146 | inputMultiplier = (6 * 0.4); | |
147 | break; | |
148 | } | |
149 | } | |
150 | ||
151 | AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn() | |
152 | { | |
153 | // see header file for class documentation | |
154 | return new AliHLTTPCClusterFinderComponent(fModeSwitch); | |
155 | } | |
156 | ||
157 | int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv ) | |
158 | { | |
159 | // see header file for class documentation | |
160 | if ( fClusterFinder ) | |
161 | return EINPROGRESS; | |
162 | ||
163 | fClusterFinder = new AliHLTTPCClusterFinder(); | |
164 | ||
165 | // Int_t sigthresh = -1; | |
166 | // Double_t sigmathresh= -1; | |
167 | Float_t occulimit = 1.0; | |
168 | // Int_t oldRCUFormat=0; | |
169 | // Data Format version numbers: | |
170 | // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word. | |
171 | // 1: As 0, but pads/padrows are delivered "as is", without sorting | |
172 | // 2: As 0, but RCU trailer is 3 32 bit words. | |
173 | // 3: As 1, but RCU trailer is 3 32 bit words. | |
174 | // -1: use offline raw reader | |
175 | ||
176 | Int_t i = 0; | |
177 | Char_t* cpErr; | |
178 | ||
179 | while ( i < argc ) { | |
180 | ||
181 | ||
182 | ||
183 | // -- deconvolute-time option | |
184 | if ( !strcmp( argv[i], "-deconvolute-time" ) ) { | |
185 | fDeconvTime = kTRUE; | |
186 | i++; | |
187 | continue; | |
188 | } | |
189 | ||
190 | // -- deconvolute-pad option | |
191 | if ( !strcmp( argv[i], "-deconvolute-pad" ) ) { | |
192 | fDeconvPad = kTRUE; | |
193 | i++; | |
194 | continue; | |
195 | } | |
196 | ||
197 | // -- number of timebins (default 1024) | |
198 | if (!strcmp( argv[i], "-timebins") || !strcmp( argv[i], "timebins" )){ | |
199 | TString parameter(argv[i+1]); | |
200 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
201 | if (parameter.IsDigit()) { | |
202 | AliHLTTPCTransform::SetNTimeBins(parameter.Atoi()); | |
203 | HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth()); | |
204 | fClusterFinder->UpdateLastTimeBin(); | |
205 | } else { | |
206 | HLTError("Cannot timebin specifier '%s'.", argv[i+1]); | |
207 | return EINVAL; | |
208 | } | |
209 | if(!strcmp( argv[i], "timebins")){ | |
210 | HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway."); | |
211 | } | |
212 | i+=2; | |
213 | continue; | |
214 | } | |
215 | ||
216 | // -first-timebin (default 0) | |
217 | if ( !strcmp( argv[i], "-first-timebin" ) ) { | |
218 | TString parameter(argv[i+1]); | |
219 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
220 | if (parameter.IsDigit()){ | |
221 | fFirstTimeBin=parameter.Atoi(); | |
222 | HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin); | |
223 | } | |
224 | else { | |
225 | HLTError("Cannot -first-timebin specifier '%s'. Not a number.", argv[i+1]); | |
226 | return EINVAL; | |
227 | } | |
228 | i+=2; | |
229 | continue; | |
230 | } | |
231 | ||
232 | // -last-timebin (default 1024) | |
233 | if ( !strcmp( argv[i], "-last-timebin" ) ) { | |
234 | TString parameter(argv[i+1]); | |
235 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
236 | if (parameter.IsDigit()){ | |
237 | fLastTimeBin=parameter.Atoi(); | |
238 | HLTDebug("fLastTimeBin set to %d",fLastTimeBin); | |
239 | } | |
240 | else { | |
241 | HLTError("Cannot -last-timebin specifier '%s'. Not a number.", argv[i+1]); | |
242 | return EINVAL; | |
243 | } | |
244 | i+=2; | |
245 | continue; | |
246 | } | |
247 | ||
248 | // -- unsorted option | |
249 | if ( !strcmp( argv[i], "-sorted" ) ) { | |
250 | fUnsorted=0; | |
251 | i++; | |
252 | continue; | |
253 | } | |
254 | ||
255 | ||
256 | // -- checking for active pads, used in 2007 December run | |
257 | if ( !strcmp( argv[i], "-active-pads" ) || !strcmp( argv[i], "activepads" ) ) { | |
258 | if(!strcmp( argv[i], "activepads" )){ | |
259 | HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'active-pads'"); | |
260 | } | |
261 | fGetActivePads = strtoul( argv[i+1], &cpErr ,0); | |
262 | if ( *cpErr ){ | |
263 | HLTError("Cannot convert activepads specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
264 | return EINVAL; | |
265 | } | |
266 | i+=2; | |
267 | continue; | |
268 | } | |
269 | ||
270 | // -- pad occupancy limit | |
271 | if ( !strcmp( argv[i], "-occupancy-limit" ) || !strcmp( argv[i], "occupancy-limit" ) ) { | |
272 | if(!strcmp( argv[i], "occupancy-limit" )){ | |
273 | HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'"); | |
274 | } | |
275 | occulimit = strtod( argv[i+1], &cpErr); | |
276 | if ( *cpErr ) { | |
277 | HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]); | |
278 | return EINVAL; | |
279 | } | |
280 | if(fModeSwitch!=kClusterFinderPacked){ | |
281 | HLTWarning("Argument '-occupancy-limit' is only used with -sorted set and with the TPCClusterFinderPacked , argument is deprecated"); | |
282 | } | |
283 | i+=2; | |
284 | continue; | |
285 | } | |
286 | ||
287 | ||
288 | // -- raw reader mode option | |
289 | if ( !strcmp( argv[i], "rawreadermode" ) ) { | |
290 | if ( argc <= i+1 ) { | |
291 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified. rawreadermode is no longer a valid argument and will be deprecated even if rawreadermode is specified." ); | |
292 | return ENOTSUP; | |
293 | } | |
294 | ||
295 | HLTWarning("Argument 'rawreadermode' is deprecated"); | |
296 | ||
297 | i += 2; | |
298 | continue; | |
299 | } | |
300 | ||
301 | ||
302 | // -- pp-run option | |
303 | if ( !strcmp( argv[i], "pp-run") ) { | |
304 | HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default."); | |
305 | fClusterDeconv = false; | |
306 | i++; | |
307 | continue; | |
308 | } | |
309 | ||
310 | // -- zero suppression threshold | |
311 | if ( !strcmp( argv[i], "adc-threshold" ) ) { | |
312 | strtoul( argv[i+1], &cpErr ,0); | |
313 | if ( *cpErr ) { | |
314 | HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]); | |
315 | return EINVAL; | |
316 | } | |
317 | HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data."); | |
318 | i+=2; | |
319 | continue; | |
320 | } | |
321 | ||
322 | ||
323 | // -- checking for rcu format | |
324 | if ( !strcmp( argv[i], "oldrcuformat" ) ) { | |
325 | strtoul( argv[i+1], &cpErr ,0); | |
326 | if ( *cpErr ){ | |
327 | HLTError("Cannot convert oldrcuformat specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
328 | return EINVAL; | |
329 | } | |
330 | HLTWarning("Argument 'oldrcuformat' is deprecated."); | |
331 | i+=2; | |
332 | continue; | |
333 | } | |
334 | ||
335 | // -- checking for unsorted clusterfinding (default 1) | |
336 | if ( !strcmp( argv[i], "unsorted" ) ) { | |
337 | fUnsorted = strtoul( argv[i+1], &cpErr ,0); | |
338 | if ( *cpErr ){ | |
339 | HLTError("Cannot convert unsorted specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
340 | return EINVAL; | |
341 | } | |
342 | HLTWarning("Argument 'unsorted' is old and does not follow the new argument naming convention. A change has been made, and the clusterfinder will read the data unsorted by default. For sorted reading, please use '-sorted' as argument. (unsorted 0 will do the same job, but please change anyway.)"); | |
343 | i+=2; | |
344 | continue; | |
345 | } | |
346 | ||
347 | // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression | |
348 | if ( !strcmp( argv[i], "nsigma-threshold" ) ) { | |
349 | strtoul( argv[i+1], &cpErr ,0); | |
350 | if ( *cpErr ){ | |
351 | HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]); | |
352 | return EINVAL; | |
353 | } | |
354 | i+=2; | |
355 | HLTWarning("Argument 'nsigma-threshold' argument is obsolete."); | |
356 | continue; | |
357 | } | |
358 | ||
359 | Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); | |
360 | return EINVAL; | |
361 | ||
362 | } | |
363 | ||
364 | //Checking for conflicting arguments | |
365 | if(fClusterDeconv){ | |
366 | if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){ | |
367 | HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored."); | |
368 | } | |
369 | } | |
370 | if(occulimit!=1.0 && fUnsorted){ | |
371 | HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading."); | |
372 | } | |
373 | if(fGetActivePads==kTRUE && fUnsorted==kFALSE){ | |
374 | HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced."); | |
375 | } | |
376 | ||
377 | ||
378 | // Choose reader | |
379 | if (fModeSwitch==kClusterFinderPacked) { | |
380 | HLTDebug("using AliHLTTPCDigitReaderPacked"); | |
381 | fReader = new AliHLTTPCDigitReaderPacked(); | |
382 | /* | |
383 | if(oldRCUFormat==1){ | |
384 | fReader->SetOldRCUFormat(kTRUE); | |
385 | } | |
386 | else if(oldRCUFormat!=0){ | |
387 | HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat); | |
388 | } | |
389 | */ | |
390 | if(fUnsorted==1){ | |
391 | fReader->SetUnsorted(kTRUE); | |
392 | } | |
393 | fClusterFinder->SetReader(fReader); | |
394 | } | |
395 | else if(fModeSwitch==kClusterFinderUnpacked){ | |
396 | HLTDebug("using AliHLTTPCDigitReaderUnpacked"); | |
397 | fReader = new AliHLTTPCDigitReaderUnpacked(); | |
398 | fClusterFinder->SetReader(fReader); | |
399 | } | |
400 | else if(fModeSwitch==kClusterFinderDecoder){ | |
401 | HLTDebug("using AliHLTTPCDigitReaderDecoder"); | |
402 | fReader = new AliHLTTPCDigitReaderDecoder(); | |
403 | fClusterFinder->SetReader(fReader); | |
404 | } | |
405 | else{ | |
406 | HLTFatal("No mode set for clusterfindercomponent"); | |
407 | } | |
408 | // if pp-run use occupancy limit else set to 1. ==> use all | |
409 | if ( !fClusterDeconv ) | |
410 | fClusterFinder->SetOccupancyLimit(occulimit); | |
411 | else | |
412 | fClusterFinder->SetOccupancyLimit(1.0); | |
413 | ||
414 | ||
415 | fClusterFinder->SetDeconv(fClusterDeconv); | |
416 | fClusterFinder->SetDeconvPad(fDeconvPad); | |
417 | fClusterFinder->SetDeconvTime(fDeconvPad); | |
418 | fClusterFinder->SetXYError( fXYClusterError ); | |
419 | fClusterFinder->SetZError( fZClusterError ); | |
420 | if ( (fXYClusterError>0) && (fZClusterError>0) ){ | |
421 | fClusterFinder->SetCalcErr( false ); | |
422 | } | |
423 | // fClusterFinder->SetSignalThreshold(sigthresh); | |
424 | // fClusterFinder->SetNSigmaThreshold(sigmathresh); | |
425 | ||
426 | if(fFirstTimeBin>0){ | |
427 | fClusterFinder->SetFirstTimeBin(fFirstTimeBin); | |
428 | } | |
429 | if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){ | |
430 | fClusterFinder->SetLastTimeBin(fLastTimeBin); | |
431 | } | |
432 | ||
433 | return 0; | |
434 | } | |
435 | ||
436 | int AliHLTTPCClusterFinderComponent::DoDeinit() | |
437 | { | |
438 | // see header file for class documentation | |
439 | ||
440 | if ( fClusterFinder ) | |
441 | delete fClusterFinder; | |
442 | fClusterFinder = NULL; | |
443 | ||
444 | if ( fReader ) | |
445 | delete fReader; | |
446 | fReader = NULL; | |
447 | ||
448 | return 0; | |
449 | } | |
450 | ||
451 | int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, | |
452 | const AliHLTComponentBlockData* blocks, | |
453 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, | |
454 | AliHLTUInt32_t& size, | |
455 | vector<AliHLTComponentBlockData>& outputBlocks ) | |
456 | { | |
457 | // see header file for class documentation | |
458 | ||
459 | if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){ | |
460 | size=0; | |
461 | return 0; | |
462 | } | |
463 | ||
464 | // == init iter (pointer to datablock) | |
465 | const AliHLTComponentBlockData* iter = NULL; | |
466 | unsigned long ndx; | |
467 | ||
468 | // == OUTdatatype pointer | |
469 | AliHLTTPCClusterData* outPtr; | |
470 | ||
471 | AliHLTUInt8_t* outBPtr; | |
472 | UInt_t offset, mysize, nSize, tSize = 0; | |
473 | ||
474 | outBPtr = outputPtr; | |
475 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
476 | ||
477 | Int_t slice, patch, row[2]; | |
478 | unsigned long maxPoints, realPoints = 0; | |
479 | ||
480 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
481 | { | |
482 | iter = blocks+ndx; | |
483 | mysize = 0; | |
484 | offset = tSize; | |
485 | ||
486 | ||
487 | if (fModeSwitch==0 || fModeSwitch==2) { | |
488 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
489 | evtData.fEventID, evtData.fEventID, | |
490 | DataType2Text( iter->fDataType).c_str(), | |
491 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
492 | ||
493 | if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && | |
494 | GetEventCount()<2) { | |
495 | HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", | |
496 | DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(), | |
497 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
498 | } | |
499 | ||
500 | if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) && | |
501 | iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue; | |
502 | ||
503 | } | |
504 | else if(fModeSwitch==1){ | |
505 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
506 | evtData.fEventID, evtData.fEventID, | |
507 | DataType2Text( iter->fDataType).c_str(), | |
508 | DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str()); | |
509 | ||
510 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue; | |
511 | ||
512 | } | |
513 | ||
514 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); | |
515 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
516 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); | |
517 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); | |
518 | ||
519 | ||
520 | if(fUnsorted){ | |
521 | fClusterFinder->SetUnsorted(fUnsorted); | |
522 | fClusterFinder->SetPatch(patch); | |
523 | } | |
524 | ||
525 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
526 | ||
527 | maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData); | |
528 | ||
529 | fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints ); | |
530 | fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints ); | |
531 | ||
532 | if(fUnsorted){ | |
533 | if(fGetActivePads){ | |
534 | fClusterFinder->SetDoPadSelection(kTRUE); | |
535 | } | |
536 | ||
537 | if(fDeconvTime){ | |
538 | fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize); | |
539 | } | |
540 | else{ | |
541 | fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize); | |
542 | } | |
543 | ||
544 | fClusterFinder->FindClusters(); | |
545 | } | |
546 | else{ | |
547 | fClusterFinder->Read(iter->fPtr, iter->fSize ); | |
548 | fClusterFinder->ProcessDigits(); | |
549 | } | |
550 | realPoints = fClusterFinder->GetNumberOfClusters(); | |
551 | ||
552 | outPtr->fSpacePointCnt = realPoints; | |
553 | nSize = sizeof(AliHLTTPCSpacePointData)*realPoints; | |
554 | mysize += nSize+sizeof(AliHLTTPCClusterData); | |
555 | ||
556 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", | |
557 | "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.", | |
558 | realPoints, slice, patch, row[0], row[1] ); | |
559 | AliHLTComponentBlockData bd; | |
560 | FillBlockData( bd ); | |
561 | bd.fOffset = offset; | |
562 | bd.fSize = mysize; | |
563 | bd.fSpecification = iter->fSpecification; | |
564 | bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType; | |
565 | //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes ); | |
566 | outputBlocks.push_back( bd ); | |
567 | ||
568 | tSize += mysize; | |
569 | outBPtr += mysize; | |
570 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
571 | ||
572 | ||
573 | if ( tSize > size ) | |
574 | { | |
575 | Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", | |
576 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
577 | tSize, size ); | |
578 | return EMSGSIZE; | |
579 | } | |
580 | ||
581 | if(fUnsorted && fGetActivePads){ | |
582 | Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1); | |
583 | AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize); | |
584 | Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW); | |
585 | ||
586 | //cout<<"Number of hardwareaddresses: "<<nHWAdd<<endl; | |
587 | for(AliHLTUInt16_t test=0;test<nHWAdd;test++){ | |
588 | //cout<<"The HW address is: "<<(AliHLTUInt16_t)outputHWPtr[test]<<endl; | |
589 | } | |
590 | AliHLTComponentBlockData bdHW; | |
591 | FillBlockData( bdHW ); | |
592 | bdHW.fOffset = tSize ; | |
593 | bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t); | |
594 | bdHW.fSpecification = iter->fSpecification; | |
595 | bdHW.fDataType = kAliHLTDataTypeHwAddr16; | |
596 | outputBlocks.push_back( bdHW ); | |
597 | ||
598 | tSize+=nHWAdd*sizeof(AliHLTUInt16_t); | |
599 | } | |
600 | } | |
601 | ||
602 | size = tSize; | |
603 | ||
604 | return 0; | |
605 | } | |
606 | ||
607 | int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
608 | { | |
609 | // see header file for class documentation | |
610 | const char* path="HLT/ConfigTPC"; | |
611 | if (cdbEntry) path=cdbEntry; | |
612 | if (path) { | |
613 | HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
614 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
615 | if (pEntry) { | |
616 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
617 | if (pString) { | |
618 | HLTInfo("received configuration object: %s", pString->GetString().Data()); | |
619 | } else { | |
620 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
621 | } | |
622 | } else { | |
623 | HLTError("can not fetch object \"%s\" from CDB", path); | |
624 | } | |
625 | } | |
626 | return 0; | |
627 | } |