]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerComponent.cxx
register the CATracker and CAGlobalMerger from the TPCAgent; delete global objects...
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATrackerComponent.cxx
1 // @(#) $Id$
2 // **************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project          *
4 // ALICE Experiment at CERN, All rights reserved.                           *
5 //                                                                          *
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.                              *
9 //                                                                          *
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.                    *
17 //                                                                          *
18 //***************************************************************************
19
20
21 ///////////////////////////////////////////////////////////////////////////////
22 //                                                                           //
23 // a TPC tracker processing component for the HLT based on CA by Ivan Kisel  //
24 //                                                                           //
25 ///////////////////////////////////////////////////////////////////////////////
26
27 #if __GNUC__>= 3
28 using namespace std;
29 #endif
30
31 #include "AliHLTTPCCATrackerComponent.h"
32 #include "AliHLTTPCTransform.h"
33 #include "AliHLTTPCCATracker.h"
34 #include "AliHLTTPCCAOutTrack.h"
35 #include "AliHLTTPCCAParam.h"
36 #include "AliHLTTPCCATrackConvertor.h"
37 #include "AliHLTArray.h"
38
39 #include "AliHLTTPCSpacePointData.h"
40 #include "AliHLTTPCClusterDataFormat.h"
41 #include "AliHLTTPCTransform.h"
42 #include "AliHLTTPCTrackSegmentData.h"
43 #include "AliHLTTPCTrackArray.h"
44 #include "AliHLTTPCTrackletDataFormat.h"
45 #include "AliHLTTPCDefinitions.h"
46 #include "AliExternalTrackParam.h"
47 #include "TStopwatch.h"
48 #include "TMath.h"
49 #include "AliCDBEntry.h"
50 #include "AliCDBManager.h"
51 #include "TObjString.h"
52 #include "TObjArray.h"
53 #include "AliHLTTPCCASliceOutput.h"
54 #include "AliHLTTPCCAClusterData.h"
55
56 const AliHLTComponentDataType AliHLTTPCCADefinitions::fgkTrackletsDataType = AliHLTComponentDataTypeInitializer( "CATRACKL", kAliHLTDataOriginTPC );
57
58 /** ROOT macro for the implementation of ROOT specific class methods */
59 ClassImp( AliHLTTPCCATrackerComponent )
60
61 AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent()
62     :
63     fTracker( NULL ),
64     fSolenoidBz( 0 ),
65     fMinNTrackClusters( 0 ),
66     fClusterZCut( 500. ),
67     fFullTime( 0 ),
68     fRecoTime( 0 ),
69     fNEvents( 0 ),
70     fNewOutputType( 0 )
71 {
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
77 }
78
79 AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent( const AliHLTTPCCATrackerComponent& )
80     :
81     AliHLTProcessor(),
82     fTracker( NULL ),
83     fSolenoidBz( 0 ),
84     fMinNTrackClusters( 30 ),
85     fClusterZCut( 500. ),
86     fFullTime( 0 ),
87     fRecoTime( 0 ),
88     fNEvents( 0 ),
89     fNewOutputType( 0 )
90 {
91   // see header file for class documentation
92   HLTFatal( "copy constructor untested" );
93 }
94
95 AliHLTTPCCATrackerComponent& AliHLTTPCCATrackerComponent::operator=( const AliHLTTPCCATrackerComponent& )
96 {
97   // see header file for class documentation
98   HLTFatal( "assignment operator untested" );
99   return *this;
100 }
101
102 AliHLTTPCCATrackerComponent::~AliHLTTPCCATrackerComponent()
103 {
104   // see header file for class documentation
105   delete fTracker;
106 }
107
108 //
109 // Public functions to implement AliHLTComponent's interface.
110 // These functions are required for the registration process
111 //
112
113 const char* AliHLTTPCCATrackerComponent::GetComponentID()
114 {
115   // see header file for class documentation
116   return "TPCCATracker";
117 }
118
119 void AliHLTTPCCATrackerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list )
120 {
121   // see header file for class documentation
122   list.clear();
123   list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
124 }
125
126 AliHLTComponentDataType AliHLTTPCCATrackerComponent::GetOutputDataType()
127 {
128   // see header file for class documentation
129   if ( fNewOutputType ) return AliHLTTPCCADefinitions::fgkTrackletsDataType;
130   else return AliHLTTPCDefinitions::fgkTrackSegmentsDataType;
131 }
132
133 void AliHLTTPCCATrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
134 {
135   // define guess for the output data size
136   constBase = 200;       // minimum size
137   inputMultiplier = 0.5; // size relative to input
138 }
139
140 AliHLTComponent* AliHLTTPCCATrackerComponent::Spawn()
141 {
142   // see header file for class documentation
143   return new AliHLTTPCCATrackerComponent;
144 }
145
146 int AliHLTTPCCATrackerComponent::DoInit( int argc, const char** argv )
147 {
148   // Configure the CA tracker component
149
150   fSolenoidBz = 5;
151   fMinNTrackClusters = 0;
152   fClusterZCut = 500.;
153   fFullTime = 0;
154   fRecoTime = 0;
155   fNEvents = 0;
156   fNewOutputType = 0;
157
158   if ( fTracker ) return EINPROGRESS;
159   fTracker = new AliHLTTPCCATracker();
160
161   int iResult = 0;
162
163   TString arguments = "";
164   for ( int i = 0; i < argc; i++ ) {
165     TString argument = argv[i];
166     if ( !arguments.IsNull() ) arguments += " ";
167     arguments += argument;
168   }
169   if ( !arguments.IsNull() ) {
170     iResult = Configure( arguments.Data() );
171   } else {
172     iResult = Reconfigure( NULL, NULL );
173   }
174   return iResult;
175 }
176
177
178 int AliHLTTPCCATrackerComponent::DoDeinit()
179 {
180   // see header file for class documentation
181   if ( fTracker ) delete fTracker;
182   fTracker = NULL;
183   return 0;
184 }
185
186 int AliHLTTPCCATrackerComponent::Reconfigure( const char* /*cdbEntry*/, const char* /*chainId*/ )
187 {
188   // see header file for class documentation
189
190   HLTInfo( "TODO: dummy Reconfigure() method" );
191
192   return 0;
193
194   /*
195
196   int iResult=0;
197   const char* path="HLT/ConfigTPC/CATrackerComponent";
198   const char* defaultNotify="";
199   if (cdbEntry) {
200     path=cdbEntry;
201     defaultNotify=" (default)";
202   }
203   if (path) {
204     HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
205     AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
206     if (pEntry) {
207       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
208       if (pString) {
209   HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
210   iResult=Configure(pString->GetString().Data());
211       } else {
212   HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
213       }
214     } else {
215       HLTError("cannot fetch object \"%s\" from CDB", path);
216     }
217   }
218
219   const char* pathBField=kAliHLTCDBSolenoidBz;
220
221   if (pathBField) {
222     HLTInfo("reconfigure B-Field from entry %s, chain id %s", path,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
223     AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField);//,GetRunNo());
224     if (pEntry) {
225       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
226       if (pString) {
227   HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
228   iResult=Configure(pString->GetString().Data());
229       } else {
230   HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
231       }
232     } else {
233       HLTError("cannot fetch object \"%s\" from CDB", path);
234     }
235   }
236   return iResult;
237   */
238 }
239
240
241 bool AliHLTTPCCATrackerComponent::CompareClusters( AliHLTTPCSpacePointData *a, AliHLTTPCSpacePointData *b )
242 {
243   //* Comparison function for sorting clusters
244   if ( a->fPadRow < b->fPadRow ) return 1;
245   if ( a->fPadRow > b->fPadRow ) return 0;
246   return ( a->fZ < b->fZ );
247 }
248
249
250 int AliHLTTPCCATrackerComponent::Configure( const char* arguments )
251 {
252   //* Set parameters
253
254   int iResult = 0;
255   if ( !arguments ) return iResult;
256
257   TString allArgs = arguments;
258   TString argument;
259   int bMissingParam = 0;
260
261   TObjArray* pTokens = allArgs.Tokenize( " " );
262
263   int nArgs =  pTokens ? pTokens->GetEntries() : 0;
264
265   for ( int i = 0; i < nArgs; i++ ) {
266     argument = ( ( TObjString* )pTokens->At( i ) )->GetString();
267     if ( argument.IsNull() ) {
268     } else if ( argument.CompareTo( "-solenoidBz" ) == 0 ) {
269       if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
270       fSolenoidBz = ( ( TObjString* )pTokens->At( i ) )->GetString().Atof();
271       HLTInfo( "Magnetic Field set to: %f", fSolenoidBz );
272     } else if ( argument.CompareTo( "-minNClustersOnTrack" ) == 0 ||
273                 argument.CompareTo( "-minNTrackClusters" ) == 0 ) {
274       if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
275       fMinNTrackClusters = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi();
276       HLTInfo( "minNClustersOnTrack set to: %d", fMinNTrackClusters );
277     } else if ( argument.CompareTo( "-clusterZCut" ) == 0 ) {
278       if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
279       fClusterZCut = TMath::Abs( ( ( TObjString* )pTokens->At( i ) )->GetString().Atof() );
280       HLTInfo( "ClusterZCut set to: %f", fClusterZCut );
281     } else if ( argument.CompareTo( "-newOutputType" ) == 0 ) {
282       fNewOutputType = 1;
283       HLTInfo( "NewOutputType is set" );
284     } else {
285       HLTError( "Unknown option %s ", argument.Data() );
286       iResult = -EINVAL;
287     }
288   }
289   delete pTokens;
290
291   if ( bMissingParam ) {
292     HLTError( "Specifier missed for %s", argument.Data() );
293     iResult = -EINVAL;
294   }
295
296   return iResult;
297 }
298
299
300
301
302 int AliHLTTPCCATrackerComponent::DoEvent
303 (
304   const AliHLTComponentEventData& evtData,
305   const AliHLTComponentBlockData* blocks,
306   AliHLTComponentTriggerData& /*trigData*/,
307   AliHLTUInt8_t* outputPtr,
308   AliHLTUInt32_t& size,
309   vector<AliHLTComponentBlockData>& outputBlocks )
310 {
311 //* process event
312   AliHLTUInt32_t maxBufferSize = size;
313   size = 0; // output size
314
315   if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) ) {
316     return 0;
317   }
318
319   TStopwatch timer;
320
321   // Event reconstruction in one TPC slice with CA Tracker
322
323   //Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "CA::DoEvent()" );
324   if ( evtData.fBlockCnt <= 0 ) {
325     HLTWarning( "no blocks in event" );
326     return 0;
327   }
328
329   const AliHLTComponentBlockData* iter = NULL;
330   unsigned long ndx;
331   AliHLTTPCClusterData* inPtrSP;
332
333   // Determine the slice number
334
335   int slice = -1;
336   {
337     std::vector<int> slices;
338     std::vector<int>::iterator slIter;
339     std::vector<unsigned> sliceCnts;
340     std::vector<unsigned>::iterator slCntIter;
341
342     for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
343       iter = blocks + ndx;
344       if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;
345
346       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
347
348       bool found = 0;
349       slCntIter = sliceCnts.begin();
350       for ( slIter = slices.begin(); slIter != slices.end(); slIter++, slCntIter++ ) {
351         if ( *slIter == slice ) {
352           found = kTRUE;
353           break;
354         }
355       }
356       if ( !found ) {
357         slices.push_back( slice );
358         sliceCnts.push_back( 1 );
359       } else *slCntIter++;
360     }
361
362
363     // Determine slice number to really use.
364     if ( slices.size() > 1 ) {
365       Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
366                "Multiple slice numbers found in event 0x%08lX (%lu). Determining maximum occuring slice number...",
367                evtData.fEventID, evtData.fEventID );
368       unsigned maxCntSlice = 0;
369       slCntIter = sliceCnts.begin();
370       for ( slIter = slices.begin(); slIter != slices.end(); slIter++, slCntIter++ ) {
371         Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
372                  "Slice %lu found %lu times.", *slIter, *slCntIter );
373         if ( maxCntSlice < *slCntIter ) {
374           maxCntSlice = *slCntIter;
375           slice = *slIter;
376         }
377       }
378       Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
379                "Using slice %lu.", slice );
380     } else if ( slices.size() > 0 ) {
381       slice = *( slices.begin() );
382     }
383   }
384
385   if ( slice < 0 ) {
386     HLTWarning( "no slices found in event" );
387     return 0;
388   }
389
390
391   // Initialize the tracker
392
393
394   {
395     if ( !fTracker ) fTracker = new AliHLTTPCCATracker;
396     int iSec = slice;
397     float inRmin = 83.65;
398     //    float inRmax = 133.3;
399     //    float outRmin = 133.5;
400     float outRmax = 247.7;
401     float plusZmin = 0.0529937;
402     float plusZmax = 249.778;
403     float minusZmin = -249.645;
404     float minusZmax = -0.0799937;
405     float dalpha = 0.349066;
406     float alpha = 0.174533 + dalpha * iSec;
407
408     bool zPlus = ( iSec < 18 );
409     float zMin =  zPlus ? plusZmin : minusZmin;
410     float zMax =  zPlus ? plusZmax : minusZmax;
411     //TPCZmin = -249.645, ZMax = 249.778
412     //    float rMin =  inRmin;
413     //    float rMax =  outRmax;
414     int nRows = AliHLTTPCTransform::GetNRows();
415
416     float padPitch = 0.4;
417     float sigmaZ = 0.228808;
418
419     float *rowX = new float [nRows];
420     for ( int irow = 0; irow < nRows; irow++ ) {
421       rowX[irow] = AliHLTTPCTransform::Row2X( irow );
422     }
423
424     const double kCLight = 0.000299792458;
425
426     AliHLTTPCCAParam param;
427
428     param.Initialize( iSec, nRows, rowX, alpha, dalpha,
429                       inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, fSolenoidBz*kCLight );
430     param.SetHitPickUpFactor( 2 );
431     param.Update();
432     fTracker->Initialize( param );
433     delete[] rowX;
434   }
435
436
437   // min and max patch numbers and row numbers
438
439   int row[2] = {0, 0};
440   int minPatch = 100, maxPatch = -1;
441
442   // total n Hits
443
444   int nClustersTotal = 0;
445
446   // sort patches
447
448   std::vector<unsigned long> patchIndices;
449
450   for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
451     iter = blocks + ndx;
452     if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;
453     if ( slice != AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) continue;
454     inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
455     nClustersTotal += inPtrSP->fSpacePointCnt;
456     int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
457     if ( minPatch > patch ) {
458       minPatch = patch;
459       row[0] = AliHLTTPCTransform::GetFirstRow( patch );
460     }
461     if ( maxPatch < patch ) {
462       maxPatch = patch;
463       row[1] = AliHLTTPCTransform::GetLastRow( patch );
464     }
465     std::vector<unsigned long>::iterator pIter = patchIndices.begin();
466     while ( pIter != patchIndices.end() && AliHLTTPCDefinitions::GetMinPatchNr( blocks[*pIter] ) < patch ) {
467       pIter++;
468     }
469     patchIndices.insert( pIter, ndx );
470   }
471
472
473   // pass event to CA Tracker
474
475
476   Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
477            "Total %d hits to read for slice %d", nClustersTotal, slice );
478
479
480   AliHLTTPCCAClusterData clusterData;
481   clusterData.StartReading( slice, nClustersTotal );
482
483   for ( std::vector<unsigned long>::iterator pIter = patchIndices.begin(); pIter != patchIndices.end(); pIter++ ) {
484     ndx = *pIter;
485     iter = blocks + ndx;
486
487     int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
488     inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
489
490     Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
491              "Reading %d hits for slice %d - patch %d", inPtrSP->fSpacePointCnt, slice, patch );
492
493     for ( unsigned int i = 0; i < inPtrSP->fSpacePointCnt; i++ ) {
494       AliHLTTPCSpacePointData *c = &( inPtrSP->fSpacePoints[i] );
495       if ( CAMath::Abs( c->fZ ) > fClusterZCut ) continue;
496       clusterData.ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
497     }
498   }
499
500   clusterData.FinishReading();
501
502   // reconstruct the event
503
504   TStopwatch timerReco;
505
506   fTracker->ReadEvent( &clusterData );
507
508   fTracker->Reconstruct();
509
510   timerReco.Stop();
511
512   int ret = 0;
513
514   Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reconstruct",
515            "%d tracks found for slice %d", fTracker->NOutTracks(), slice );
516
517
518   // write reconstructed tracks
519
520   unsigned int mySize = 0;
521   int ntracks = *fTracker->NOutTracks();
522
523
524   if ( !fNewOutputType ) {
525
526     AliHLTTPCTrackletData* outPtr = ( AliHLTTPCTrackletData* )( outputPtr );
527
528     AliHLTTPCTrackSegmentData* currOutTracklet = outPtr->fTracklets;
529
530     mySize =   ( ( AliHLTUInt8_t * )currOutTracklet ) -  ( ( AliHLTUInt8_t * )outputPtr );
531
532     outPtr->fTrackletCnt = 0;
533
534     for ( int itr = 0; itr < ntracks; itr++ ) {
535
536       AliHLTTPCCAOutTrack &t = fTracker->OutTracks()[itr];
537
538       //Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Wrtite output","track %d with %d hits", itr, t.NHits());
539
540       if ( t.NHits() < fMinNTrackClusters ) continue;
541
542       // calculate output track size
543
544       unsigned int dSize = sizeof( AliHLTTPCTrackSegmentData ) + t.NHits() * sizeof( unsigned int );
545
546       if ( mySize + dSize > maxBufferSize ) {
547         HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", maxBufferSize, mySize, ntracks - itr + 1 );
548         ret = -ENOSPC;
549         break;
550       }
551
552       // convert CA track parameters to HLT Track Segment
553
554       int iFirstRow = 1000;
555       int iLastRow = -1;
556       int iFirstHit = fTracker->OutTrackHits()[t.FirstHitRef()];
557       int iLastHit = iFirstHit;
558       for ( int ih = 0; ih < t.NHits(); ih++ ) {
559         int hitID = fTracker->OutTrackHits()[t.FirstHitRef() + ih ];
560         int iRow = clusterData.RowNumber( hitID );
561         if ( iRow < iFirstRow ) {  iFirstRow = iRow; iFirstHit = hitID; }
562         if ( iRow > iLastRow ) { iLastRow = iRow; iLastHit = hitID; }
563       }
564
565       AliHLTTPCCATrackParam par = t.StartPoint();
566
567       par.TransportToX( clusterData.X( iFirstHit ), .99 );
568
569       AliExternalTrackParam tp;
570       AliHLTTPCCATrackConvertor::GetExtParam( par, tp, 0 );
571
572       currOutTracklet->fX = tp.GetX();
573       currOutTracklet->fY = tp.GetY();
574       currOutTracklet->fZ = tp.GetZ();
575       currOutTracklet->fCharge = ( int ) tp.GetSign();
576       currOutTracklet->fPt = TMath::Abs( tp.GetSignedPt() );
577       float snp =  tp.GetSnp() ;
578       if ( snp > .999 ) snp = .999;
579       if ( snp < -.999 ) snp = -.999;
580       currOutTracklet->fPsi = TMath::ASin( snp );
581       currOutTracklet->fTgl = tp.GetTgl();
582
583       currOutTracklet->fY0err = tp.GetSigmaY2();
584       currOutTracklet->fZ0err = tp.GetSigmaZ2();
585       float h = -currOutTracklet->fPt * currOutTracklet->fPt;
586       currOutTracklet->fPterr = h * h * tp.GetSigma1Pt2();
587       h = 1. / TMath::Sqrt( 1 - snp * snp );
588       currOutTracklet->fPsierr = h * h * tp.GetSigmaSnp2();
589       currOutTracklet->fTglerr = tp.GetSigmaTgl2();
590
591       if ( par.TransportToX( clusterData.X( iLastHit ), .99 ) ) {
592         currOutTracklet->fLastX = par.GetX();
593         currOutTracklet->fLastY = par.GetY();
594         currOutTracklet->fLastZ = par.GetZ();
595       } else {
596         currOutTracklet->fLastX = clusterData.X( iLastHit );
597         currOutTracklet->fLastY = clusterData.Y( iLastHit );
598         currOutTracklet->fLastZ = clusterData.Z( iLastHit );
599       }
600       //if( currOutTracklet->fLastX<10. ) {
601       //HLTError("CA last point: hitxyz=%f,%f,%f, track=%f,%f,%f, tracklet=%f,%f,%f, nhits=%d",clusterData.X( iLastHit ),clusterData.Y( iLastHit],clusterData.Z( iLastHit],
602       //par.GetX(), par.GetY(),par.GetZ(),currOutTracklet->fLastX,currOutTracklet->fLastY ,currOutTracklet->fLastZ, t.NHits());
603       //}
604 #ifdef INCLUDE_TPC_HOUGH
605 #ifdef ROWHOUGHPARAMS
606       currOutTracklet->fTrackID = 0;
607       currOutTracklet->fRowRange1 = clusterData.RowNumber( iFirstHit );
608       currOutTracklet->fRowRange2 = clusterData.RowNumber( iLastHit );
609       currOutTracklet->fSector = slice;
610       currOutTracklet->fPID = 211;
611 #endif
612 #endif // INCLUDE_TPC_HOUGH
613
614
615       currOutTracklet->fNPoints = t.NHits();
616
617       for ( int i = 0; i < t.NHits(); i++ ) {
618         currOutTracklet->fPointIDs[i] = clusterData.Id( fTracker->OutTrackHits()[t.FirstHitRef()+i] );
619       }
620
621       currOutTracklet = ( AliHLTTPCTrackSegmentData* )( ( Byte_t * )currOutTracklet + dSize );
622       mySize += dSize;
623       outPtr->fTrackletCnt++;
624     }
625   } else { // new output type
626
627     mySize = fTracker->Output()->EstimateSize( fTracker->Output()->NTracks(),
628              fTracker->Output()->NTrackClusters() );
629     if ( mySize <= maxBufferSize ) {
630       const AliHLTUInt8_t* outputevent = reinterpret_cast<const AliHLTUInt8_t*>( fTracker->Output() );
631       for ( unsigned int i = 0; i < mySize; i++ ) outputPtr[i] = outputevent[i];
632     } else {
633       HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), tracks are not stored", maxBufferSize, mySize );
634       mySize = 0;
635       ret = -ENOSPC;
636     }
637   }
638
639   if ( mySize > 0 ) {
640     AliHLTComponentBlockData bd;
641     FillBlockData( bd );
642     bd.fOffset = 0;
643     bd.fSize = mySize;
644     bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch );
645     outputBlocks.push_back( bd );
646   }
647   size = mySize;
648
649   timer.Stop();
650
651   fFullTime += timer.RealTime();
652   fRecoTime += timerReco.RealTime();
653   fNEvents++;
654
655   // Set log level to "Warning" for on-line system monitoring
656   int hz = ( int ) ( fFullTime > 1.e-10 ? fNEvents / fFullTime : 100000 );
657   int hz1 = ( int ) ( fRecoTime > 1.e-10 ? fNEvents / fRecoTime : 100000 );
658   HLTInfo( "CATracker slice %d: output %d tracks;  input %d clusters, patches %d..%d, rows %d..%d; reco time %d/%d Hz",
659               slice, ntracks, nClustersTotal, minPatch, maxPatch, row[0], row[1], hz, hz1 );
660
661   return ret;
662 }
663
664