removing old CF configurations, ids redirected to HWCF; global tracking option enable...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDataPublisherComponent.cxx
CommitLineData
686d5523 1// $Id$
2//**************************************************************************
f652dd4a 3//* This file is property of and copyright by the *
686d5523 4//* ALICE Experiment at CERN, All rights reserved. *
5//* *
6//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
686d5523 7//* *
8//* Permission to use, copy, modify and distribute this software and its *
9//* documentation strictly for non-commercial purposes is hereby granted *
10//* without fee, provided that the above copyright notice appears in all *
11//* copies and that both the copyright notice and this permission notice *
12//* appear in the supporting documentation. The authors make no claims *
13//* about the suitability of this software for any purpose. It is *
14//* provided "as is" without express or implied warranty. *
15//**************************************************************************
16
d60d120c 17/// @file AliHLTTPCDataPublisherComponent.cxx
686d5523 18/// @author Matthias Richter
19/// @date 2011-08-08
20/// @brief
21///
22
d60d120c 23#include "AliHLTTPCDataPublisherComponent.h"
686d5523 24#include "AliHLTTPCDefinitions.h"
f652dd4a 25#include "AliHLTTPCTransform.h"
26#include "AliHLTTPCClusterMCData.h"
27#include "AliHLTTPCDataCompressionDecoder.h"
686d5523 28#include "AliHLTPluginBase.h"
29#include "AliHLTSystem.h"
30#include "AliHLTOUT.h"
f652dd4a 31#include "AliHLTDAQ.h"
32#include "AliHLTTemplates.h"
686d5523 33#include "AliLog.h"
34#include <vector>
f652dd4a 35#include <memory>
36#include <algorithm>
686d5523 37
d60d120c 38ClassImp(AliHLTTPCDataPublisherComponent)
686d5523 39
d60d120c 40AliHLTTPCDataPublisherComponent::AliHLTTPCDataPublisherComponent()
686d5523 41 : AliHLTRawReaderPublisherComponent()
42 , fArraySelected(NULL)
f652dd4a 43 , fClusters(NULL)
44 , fpDecoder(NULL)
686d5523 45{
f652dd4a 46 /// constructor
686d5523 47}
48
d60d120c 49AliHLTTPCDataPublisherComponent::~AliHLTTPCDataPublisherComponent()
686d5523 50{
51 /// destructor
f652dd4a 52 if (fpDecoder) delete fpDecoder;
53 fpDecoder=NULL;
686d5523 54}
55
56
d60d120c 57const char* AliHLTTPCDataPublisherComponent::GetComponentID()
686d5523 58{
59 /// inherited from AliHLTComponent: id of the component
f652dd4a 60 return "TPCDataPublisher";
686d5523 61}
62
d60d120c 63AliHLTComponent* AliHLTTPCDataPublisherComponent::Spawn()
686d5523 64{
65 /// inherited from AliHLTComponent: spawn function.
d60d120c 66 return new AliHLTTPCDataPublisherComponent;
686d5523 67}
68
d60d120c 69int AliHLTTPCDataPublisherComponent::GetEvent(const AliHLTComponentEventData& evtData,
686d5523 70 AliHLTComponentTriggerData& trigData,
71 AliHLTUInt8_t* outputPtr,
72 AliHLTUInt32_t& size,
f652dd4a 73 AliHLTComponentBlockDataList& outputBlocks)
686d5523 74{
75 /// inherited from AliHLTProcessor: data processing
76 if (!IsDataEvent()) return 0;
77
f652dd4a 78 int iResult=0;
686d5523 79
f652dd4a 80 AliHLTComponentBlockDataList clusterBlocks;
81 AliHLTUInt32_t offset=0;
82 AliHLTUInt32_t capacity=size;
83 size=0;
84 if (fClusters) {
85 fClusters->Clear();
86 fClusters->SetTargetBuffer(outputPtr+offset, capacity-offset);
87 if ((iResult=ReadClusterFromHLTOUT(fClusters))>=0) {
88 if ((iResult=fClusters->GetState())>=0) {
89 if (fClusters->CopyBlockDescriptors(clusterBlocks)>0) {
90 for (AliHLTComponentBlockDataList::const_iterator bd=clusterBlocks.begin();
91 bd!=clusterBlocks.end(); bd++) {
92 if (offset<bd->fOffset+bd->fSize)
93 offset=bd->fOffset+bd->fSize;
94 }
95 }
96 } else if (iResult==-ENOSPC) {
97 offset=fClusters->GetBlockCount()*sizeof(AliHLTTPCRawClusterData)+
98 fClusters->GetClusterCount()*sizeof(AliHLTTPCRawCluster);
99 iResult=0; // keep going to also accumulate the size for raw data blocks
100 }
101 }
102 if (iResult==-ENODATA) {
103 // return indicates absense of compressed clusters in HLTOUT
104 // but is not treated as an error further downstream
105 iResult=0;
106 }
107 }
108
109 if (offset<=capacity) {
110 size=capacity-offset;
111 outputPtr+=offset;
112 } else {
113 // there is clearly not enough space, keep the full buffer to
114 // publish the raw data blocks and determine the size of those
115 // data will be overwritten
116 size=capacity;
117 }
118 if (iResult>=0) {
119 iResult=AliHLTRawReaderPublisherComponent::GetEvent(evtData, trigData, outputPtr, size, outputBlocks);
120 if (iResult==-ENOSPC) {
121 // not enough space in the buffer, fMaxSize has been updated by base class
122 fMaxSize+=offset;
123 } else if (iResult>=0) {
124 // correct for the shifted buffer which was provided to the
125 // GetEvent method
126 for (AliHLTComponentBlockDataList::iterator bd=outputBlocks.begin();
127 bd!=outputBlocks.end(); bd++) {
128 bd->fOffset+=offset;
129 }
130 offset+=size;
131 }
132 }
133
134 if (iResult>=0 && capacity<offset && fMaxSize<(int)offset) {
135 // update the size requirement
136 fMaxSize=offset;
137 outputBlocks.clear();
138 iResult=-ENOSPC;
139 }
140
141 if (iResult>=0) {
142 size=offset;
143 outputBlocks.insert(outputBlocks.begin(), clusterBlocks.begin(), clusterBlocks.end());
144 }
145
146 return iResult;
686d5523 147}
148
d60d120c 149int AliHLTTPCDataPublisherComponent::ReadClusterFromHLTOUT(AliHLTTPCDataPublisherComponent::AliRawClusterContainer* pContainer)
686d5523 150{
151 // check the HLTOUT for availability of compressed data blocks
f652dd4a 152 int iResult=0;
686d5523 153 AliHLTSystem* pSystem=AliHLTPluginBase::GetInstance();
154 if (!pSystem) {
155 // global system not initialized
156 return -ENODEV;
157 }
158 AliHLTOUT* pHLTOUT=pSystem->RequestHLTOUT();
159 if (!pHLTOUT) {
160 // not HLTOUT, hence not clusters
161 return 0;
162 }
163
f652dd4a 164 if (!fpDecoder) {
165 fpDecoder=new AliHLTTPCDataCompressionDecoder;
166 }
167
168 if (!fpDecoder) {
169 AliError("failed to create decoder instance");
170 return -ENODEV;
171 }
172
173 AliHLTTPCDataCompressionDecoder& decoder=*fpDecoder;
174 decoder.Clear();
175 decoder.SetVerbosity(GetVerbosity());
176 decoder.EnableClusterMerger();
177
178 bool bNextBlock=false;
179 // add cluster id and mc information data blocks
180 for (bNextBlock=(pHLTOUT->SelectFirstDataBlock()>=0);
686d5523 181 bNextBlock; bNextBlock=(pHLTOUT->SelectNextDataBlock()>=0)) {
f652dd4a 182 AliHLTComponentBlockData desc;
183 if ((iResult=pHLTOUT->GetDataBuffer(desc))<0) {
686d5523 184 continue;
f652dd4a 185 }
186 if (desc.fDataType==AliHLTTPCDefinitions::AliHLTDataTypeClusterMCInfo()) {
187 // add mc information
188 if ((iResult=decoder.AddClusterMCData(&desc))<0) {
189 return iResult;
190 }
191 }
192 if (desc.fDataType==AliHLTTPCDefinitions::RemainingClusterIdsDataType() ||
193 desc.fDataType==AliHLTTPCDefinitions::ClusterIdTracksDataType()) {
194 // add cluster ids
195 if ((iResult=decoder.AddClusterIds(&desc))<0) {
196 return iResult;
197 }
198 }
686d5523 199 }
200
f652dd4a 201 bool bHavePartitionRawData=false;
202 bool bHavePartitionCompressedData=false;
203 vector<bool> bHavePartitionData(216, false);
204
205 // read data
206 iResult=-ENODATA;
207 int nExtractedClusters=0;
208 for (bNextBlock=(pHLTOUT->SelectFirstDataBlock()>=0);
686d5523 209 bNextBlock; bNextBlock=(pHLTOUT->SelectNextDataBlock()>=0)) {
f652dd4a 210 decoder.SetPadShift(0.0);
211 AliHLTComponentBlockData desc;
212 if ((iResult=pHLTOUT->GetDataBuffer(desc))<0) {
213 continue;
214 }
215 if (desc.fDataType==AliHLTTPCDefinitions::RawClustersDataType()) {
216 // This is a special handling of data blocks produced with v5-01-Release
217 // The pad shift by 0.5 was not included in the data but was applied in the
218 // unpacking in this class. Changed in r51306, the next tag containing this
219 // change in the online system is v5-01-Rev-07. There are only very few runs
220 // of Sep 2011 with recorded clusters not containing the 0.5 shift
221 // There was also a chenge in the data type of the compressed partition
222 // cluster blocks which helps to identify the blocks which need the pad shift
223 // here
224 if (desc.fSize<sizeof(AliHLTTPCRawClusterData)) continue;
225 const AliHLTTPCRawClusterData* clusterData = reinterpret_cast<const AliHLTTPCRawClusterData*>(desc.fPtr);
226 if (!clusterData) continue;
227 if (clusterData->fVersion==1) {
228 // compressed clusters without the pad shift
229 // no raw clusters (version==0) have ever been recorded
230 decoder.SetPadShift(0.5);
231 }
232 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(desc.fSpecification);
233 AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(desc.fSpecification);
234 if (slice!=AliHLTTPCDefinitions::GetMaxSliceNr(desc.fSpecification) ||
235 partition!=AliHLTTPCDefinitions::GetMaxPatchNr(desc.fSpecification)) {
236 AliFatal(Form("inconsistent cluster data: can not handle blocks containing multiple partitions, "
237 "block specification 0x%08x", desc.fSpecification));
238 }
239 iResult=decoder.ReadClustersPartition(pContainer->BeginRemainingClusterBlock(0, desc.fSpecification),
240 reinterpret_cast<AliHLTUInt8_t*>(desc.fPtr),
241 desc.fSize,
242 desc.fSpecification);
243 if (iResult>=0) nExtractedClusters+=iResult;
244 else {
245 AliFatal(Form("processing of cluster block 0x%08x failed with error code %d", desc.fSpecification, iResult));
246 }
247 unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition;
248 if (index>=bHavePartitionData.size()) bHavePartitionData.resize(index, false);
249 if (bHavePartitionData[index]) {
250 AliFatal(Form("inconsistent cluster data: multiple data blocks of identical specification indicate a failure "
251 "in the production of the data. Probably an HLT emulation chain is executed in the reconstruction "
252 "and produces data in addition to HLTOUT. Option 'ignore-hltout' is required in that case; "
253 "block specification 0x%08x", desc.fSpecification));
254 }
255 bHavePartitionData[index]=true;
256 if (bHavePartitionCompressedData) {
257 AliFatal(Form("inconsistent cluster data: both compressed and raw cluster blocks present in HLTOUT, indicates a failure "
258 "in the production of the data. Probably an HLT emulation chain is executed in the reconstruction "
259 "and produces data in addition to HLTOUT. Option 'ignore-hltout' is required in that case; "
260 "block specification 0x%08x", desc.fSpecification));
261 }
262 bHavePartitionRawData=true;
263 continue;
264 } else if (desc.fDataType==AliHLTTPCDefinitions::RemainingClustersCompressedDataType()) {
265 AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(desc.fSpecification);
266 AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(desc.fSpecification);
267 if (slice!=AliHLTTPCDefinitions::GetMaxSliceNr(desc.fSpecification) ||
268 partition!=AliHLTTPCDefinitions::GetMaxPatchNr(desc.fSpecification)) {
269 AliFatal(Form("inconsistent cluster data: can not handle blocks containing multiple partitions, "
270 "block specification 0x%08x", desc.fSpecification));
271 }
272 iResult=decoder.ReadClustersPartition(pContainer->BeginRemainingClusterBlock(0, desc.fSpecification),
273 reinterpret_cast<AliHLTUInt8_t*>(desc.fPtr),
274 desc.fSize,
275 desc.fSpecification);
276 if (iResult>0) nExtractedClusters+=iResult;
277 unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition;
278 if (index>=bHavePartitionData.size()) bHavePartitionData.resize(index, false);
279 if (bHavePartitionData[index]) {
280 AliFatal(Form("inconsistent cluster data: multiple data blocks of identical specification indicate a failure "
281 "in the production of the data. Probably an HLT emulation chain is executed in the reconstruction "
282 "and produces data in addition to HLTOUT. Option 'ignore-hltout' is required in that case; "
283 "block specification 0x%08x", desc.fSpecification));
284 }
285 bHavePartitionData[index]=true;
286 bHavePartitionData[index]=true;
287 if (bHavePartitionRawData) {
288 AliFatal(Form("inconsistent cluster data: both compressed and raw cluster blocks present in HLTOUT, indicates a failure "
289 "in the production of the data. Probably an HLT emulation chain is executed in the reconstruction "
290 "and produces data in addition to HLTOUT. Option 'ignore-hltout' is required in that case; "
291 "block specification 0x%08x", desc.fSpecification));
292 }
293 bHavePartitionCompressedData=true;
294 continue;
295 } else if (desc.fDataType==AliHLTTPCDefinitions::ClusterTracksCompressedDataType()) {
296 iResult=decoder.ReadTrackModelClustersCompressed(pContainer->BeginTrackModelClusterBlock(0),
297 reinterpret_cast<AliHLTUInt8_t*>(desc.fPtr),
298 desc.fSize,
299 desc.fSpecification);
300 continue;
301 }
686d5523 302 }
f652dd4a 303
304 pSystem->ReleaseHLTOUT(pHLTOUT);
686d5523 305
f652dd4a 306 if (iResult<0) return iResult;
307 return nExtractedClusters;
686d5523 308}
309
d60d120c 310int AliHLTTPCDataPublisherComponent::DoInit( int argc, const char** argv )
686d5523 311{
312 /// inherited from AliHLTComponent: component initialisation and argument scan.
313 int iResult=0;
314
315 // component configuration
316 //Stage 1: default initialization.
f652dd4a 317 const char* defaultArguments="-detector TPC -datatype 'DDL_RAW ' 'TPC '";
318 if ((iResult = ConfigureFromArgumentString(1, &defaultArguments)) < 0)
319 return iResult;
686d5523 320
321 //Stage 2: OCDB. - disabled
322 //TString cdbPath("HLT/ConfigTPC/");
323 //cdbPath += GetComponentID();
324 //
325 //iResult = ConfigureFromCDBTObjString(cdbPath);
326 //if (iResult < 0)
327 // return iResult;
328
329 //Stage 3: command line arguments.
330 if (argc && (iResult = ConfigureFromArgumentString(argc, argv)) < 0)
331 return iResult;
f652dd4a 332 if ((iResult=AliHLTRawReaderPublisherComponent::DoInit(0, NULL))<0)
333 return iResult;
334
335 auto_ptr<AliRawClusterContainer> container(new AliRawClusterContainer);
336 if (!container.get()) return -ENOMEM;
337
338 fClusters=container.release();
686d5523 339
340 return iResult;
341}
342
d60d120c 343int AliHLTTPCDataPublisherComponent::DoDeinit()
686d5523 344{
345 /// inherited from AliHLTComponent: component cleanup
346 int iResult=0;
347
f652dd4a 348 if (fpDecoder) delete fpDecoder;
349 fpDecoder=NULL;
350
686d5523 351 return iResult;
352}
353
d60d120c 354int AliHLTTPCDataPublisherComponent::ScanConfigurationArgument(int argc, const char** argv)
686d5523 355{
356 /// inherited from AliHLTComponent: argument scan
686d5523 357 if (argc<1) return 0;
f652dd4a 358 // int bMissingParam=0;
359 // int i=0;
360 // TString argument=argv[i];
686d5523 361
362 do {
f652dd4a 363 // currently no specific parameters
686d5523 364
365 } while (0); // using do-while only to have break available
366
f652dd4a 367 return AliHLTRawReaderPublisherComponent::ScanConfigurationArgument(argc, argv);
686d5523 368}
369
d60d120c 370int AliHLTTPCDataPublisherComponent::GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const
686d5523 371{
372 /// inherited from AliHLTRawReaderPublisherComponent: get specification
373
374 // FIXME: add common functionality to AliHLTDAQ
375 int partition;
376 int slice;
377 if (id < 840) {
378 partition = id % 2;
379 slice = (id - 768) / 2;
380 } else {
381 partition = (id % 4) + 2;
382 slice = (id - 840) / 4;
383 }
384 specification=(slice<<24)|(slice<<16)|(partition<<8)|partition;
385
386 return 0;
387}
388
d60d120c 389bool AliHLTTPCDataPublisherComponent::IsSelected(int equipmentId) const
686d5523 390{
391 /// inherited from AliHLTRawReaderPublisherComponent: check if a block is selected or not
f652dd4a 392 /// check if a raw data block needs to be published. This is the case if
393 /// there is no corresponding compressed data, i.e. function returns
394 /// only false if the block can be found in the cluster container
395 if (!fClusters)
396 return true;
397
398 int offset=AliHLTDAQ::DdlIDOffset(3);
399 int count=AliHLTDAQ::NumberOfDdls(3);
400 if (offset<0 || count<0)
401 return true;
402 if (equipmentId<offset)
403 return true;
404 equipmentId-=offset;
405 if (equipmentId>=count)
406 return true;
407 int slice=equipmentId<72?equipmentId/2:(equipmentId-72)/4;
408 int partition=equipmentId<72?equipmentId%2:(equipmentId-72)%4;
409 AliHLTUInt32_t specification=AliHLTTPCDefinitions::EncodeDataSpecification(slice, slice, partition, partition);
410 for (AliHLTComponentBlockDataList::const_iterator i=fClusters->GetBlockDescriptors().begin();
411 i!=fClusters->GetBlockDescriptors().end(); i++) {
412 if (i->fSpecification==specification)
413 return false;
414 }
415 return true;
416}
417
d60d120c 418AliHLTTPCDataPublisherComponent::AliRawClusterContainer::AliRawClusterContainer()
f652dd4a 419 : AliHLTLogging()
420 , fBlockCount(0)
421 , fTotalClusterCount(0)
422 , fBlockClusterCount(0)
423 , fpBuffer(NULL)
424 , fBufferSize(0)
425 , fDescriptors()
426 , fCurrentBlock(NULL)
427 , fTrackModelClusters(NULL)
428 , fTrackModelClusterMap()
429 , fIterator()
430 , fState(0)
431{
432 // constructor
433}
434
d60d120c 435AliHLTTPCDataPublisherComponent::AliRawClusterContainer::~AliRawClusterContainer()
f652dd4a 436{
437 // destructor
438}
439
d60d120c 440int AliHLTTPCDataPublisherComponent::AliRawClusterContainer::SetTargetBuffer(AliHLTUInt8_t* pBuffer, int size)
f652dd4a 441{
442 // set/reset the external target buffer
443 Clear();
444 fpBuffer=pBuffer;
445 fBufferSize=pBuffer?size:0;
446 return 0;
447}
448
d60d120c 449int AliHLTTPCDataPublisherComponent::AliRawClusterContainer::Sort()
f652dd4a 450{
451 // merge track model clusters into partition cluster blocks
452
453 // TODO: implement merging
454 // decoding of track model clusters needs to be done after all
455 // partition blocks have been decoded. The track model clusters are
456 // then at the end of the target buffer and have to be sorted into the
457 // other blocks
458 // 1) move track model cluster block by its own size back in buffer
459 // if not enough space, allocate temporary buffer and increase the
460 // size estimator for the next event
461 // 2) fill the index grid
462 // 3) make appropriate gaps between the partition cluster blocks
463 // 4) copy clusters into the partitions and update descriptors
464 return -ENOSYS;
465}
466
d60d120c 467int AliHLTTPCDataPublisherComponent::AliRawClusterContainer::CopyBlockDescriptors(AliHLTComponentBlockDataList& target) const
f652dd4a 468{
469 // fill block descriptors of extracted partition cluster blocks to target list
470 target.insert(target.begin(), fDescriptors.begin(), fDescriptors.end());
471 return fDescriptors.size();
472}
686d5523 473
d60d120c 474AliHLTTPCDataPublisherComponent::AliRawClusterContainer::iterator& AliHLTTPCDataPublisherComponent::AliRawClusterContainer::BeginPartitionClusterBlock(int count, AliHLTUInt32_t specification)
f652dd4a 475{
476 /// iterator of partition clusters block of specification
477 return ClusterIterator(count, AliHLTTPCDefinitions::RemainingClustersCompressedDataType(), specification, fCurrentBlock);
478}
479
d60d120c 480AliHLTTPCDataPublisherComponent::AliRawClusterContainer::iterator& AliHLTTPCDataPublisherComponent::AliRawClusterContainer::BeginTrackModelClusterBlock(int count)
f652dd4a 481{
482 /// iterator of track model clusters
483 return ClusterIterator(count, AliHLTTPCDefinitions::ClusterTracksCompressedDataType(), 0x23000500, fTrackModelClusters);
484}
485
d60d120c 486AliHLTTPCDataPublisherComponent::AliRawClusterContainer::iterator& AliHLTTPCDataPublisherComponent::AliRawClusterContainer::ClusterIterator(int /*count*/, AliHLTComponentDataType dt, AliHLTUInt32_t specification, AliHLTTPCRawClusterData* &pData)
f652dd4a 487{
488 /// iterator of partition clusters block of specification
489 fBlockCount++;
490 fIterator.~iterator();
491 fCurrentBlock=NULL;
492 fTrackModelClusters=NULL;
493 fTrackModelClusterMap.clear();
494 fBlockClusterCount=0;
495 AliHLTUInt32_t filled=0;
496 for (AliHLTComponentBlockDataList::const_iterator desc=fDescriptors.begin();
497 desc!=fDescriptors.end(); desc++) {
498 filled+=desc->fSize;
499 if (desc->fSpecification==specification &&
500 desc->fDataType==dt) {
501 HLTFatal("partition cluster block with data type %s and specification 0x%08x has been already processed",
502 AliHLTComponent::DataType2Text(dt).c_str(), specification);
503 filled=fBufferSize;
504 }
505 }
506 // initialize only the header, during filling the cluster count of the header
507 // and the block size will be incremented
508 AliHLTUInt32_t blocksize=sizeof(AliHLTTPCRawClusterData);
509 if (filled+blocksize>(unsigned)fBufferSize || fpBuffer==NULL) {
510 new (&fIterator) iterator;
511 return fIterator;
512 }
513 pData=reinterpret_cast<AliHLTTPCRawClusterData*>(fpBuffer+filled);
514 pData->fVersion=0;
515 pData->fCount=0;
516 AliHLTComponentBlockData bd;
517 AliHLTComponent::FillBlockData(bd);
518 bd.fPtr=NULL;
519 bd.fSize=blocksize;
520 bd.fOffset=filled;
521 bd.fDataType=dt;
522 bd.fSpecification=specification;
523 fDescriptors.push_back(bd);
524 new (&fIterator) iterator(this);
525 return fIterator;
526}
527
d60d120c 528AliHLTTPCRawCluster* AliHLTTPCDataPublisherComponent::AliRawClusterContainer::NextCluster(int slice, int partition)
f652dd4a 529{
530 /// increment to next cluster
531 fTotalClusterCount++;
532 fBlockClusterCount++;
533 if (!fCurrentBlock && !fTrackModelClusters)
534 return NULL;
535 if (fDescriptors.size()==0)
536 return NULL;
537 AliHLTTPCRawClusterData* data=fCurrentBlock?fCurrentBlock:fTrackModelClusters;
538 if (int(fDescriptors.back().fOffset+fDescriptors.back().fSize+sizeof(AliHLTTPCRawCluster))>=fBufferSize) {
539 fState=-ENOSPC;
540 return NULL;
541 }
542 data->fCount++;
543 fDescriptors.back().fSize+=sizeof(AliHLTTPCRawCluster);
544 if (fTrackModelClusters)
545 fTrackModelClusterMap.push_back(AliHLTTPCSpacePointData::GetID(slice, partition, fBlockClusterCount));
546 return data->fClusters+(data->fCount-1);
547}
548
d60d120c 549void AliHLTTPCDataPublisherComponent::AliRawClusterContainer::Clear(Option_t * /*option*/)
f652dd4a 550{
551 /// internal cleanup
552 fBlockCount=0;
553 fTotalClusterCount=0;
554 fBlockClusterCount=0;
555 fpBuffer=NULL;
556 fBufferSize=0;
557 fCurrentBlock=NULL;
558 fTrackModelClusters=NULL;
559 fTrackModelClusterMap.clear();
560 fDescriptors.clear();
561 fState=0;
562}
563
d60d120c 564void AliHLTTPCDataPublisherComponent::AliRawClusterContainer::Print(Option_t */*option*/) const
f652dd4a 565{
566 /// print info
567}
568
d60d120c 569AliHLTTPCDataPublisherComponent::AliRawClusterContainer::iterator& AliHLTTPCDataPublisherComponent::AliRawClusterContainer::iterator::Next(int slice, int partition)
f652dd4a 570{
571 // increment iterator
572 if (fContainer) {
573 fCluster=fContainer->NextCluster(slice, partition);
574 if (fCluster) memset(fCluster, 0, sizeof(AliHLTTPCRawCluster));
575 } else {
576 fCluster=NULL;
577 }
578 return *this;
686d5523 579}