2 // **************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project *
4 // ALICE Experiment at CERN, All rights reserved. *
6 // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7 // Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8 // for The ALICE HLT Project. *
10 // Permission to use, copy, modify and distribute this software and its *
11 // documentation strictly for non-commercial purposes is hereby granted *
12 // without fee, provided that the above copyright notice appears in all *
13 // copies and that both the copyright notice and this permission notice *
14 // appear in the supporting documentation. The authors make no claims *
15 // about the suitability of this software for any purpose. It is *
16 // provided "as is" without express or implied warranty. *
18 //***************************************************************************
21 ///////////////////////////////////////////////////////////////////////////////
23 // a TPC tracker processing component for the HLT based on CA by Ivan Kisel //
25 ///////////////////////////////////////////////////////////////////////////////
31 #include "AliHLTTPCCATrackerComponent.h"
32 #include "AliHLTTPCTransform.h"
33 #include "AliHLTTPCCATrackerFramework.h"
34 #include "AliHLTTPCCAParam.h"
35 #include "AliHLTTPCCATrackConvertor.h"
36 #include "AliHLTArray.h"
38 #include "AliHLTTPCSpacePointData.h"
39 #include "AliHLTTPCClusterDataFormat.h"
40 #include "AliHLTTPCCACompressedInputData.h"
41 #include "AliHLTTPCTransform.h"
42 #include "AliHLTTPCDefinitions.h"
43 #include "AliExternalTrackParam.h"
45 #include "AliCDBEntry.h"
46 #include "AliCDBManager.h"
47 #include "TObjString.h"
48 #include "TObjArray.h"
49 #include "AliHLTTPCCASliceOutput.h"
50 #include "AliHLTTPCCAClusterData.h"
52 const AliHLTComponentDataType AliHLTTPCCADefinitions::fgkTrackletsDataType = AliHLTComponentDataTypeInitializer( "CATRACKL", kAliHLTDataOriginTPC );
54 /** ROOT macro for the implementation of ROOT specific class methods */
55 ClassImp( AliHLTTPCCATrackerComponent )
57 AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent()
61 fMinNTrackClusters( 30 ),
64 fNeighboursSearchArea( 0 ),
65 fClusterErrorCorrectionY(0),
66 fClusterErrorCorrectionZ(0),
67 fBenchmark("CATracker"),
69 fGPUHelperThreads(-1),
73 // see header file for class documentation
75 // refer to README to build package
77 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
80 AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent( const AliHLTTPCCATrackerComponent& )
85 fMinNTrackClusters( 30 ),
88 fNeighboursSearchArea(0),
89 fClusterErrorCorrectionY(0),
90 fClusterErrorCorrectionZ(0),
91 fBenchmark("CATracker"),
93 fGPUHelperThreads(-1),
97 // see header file for class documentation
98 HLTFatal( "copy constructor untested" );
101 AliHLTTPCCATrackerComponent& AliHLTTPCCATrackerComponent::operator=( const AliHLTTPCCATrackerComponent& )
103 // see header file for class documentation
104 HLTFatal( "assignment operator untested" );
108 AliHLTTPCCATrackerComponent::~AliHLTTPCCATrackerComponent()
110 // see header file for class documentation
111 if (fTracker) delete fTracker;
115 // Public functions to implement AliHLTComponent's interface.
116 // These functions are required for the registration process
119 const char* AliHLTTPCCATrackerComponent::GetComponentID()
121 // see header file for class documentation
122 return "TPCCATracker";
125 void AliHLTTPCCATrackerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list )
127 // see header file for class documentation
129 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
130 list.push_back( AliHLTTPCCADefinitions::fgkCompressedInputDataType );
133 AliHLTComponentDataType AliHLTTPCCATrackerComponent::GetOutputDataType()
135 // see header file for class documentation
136 return AliHLTTPCCADefinitions::fgkTrackletsDataType;
139 void AliHLTTPCCATrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
141 // define guess for the output data size
142 constBase = 200; // minimum size
143 inputMultiplier = 0.6; // size relative to input
146 AliHLTComponent* AliHLTTPCCATrackerComponent::Spawn()
148 // see header file for class documentation
149 return new AliHLTTPCCATrackerComponent;
152 void AliHLTTPCCATrackerComponent::SetDefaultConfiguration()
154 // Set default configuration for the CA tracker component
155 // Some parameters can be later overwritten from the OCDB
157 fSolenoidBz = -5.00668;
158 fMinNTrackClusters = 30;
161 fNeighboursSearchArea = 0;
162 fClusterErrorCorrectionY = 0;
163 fClusterErrorCorrectionZ = 0;
165 fBenchmark.SetTimer(0,"total");
166 fBenchmark.SetTimer(1,"reco");
169 int AliHLTTPCCATrackerComponent::ReadConfigurationString( const char* arguments )
171 // Set configuration parameters for the CA tracker component from the string
174 if ( !arguments ) return iResult;
176 TString allArgs = arguments;
178 int bMissingParam = 0;
180 TObjArray* pTokens = allArgs.Tokenize( " " );
182 int nArgs = pTokens ? pTokens->GetEntries() : 0;
184 for ( int i = 0; i < nArgs; i++ ) {
185 argument = ( ( TObjString* )pTokens->At( i ) )->GetString();
186 if ( argument.IsNull() ) continue;
188 if ( argument.CompareTo( "-solenoidBz" ) == 0 ) {
189 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
190 HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
194 if ( argument.CompareTo( "-minNClustersOnTrack" ) == 0 ) {
195 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
196 fMinNTrackClusters = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi();
197 HLTInfo( "minNClustersOnTrack set to: %d", fMinNTrackClusters );
201 if ( argument.CompareTo( "-minTrackPt" ) == 0 ) {
202 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
203 fMinTrackPt = ( ( TObjString* )pTokens->At( i ) )->GetString().Atof();
204 HLTInfo( "minTrackPt set to: %f", fMinTrackPt );
208 if ( argument.CompareTo( "-clusterZCut" ) == 0 ) {
209 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
210 fClusterZCut = TMath::Abs( ( ( TObjString* )pTokens->At( i ) )->GetString().Atof() );
211 HLTInfo( "ClusterZCut set to: %f", fClusterZCut );
215 if ( argument.CompareTo( "-neighboursSearchArea" ) == 0 ) {
216 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
217 fNeighboursSearchArea = TMath::Abs( ( ( TObjString* )pTokens->At( i ) )->GetString().Atof() );
218 HLTInfo( "NeighboursSearchArea set to: %f", fNeighboursSearchArea );
222 if ( argument.CompareTo( "-errorCorrectionY" ) == 0 ) {
223 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
224 fClusterErrorCorrectionY = ( ( TObjString* )pTokens->At( i ) )->GetString().Atof();
225 HLTInfo( "Cluster Y error correction factor set to: %f", fClusterErrorCorrectionY );
229 if ( argument.CompareTo( "-errorCorrectionZ" ) == 0 ) {
230 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
231 fClusterErrorCorrectionZ = ( ( TObjString* )pTokens->At( i ) )->GetString().Atof();
232 HLTInfo( "Cluster Z error correction factor set to: %f", fClusterErrorCorrectionZ );
236 if (argument.CompareTo( "-allowGPU" ) == 0) {
238 HLTImportant( "Will try to run tracker on GPU" );
242 if (argument.CompareTo( "-GlobalTracking" ) == 0) {
244 HLTImportant( "Global Tracking Activated" );
248 if ( argument.CompareTo( "-GPUHelperThreads" ) == 0 ) {
249 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
250 fGPUHelperThreads = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi();
251 HLTInfo( "Number of GPU Helper Threads set to: %d", fGPUHelperThreads );
255 if ( argument.CompareTo( "-CPUTrackers" ) == 0 ) {
256 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
257 fCPUTrackers = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi();
258 HLTInfo( "Number of CPU Trackers set to: %d", fCPUTrackers );
262 HLTError( "Unknown option \"%s\"", argument.Data() );
267 if ( bMissingParam ) {
268 HLTError( "Specifier missed for parameter \"%s\"", argument.Data() );
276 int AliHLTTPCCATrackerComponent::ReadCDBEntry( const char* cdbEntry, const char* chainId )
278 // see header file for class documentation
280 const char* defaultNotify = "";
283 cdbEntry = "HLT/ConfigTPC/TPCCATracker";
284 defaultNotify = " (default)";
288 HLTInfo( "configure from entry \"%s\"%s, chain id %s", cdbEntry, defaultNotify, ( chainId != NULL && chainId[0] != 0 ) ? chainId : "<none>" );
289 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get( cdbEntry );//,GetRunNo());
292 HLTError( "cannot fetch object \"%s\" from CDB", cdbEntry );
296 TObjString* pString = dynamic_cast<TObjString*>( pEntry->GetObject() );
299 HLTError( "configuration object \"%s\" has wrong type, required TObjString", cdbEntry );
303 HLTInfo( "received configuration object string: \"%s\"", pString->GetString().Data() );
305 return ReadConfigurationString( pString->GetString().Data() );
309 int AliHLTTPCCATrackerComponent::Configure( const char* cdbEntry, const char* chainId, const char *commandLine )
311 // Configure the component
312 // There are few levels of configuration,
313 // parameters which are set on one step can be overwritten on the next step
315 //* read hard-coded values
317 SetDefaultConfiguration();
319 //* read the default CDB entry
321 int iResult1 = ReadCDBEntry( NULL, chainId );
323 //* read magnetic field
325 fSolenoidBz = GetBz();
327 //* read the actual CDB entry if required
329 int iResult2 = ( cdbEntry ) ? ReadCDBEntry( cdbEntry, chainId ) : 0;
331 //* read extra parameters from input (if they are)
335 if ( commandLine && commandLine[0] != '\0' ) {
336 HLTInfo( "received configuration string from HLT framework: \"%s\"", commandLine );
337 iResult3 = ReadConfigurationString( commandLine );
340 // Initialise the tracker here
342 return iResult1 ? iResult1 : ( iResult2 ? iResult2 : iResult3 );
345 int AliHLTTPCCATrackerComponent::DoInit( int argc, const char** argv )
347 // Configure the CA tracker component
349 if ( fTracker ) return EINPROGRESS;
351 TString arguments = "";
352 for ( int i = 0; i < argc; i++ ) {
353 if ( !arguments.IsNull() ) arguments += " ";
354 arguments += argv[i];
357 int retVal = Configure( NULL, NULL, arguments.Data() );
358 if (retVal == 0) fTracker = new AliHLTTPCCATrackerFramework(fAllowGPU);
359 if (fGPUHelperThreads != -1)
361 char cc[256] = "HelperThreads";
362 fTracker->SetGPUTrackerOption(cc, fGPUHelperThreads);
365 char cc[256] = "CPUTrackers";
366 fTracker->SetGPUTrackerOption(cc, fCPUTrackers);
367 char cc2[256] = "SlicesPerCPUTracker";
368 fTracker->SetGPUTrackerOption(cc2, 1);
372 char cc[256] = "GlobalTracking";
373 fTracker->SetGPUTrackerOption(cc, 1);
379 int AliHLTTPCCATrackerComponent::DoDeinit()
381 // see header file for class documentation
382 if (fTracker) delete fTracker;
387 int AliHLTTPCCATrackerComponent::Reconfigure( const char* cdbEntry, const char* chainId )
389 // Reconfigure the component from OCDB .
391 return Configure( cdbEntry, chainId, NULL );
394 bool AliHLTTPCCATrackerComponent::CompareClusters( AliHLTTPCSpacePointData *a, AliHLTTPCSpacePointData *b )
396 //* Comparison function for sort clusters
398 if ( a->fPadRow < b->fPadRow ) return 1;
399 if ( a->fPadRow > b->fPadRow ) return 0;
400 return ( a->fZ < b->fZ );
405 int AliHLTTPCCATrackerComponent::DoEvent
407 const AliHLTComponentEventData& evtData,
408 const AliHLTComponentBlockData* blocks,
409 AliHLTComponentTriggerData& /*trigData*/,
410 AliHLTUInt8_t* outputPtr,
411 AliHLTUInt32_t& size,
412 vector<AliHLTComponentBlockData>& outputBlocks )
416 AliHLTUInt32_t maxBufferSize = size;
417 size = 0; // output size
419 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) ) {
423 fBenchmark.StartNewEvent();
426 // Event reconstruction in one TPC slice with CA Tracker
428 //Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "CA::DoEvent()" );
429 if ( evtData.fBlockCnt <= 0 ) {
430 HLTWarning( "no blocks in event" );
434 const AliHLTComponentBlockData* iter = NULL;
437 // Determine the slice number
439 //Find min and max slice number with now slice missing in between (for default output)
440 int minslice = -1, maxslice = -1;
443 std::vector<int> slices;
444 std::vector<int>::iterator slIter;
445 std::vector<unsigned> sliceCnts;
446 std::vector<unsigned>::iterator slCntIter;
448 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
450 if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType &&
451 iter->fDataType != AliHLTTPCCADefinitions::fgkCompressedInputDataType
454 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
455 if (slice < minslice || minslice == -1) minslice = slice;
456 if (slice > maxslice) maxslice = slice;
459 slCntIter = sliceCnts.begin();
460 for ( slIter = slices.begin(); slIter != slices.end(); slIter++, slCntIter++ ) {
461 if ( *slIter == slice ) {
467 slices.push_back( slice );
468 sliceCnts.push_back( 1 );
469 } else (*slCntIter)++;
472 if ( slices.size() == 0 ) {
473 HLTWarning( "no slices found in event" );
478 // Determine slice number to really use. (for obsolete output)
479 if ( slices.size() > 1 ) {
480 Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
481 "Multiple slice numbers found in event 0x%08lX (%lu). Determining maximum occuring slice number...",
482 evtData.fEventID, evtData.fEventID );
483 slCntIter = sliceCnts.begin();
484 for ( slIter = slices.begin(); slIter != slices.end(); slIter++, slCntIter++ ) {
485 Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
486 "Slice %lu found %lu times.", *slIter, *slCntIter );
488 } else if ( slices.size() > 0 ) {
489 slice = *( slices.begin() );
493 for (int islice = minslice;islice <= maxslice;islice++)
496 for(slIter = slices.begin(); slIter != slices.end();slIter++)
498 if (*slIter == islice)
506 maxslice = islice - 1;
512 if ( !fTracker ) fTracker = new AliHLTTPCCATrackerFramework(fAllowGPU);
514 int slicecount = maxslice + 1 - minslice;
515 if (slicecount > fTracker->MaxSliceCount())
517 maxslice = minslice + (slicecount = fTracker->MaxSliceCount()) - 1;
519 int nClustersTotalSum = 0;
520 AliHLTTPCCAClusterData* clusterData = new AliHLTTPCCAClusterData[slicecount];
523 // min and max patch numbers and row numbers
524 int* slicerow = new int[slicecount * 2];
525 int* sliceminPatch = new int[slicecount];
526 int* slicemaxPatch = new int[slicecount];
527 memset(slicerow, 0, slicecount * 2 * sizeof(int));
528 for (int i = 0;i < slicecount;i++)
530 sliceminPatch[i] = 100;
531 slicemaxPatch[i] = -1;
534 //Prepare everything for all slices
536 for (int islice = 0;islice < slicecount;islice++)
538 slice = minslice + islice;
540 // Initialize the tracker slice
543 float inRmin = 83.65;
544 // float inRmax = 133.3;
545 // float outRmin = 133.5;
546 float outRmax = 247.7;
547 float plusZmin = 0.0529937;
548 float plusZmax = 249.778;
549 float minusZmin = -249.645;
550 float minusZmax = -0.0799937;
551 float dalpha = 0.349066;
552 float alpha = 0.174533 + dalpha * iSec;
554 bool zPlus = ( iSec < 18 );
555 float zMin = zPlus ? plusZmin : minusZmin;
556 float zMax = zPlus ? plusZmax : minusZmax;
557 //TPCZmin = -249.645, ZMax = 249.778
558 // float rMin = inRmin;
559 // float rMax = outRmax;
560 int nRows = AliHLTTPCTransform::GetNRows();
562 float padPitch = 0.4;
563 float sigmaZ = 0.228808;
565 float *rowX = new float [nRows];
566 for ( int irow = 0; irow < nRows; irow++ ) {
567 rowX[irow] = AliHLTTPCTransform::Row2X( irow );
570 AliHLTTPCCAParam param;
572 param.Initialize( iSec, nRows, rowX, alpha, dalpha,
573 inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, fSolenoidBz );
574 param.SetHitPickUpFactor( 2 );
575 if( fNeighboursSearchArea>0 ) param.SetNeighboursSearchArea( fNeighboursSearchArea );
576 if( fClusterErrorCorrectionY>1.e-4 ) param.SetClusterError2CorrectionY( fClusterErrorCorrectionY*fClusterErrorCorrectionY );
577 if( fClusterErrorCorrectionZ>1.e-4 ) param.SetClusterError2CorrectionZ( fClusterErrorCorrectionZ*fClusterErrorCorrectionZ );
578 param.SetMinNTrackClusters( fMinNTrackClusters );
579 param.SetMinTrackPt( fMinTrackPt );
582 fTracker->InitializeSliceParam( slice, param );
587 int nClustersTotal = 0;
590 std::vector<unsigned long> patchIndices;
592 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
594 if ( slice != AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) continue;
595 if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
596 AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
597 nClustersTotal += inPtrSP->fSpacePointCnt;
598 fBenchmark.AddInput(iter->fSize);
600 if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
601 fBenchmark.AddInput(iter->fSize);
602 const AliHLTUInt8_t * inPtr = (const AliHLTUInt8_t *)iter->fPtr;
603 while( inPtr< ((const AliHLTUInt8_t *) iter->fPtr) + iter->fSize ){
604 AliHLTTPCCACompressedClusterRow *row = (AliHLTTPCCACompressedClusterRow*)inPtr;
605 nClustersTotal+= row->fNClusters;
606 inPtr = (const AliHLTUInt8_t *)(row->fClusters+row->fNClusters);
611 int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
612 if ( sliceminPatch[islice] > patch ) {
613 sliceminPatch[islice] = patch;
614 slicerow[2 * islice + 0] = AliHLTTPCTransform::GetFirstRow( patch );
616 if ( slicemaxPatch[islice] < patch ) {
617 slicemaxPatch[islice] = patch;
618 slicerow[2 * islice + 1] = AliHLTTPCTransform::GetLastRow( patch );
620 std::vector<unsigned long>::iterator pIter = patchIndices.begin();
621 while ( pIter != patchIndices.end() && AliHLTTPCDefinitions::GetMinPatchNr( blocks[*pIter] ) < patch ) {
624 patchIndices.insert( pIter, ndx );
628 // pass event to CA Tracker
631 Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
632 "Total %d hits to read for slice %d", nClustersTotal, slice );
635 clusterData[islice].StartReading( slice, nClustersTotal );
637 for ( std::vector<unsigned long>::iterator pIter = patchIndices.begin(); pIter != patchIndices.end(); pIter++ ) {
640 int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
643 if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
644 AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
645 nPatchClust = inPtrSP->fSpacePointCnt;
646 for ( unsigned int i = 0; i < inPtrSP->fSpacePointCnt; i++ ) {
647 AliHLTTPCSpacePointData *c = &( inPtrSP->fSpacePoints[i] );
648 if ( CAMath::Abs( c->fZ ) > fClusterZCut ) continue;
649 if ( c->fPadRow > 159 ) {
650 HLTError( "Wrong TPC cluster with row number %d received", c->fPadRow );
653 clusterData[islice].ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
656 if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
657 const AliHLTUInt8_t * inPtr = (const AliHLTUInt8_t *)iter->fPtr;
659 while( inPtr< ((const AliHLTUInt8_t *)iter->fPtr) + iter->fSize ){
660 AliHLTTPCCACompressedClusterRow *row = (AliHLTTPCCACompressedClusterRow*)inPtr;
661 UInt_t id = row->fSlicePatchRowID;
662 UInt_t jslice = id>>10;
663 UInt_t jpatch = (id>>6) & 0x7;
664 UInt_t jrow = id & 0x3F;
665 jrow+= AliHLTTPCTransform::GetFirstRow( jpatch );
666 Double_t rowX = AliHLTTPCTransform::Row2X( jrow );
667 //cout<<"Read row: s "<<jslice<<" p "<<jpatch<<" r "<<jrow<<" x "<<row->fX<<" nclu "<<row->fNClusters<<" :"<<endl;
669 HLTError( "Wrong TPC cluster with row number %d received", jrow );
672 for ( unsigned int i = 0; i < row->fNClusters; i++ ) {
673 AliHLTTPCCACompressedCluster *c = &( row->fClusters[i] );
675 UInt_t ix0 = c->fP0 >>24;
676 UInt_t ix1 = c->fP1 >>24;
677 Double_t x = (ix1<<8) + ix0;
678 Double_t y = c->fP0 & 0x00FFFFFF;
679 Double_t z = c->fP1 & 0x00FFFFFF;
680 x = (x - 32768.)*1.e-4 + rowX;
681 y = (y - 8388608.)*1.e-4;
682 z = (z - 8388608.)*1.e-4;
684 UInt_t cluId = AliHLTTPCSpacePointData::GetID( jslice, jpatch, nPatchClust );
685 //cout<<"clu "<<i<<": "<<x<<" "<<y<<" "<<z<<" "<<cluId<<endl;
686 if ( CAMath::Abs( z ) <= fClusterZCut ){
687 clusterData[islice].ReadCluster( cluId, jrow, x, y, z, 0 );
691 inPtr = (const AliHLTUInt8_t *)(row->fClusters+row->fNClusters);
694 Logging( kHLTLogInfo, "HLT::TPCCATracker::DoEvent", "Reading hits",
695 "Read %d hits for slice %d - patch %d", nPatchClust, slice, patch );
698 clusterData[islice].FinishReading();
699 nClustersTotalSum += nClustersTotal;
703 AliHLTTPCCASliceOutput::outputControlStruct outputControl;
704 //Set tracker output so tracker does not have to output both formats!
705 outputControl.fEndOfSpace = 0;
707 //For new output we can write directly to output buffer
708 outputControl.fOutputPtr = (char*) outputPtr;
709 outputControl.fOutputMaxSize = maxBufferSize;
711 AliHLTTPCCASliceOutput** sliceOutput = new AliHLTTPCCASliceOutput*[slicecount];
712 memset(sliceOutput, 0, slicecount * sizeof(AliHLTTPCCASliceOutput*));
714 // reconstruct the event
717 fTracker->SetOutputControl(&outputControl);
718 fTracker->ProcessSlices(minslice, slicecount, clusterData, sliceOutput);
722 unsigned int mySize = 0;
726 for (int islice = 0;islice < slicecount;islice++)
728 if( outputControl.fEndOfSpace ){
729 HLTWarning( "Output buffer size exceed, tracks are not stored" );
734 slice = minslice + islice;
736 if (sliceOutput[islice])
738 // write reconstructed tracks
739 Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reconstruct",
740 "%d tracks found for slice %d", sliceOutput[islice]->NTracks(), slice );
742 mySize += sliceOutput[islice]->Size();
743 ntracks += sliceOutput[islice]->NTracks();
747 HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), tracks are not stored", maxBufferSize, mySize );
759 for (int islice = 0;islice < slicecount;islice++)
761 slice = minslice + islice;
762 mySize = sliceOutput[islice]->Size();
765 AliHLTComponentBlockData bd;
767 bd.fOffset = ((char*) sliceOutput[islice] - (char*) outputPtr);
769 bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, sliceminPatch[islice], slicemaxPatch[islice] );
770 bd.fDataType = GetOutputDataType();
771 outputBlocks.push_back( bd );
773 fBenchmark.AddOutput(bd.fSize);
781 delete[] clusterData;
782 delete[] sliceOutput;
786 // Set log level to "Warning" for on-line system monitoring
788 //Min and Max Patch are taken for first slice processed...
790 if( minslice==maxslice ) fBenchmark.SetName(Form("CATracker slice %d",minslice));
791 else fBenchmark.SetName(Form("CATracker slices %d-%d",minslice,maxslice));
793 HLTInfo(fBenchmark.GetStatistics());
797 delete[] sliceminPatch;
798 delete[] slicemaxPatch;