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