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 "AliHLTTPCCAOutTrack.h"
35 #include "AliHLTTPCCAParam.h"
36 #include "AliHLTTPCCATrackConvertor.h"
37 #include "AliHLTArray.h"
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"
49 #include "AliCDBEntry.h"
50 #include "AliCDBManager.h"
51 #include "TObjString.h"
52 #include "TObjArray.h"
53 #include "AliHLTTPCCASliceOutput.h"
54 #include "AliHLTTPCCAClusterData.h"
56 const AliHLTComponentDataType AliHLTTPCCADefinitions::fgkTrackletsDataType = AliHLTComponentDataTypeInitializer( "CATRACKL", kAliHLTDataOriginTPC );
58 /** ROOT macro for the implementation of ROOT specific class methods */
59 ClassImp( AliHLTTPCCATrackerComponent )
61 AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent()
65 fMinNTrackClusters( 0 ),
67 fNeighboursSearchArea( 0 ),
68 fClusterErrorCorrectionY(0),
69 fClusterErrorCorrectionZ(0),
75 // see header file for class documentation
77 // refer to README to build package
79 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
82 AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent( const AliHLTTPCCATrackerComponent& )
87 fMinNTrackClusters( 30 ),
89 fNeighboursSearchArea(0),
90 fClusterErrorCorrectionY(0),
91 fClusterErrorCorrectionZ(0),
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
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 );
132 AliHLTComponentDataType AliHLTTPCCATrackerComponent::GetOutputDataType()
134 // see header file for class documentation
135 if ( fOutputTRAKSEGS ) return AliHLTTPCDefinitions::fgkTrackSegmentsDataType;
136 else 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.5; // 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 = 0;
160 fNeighboursSearchArea = 0;
161 fClusterErrorCorrectionY = 0;
162 fClusterErrorCorrectionZ = 0;
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 fSolenoidBz = ( ( TObjString* )pTokens->At( i ) )->GetString().Atof();
191 HLTInfo( "Magnetic Field set to: %f", fSolenoidBz );
195 if ( argument.CompareTo( "-minNClustersOnTrack" ) == 0 ) {
196 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
197 fMinNTrackClusters = ( ( TObjString* )pTokens->At( i ) )->GetString().Atoi();
198 HLTInfo( "minNClustersOnTrack set to: %d", fMinNTrackClusters );
202 if ( argument.CompareTo( "-clusterZCut" ) == 0 ) {
203 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
204 fClusterZCut = TMath::Abs( ( ( TObjString* )pTokens->At( i ) )->GetString().Atof() );
205 HLTInfo( "ClusterZCut set to: %f", fClusterZCut );
209 if ( argument.CompareTo( "-neighboursSearchArea" ) == 0 ) {
210 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
211 fNeighboursSearchArea = TMath::Abs( ( ( TObjString* )pTokens->At( i ) )->GetString().Atof() );
212 HLTInfo( "NeighboursSearchArea set to: %f", fNeighboursSearchArea );
216 if ( argument.CompareTo( "-errorCorrectionY" ) == 0 ) {
217 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
218 fClusterErrorCorrectionY = ( ( TObjString* )pTokens->At( i ) )->GetString().Atof();
219 HLTInfo( "Cluster Y error correction factor set to: %f", fClusterErrorCorrectionY );
223 if ( argument.CompareTo( "-errorCorrectionZ" ) == 0 ) {
224 if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
225 fClusterErrorCorrectionZ = ( ( TObjString* )pTokens->At( i ) )->GetString().Atof();
226 HLTInfo( "Cluster Z error correction factor set to: %f", fClusterErrorCorrectionZ );
230 if ( argument.CompareTo( "-outputTRAKSEGS" ) == 0 ) {
232 HLTInfo( "The special output type \"TRAKSEGS\" is set" );
236 HLTError( "Unknown option \"%s\"", argument.Data() );
241 if ( bMissingParam ) {
242 HLTError( "Specifier missed for parameter \"%s\"", argument.Data() );
250 int AliHLTTPCCATrackerComponent::ReadCDBEntry( const char* cdbEntry, const char* chainId )
252 // see header file for class documentation
254 const char* defaultNotify = "";
257 cdbEntry = "HLT/ConfigTPC/TPCCATracker";
258 defaultNotify = " (default)";
262 HLTInfo( "configure from entry \"%s\"%s, chain id %s", cdbEntry, defaultNotify, ( chainId != NULL && chainId[0] != 0 ) ? chainId : "<none>" );
263 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get( cdbEntry );//,GetRunNo());
266 HLTError( "cannot fetch object \"%s\" from CDB", cdbEntry );
270 TObjString* pString = dynamic_cast<TObjString*>( pEntry->GetObject() );
273 HLTError( "configuration object \"%s\" has wrong type, required TObjString", cdbEntry );
277 HLTInfo( "received configuration object string: \"%s\"", pString->GetString().Data() );
279 return ReadConfigurationString( pString->GetString().Data() );
283 int AliHLTTPCCATrackerComponent::Configure( const char* cdbEntry, const char* chainId, const char *commandLine )
285 // Configure the component
286 // There are few levels of configuration,
287 // parameters which are set on one step can be overwritten on the next step
289 //* read hard-coded values
291 SetDefaultConfiguration();
293 //* read the default CDB entry
295 int iResult1 = ReadCDBEntry( NULL, chainId );
297 //* read magnetic field
299 int iResult2 = ReadCDBEntry( kAliHLTCDBSolenoidBz, chainId );
301 //* read the actual CDB entry if required
303 int iResult3 = ( cdbEntry ) ? ReadCDBEntry( cdbEntry, chainId ) : 0;
305 //* read extra parameters from input (if they are)
309 if ( commandLine && commandLine[0] != '\0' ) {
310 HLTInfo( "received configuration string from HLT framework: \"%s\"", commandLine );
311 iResult4 = ReadConfigurationString( commandLine );
314 // Initialise the tracker here
316 return iResult1 ? iResult1 : ( iResult2 ? iResult2 : ( iResult3 ? iResult3 : iResult4 ) );
321 int AliHLTTPCCATrackerComponent::DoInit( int argc, const char** argv )
323 // Configure the CA tracker component
325 if ( fTracker ) return EINPROGRESS;
328 fTracker = new AliHLTTPCCATrackerFramework();
330 TString arguments = "";
331 for ( int i = 0; i < argc; i++ ) {
332 if ( !arguments.IsNull() ) arguments += " ";
333 arguments += argv[i];
336 return Configure( NULL, NULL, arguments.Data() );
340 int AliHLTTPCCATrackerComponent::DoDeinit()
342 // see header file for class documentation
350 int AliHLTTPCCATrackerComponent::Reconfigure( const char* cdbEntry, const char* chainId )
352 // Reconfigure the component from OCDB .
354 return Configure( cdbEntry, chainId, NULL );
358 bool AliHLTTPCCATrackerComponent::CompareClusters( AliHLTTPCSpacePointData *a, AliHLTTPCSpacePointData *b )
360 //* Comparison function for sort clusters
362 if ( a->fPadRow < b->fPadRow ) return 1;
363 if ( a->fPadRow > b->fPadRow ) return 0;
364 return ( a->fZ < b->fZ );
369 int AliHLTTPCCATrackerComponent::DoEvent
371 const AliHLTComponentEventData& evtData,
372 const AliHLTComponentBlockData* blocks,
373 AliHLTComponentTriggerData& /*trigData*/,
374 AliHLTUInt8_t* outputPtr,
375 AliHLTUInt32_t& size,
376 vector<AliHLTComponentBlockData>& outputBlocks )
380 AliHLTUInt32_t maxBufferSize = size;
381 size = 0; // output size
383 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) ) {
389 // Event reconstruction in one TPC slice with CA Tracker
391 //Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "CA::DoEvent()" );
392 if ( evtData.fBlockCnt <= 0 ) {
393 HLTWarning( "no blocks in event" );
397 const AliHLTComponentBlockData* iter = NULL;
399 AliHLTTPCClusterData* inPtrSP;
401 // Determine the slice number
403 //Find min and max slice number with now slice missing in between (for default output)
404 int minslice = -1, maxslice = -1;
407 std::vector<int> slices;
408 std::vector<int>::iterator slIter;
409 std::vector<unsigned> sliceCnts;
410 std::vector<unsigned>::iterator slCntIter;
412 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
414 if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;
416 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
417 if (slice < minslice || minslice == -1) minslice = slice;
418 if (slice > maxslice) maxslice = slice;
421 slCntIter = sliceCnts.begin();
422 for ( slIter = slices.begin(); slIter != slices.end(); slIter++, slCntIter++ ) {
423 if ( *slIter == slice ) {
429 slices.push_back( slice );
430 sliceCnts.push_back( 1 );
434 if ( slices.size() == 0 ) {
435 HLTWarning( "no slices found in event" );
440 // Determine slice number to really use. (for obsolete output)
441 if ( slices.size() > 1 ) {
442 Logging( fOutputTRAKSEGS ? kHLTLogError : kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
443 "Multiple slice numbers found in event 0x%08lX (%lu). Determining maximum occuring slice number...",
444 evtData.fEventID, evtData.fEventID );
445 unsigned maxCntSlice = 0;
446 slCntIter = sliceCnts.begin();
447 for ( slIter = slices.begin(); slIter != slices.end(); slIter++, slCntIter++ ) {
448 Logging( fOutputTRAKSEGS ? kHLTLogError : kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
449 "Slice %lu found %lu times.", *slIter, *slCntIter );
450 if ( fOutputTRAKSEGS && maxCntSlice < *slCntIter ) {
451 maxCntSlice = *slCntIter;
457 Logging( kHLTLogError, "HLT::TPCSliceTracker::DoEvent", "Multiple slices found in event",
458 "Using slice %lu.", slice );
460 } else if ( slices.size() > 0 ) {
461 slice = *( slices.begin() );
467 minslice = maxslice = slice;
471 for (int islice = minslice;islice <= maxslice;islice++)
474 for(slIter = slices.begin(); slIter != slices.end();slIter++)
476 if (*slIter == islice)
484 maxslice = islice - 1;
491 if ( !fTracker ) fTracker = new AliHLTTPCCATrackerFramework;
492 int slicecount = maxslice + 1 - minslice;
493 if (slicecount > fTracker->MaxSliceCount())
495 maxslice = minslice + (slicecount = fTracker->MaxSliceCount());
497 int nClustersTotalSum = 0;
498 AliHLTTPCCAClusterData* clusterData = new AliHLTTPCCAClusterData[slicecount];
501 // min and max patch numbers and row numbers
502 int* slicerow = new int[slicecount * 2];
503 int* sliceminPatch = new int[slicecount];
504 int* slicemaxPatch = new int[slicecount];
505 memset(slicerow, 0, slicecount * 2 * sizeof(int));
506 for (int i = 0;i < slicecount;i++)
508 sliceminPatch[i] = 100;
509 slicemaxPatch[i] = -1;
512 //Prepare everything for all slices
514 for (int islice = 0;islice < slicecount;islice++)
516 slice = minslice + islice;
518 // Initialize the tracker slice
521 float inRmin = 83.65;
522 // float inRmax = 133.3;
523 // float outRmin = 133.5;
524 float outRmax = 247.7;
525 float plusZmin = 0.0529937;
526 float plusZmax = 249.778;
527 float minusZmin = -249.645;
528 float minusZmax = -0.0799937;
529 float dalpha = 0.349066;
530 float alpha = 0.174533 + dalpha * iSec;
532 bool zPlus = ( iSec < 18 );
533 float zMin = zPlus ? plusZmin : minusZmin;
534 float zMax = zPlus ? plusZmax : minusZmax;
535 //TPCZmin = -249.645, ZMax = 249.778
536 // float rMin = inRmin;
537 // float rMax = outRmax;
538 int nRows = AliHLTTPCTransform::GetNRows();
540 float padPitch = 0.4;
541 float sigmaZ = 0.228808;
543 float *rowX = new float [nRows];
544 for ( int irow = 0; irow < nRows; irow++ ) {
545 rowX[irow] = AliHLTTPCTransform::Row2X( irow );
548 AliHLTTPCCAParam param;
550 param.Initialize( iSec, nRows, rowX, alpha, dalpha,
551 inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, fSolenoidBz );
552 param.SetHitPickUpFactor( 2 );
553 if( fNeighboursSearchArea>0 ) param.SetNeighboursSearchArea( fNeighboursSearchArea );
554 if( fClusterErrorCorrectionY>1.e-4 ) param.SetClusterError2CorrectionY( fClusterErrorCorrectionY*fClusterErrorCorrectionY );
555 if( fClusterErrorCorrectionZ>1.e-4 ) param.SetClusterError2CorrectionZ( fClusterErrorCorrectionZ*fClusterErrorCorrectionZ );
557 fTracker->InitializeSliceParam( slice, param );
562 int nClustersTotal = 0;
565 std::vector<unsigned long> patchIndices;
567 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) {
569 if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;
570 if ( slice != AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) continue;
571 inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
572 nClustersTotal += inPtrSP->fSpacePointCnt;
573 int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
574 if ( sliceminPatch[islice] > patch ) {
575 sliceminPatch[islice] = patch;
576 slicerow[2 * islice + 0] = AliHLTTPCTransform::GetFirstRow( patch );
578 if ( slicemaxPatch[islice] < patch ) {
579 slicemaxPatch[islice] = patch;
580 slicerow[2 * islice + 1] = AliHLTTPCTransform::GetLastRow( patch );
582 std::vector<unsigned long>::iterator pIter = patchIndices.begin();
583 while ( pIter != patchIndices.end() && AliHLTTPCDefinitions::GetMinPatchNr( blocks[*pIter] ) < patch ) {
586 patchIndices.insert( pIter, ndx );
590 // pass event to CA Tracker
593 Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
594 "Total %d hits to read for slice %d", nClustersTotal, slice );
597 clusterData[islice].StartReading( slice, nClustersTotal );
599 for ( std::vector<unsigned long>::iterator pIter = patchIndices.begin(); pIter != patchIndices.end(); pIter++ ) {
603 int patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
604 inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
606 Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reading hits",
607 "Reading %d hits for slice %d - patch %d", inPtrSP->fSpacePointCnt, slice, patch );
609 for ( unsigned int i = 0; i < inPtrSP->fSpacePointCnt; i++ ) {
610 AliHLTTPCSpacePointData *c = &( inPtrSP->fSpacePoints[i] );
611 if ( CAMath::Abs( c->fZ ) > fClusterZCut ) continue;
612 if ( c->fPadRow > 159 ) {
613 HLTError( "Wrong TPC cluster with row number %d received", c->fPadRow );
616 clusterData[islice].ReadCluster( c->fID, c->fPadRow, c->fX, c->fY, c->fZ, c->fCharge );
620 clusterData[islice].FinishReading();
621 nClustersTotalSum += nClustersTotal;
625 AliHLTTPCCASliceOutput::outputControlStruct outputControl;
626 //Set tracker output so tracker does not have to output both formats!
627 outputControl.fObsoleteOutput = fOutputTRAKSEGS;
628 outputControl.fDefaultOutput = !fOutputTRAKSEGS;
630 //For new output we can write directly to output buffer
631 outputControl.fOutputPtr = fOutputTRAKSEGS ? NULL : (char*) outputPtr;
632 outputControl.fOutputMaxSize = maxBufferSize;
634 AliHLTTPCCASliceOutput** sliceOutput = new AliHLTTPCCASliceOutput*[slicecount];
635 memset(sliceOutput, 0, slicecount * sizeof(AliHLTTPCCASliceOutput*));
637 // reconstruct the event
638 TStopwatch timerReco;
639 fTracker->SetOutputControl(&outputControl);
640 fTracker->ProcessSlices(minslice, slicecount, clusterData, sliceOutput);
644 unsigned int mySize = 0;
648 for (int islice = 0;islice < slicecount;islice++)
650 slice = minslice + islice;
652 if (sliceOutput[islice])
654 // write reconstructed tracks
656 if ( fOutputTRAKSEGS ) {
658 Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reconstruct",
659 "%d tracks found for slice %d", sliceOutput[islice]->NOutTracks(), slice );
661 ntracks = sliceOutput[islice]->NOutTracks();
663 AliHLTTPCTrackletData* outPtr = ( AliHLTTPCTrackletData* )( outputPtr );
665 AliHLTTPCTrackSegmentData* currOutTracklet = outPtr->fTracklets;
667 mySize = ( ( AliHLTUInt8_t * )currOutTracklet ) - ( ( AliHLTUInt8_t * )outputPtr );
669 outPtr->fTrackletCnt = 0;
671 for ( int itr = 0; itr < ntracks; itr++ ) {
673 AliHLTTPCCAOutTrack &t = sliceOutput[islice]->OutTracks()[itr];
675 //Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Wrtite output","track %d with %d hits", itr, t.NHits());
677 if ( t.NHits() < fMinNTrackClusters ) continue;
679 // calculate output track size
681 unsigned int dSize = sizeof( AliHLTTPCTrackSegmentData ) + t.NHits() * sizeof( unsigned int );
683 if ( mySize + dSize > maxBufferSize ) {
684 HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", maxBufferSize, mySize, ntracks - itr + 1 );
690 // convert CA track parameters to HLT Track Segment
692 int iFirstRow = 1000;
694 int iFirstHit = sliceOutput[islice]->OutTrackHit(t.FirstHitRef());
695 int iLastHit = iFirstHit;
696 for ( int ih = 0; ih < t.NHits(); ih++ ) {
697 int hitID = sliceOutput[islice]->OutTrackHit(t.FirstHitRef() + ih);
698 int iRow = clusterData[islice].RowNumber( hitID );
699 if ( iRow < iFirstRow ) { iFirstRow = iRow; iFirstHit = hitID; }
700 if ( iRow > iLastRow ) { iLastRow = iRow; iLastHit = hitID; }
703 AliHLTTPCCATrackParam par = t.StartPoint();
705 par.TransportToX( clusterData[islice].X( iFirstHit ), .99 );
707 AliExternalTrackParam tp;
708 AliHLTTPCCATrackConvertor::GetExtParam( par, tp, 0 );
710 currOutTracklet->fX = tp.GetX();
711 currOutTracklet->fY = tp.GetY();
712 currOutTracklet->fZ = tp.GetZ();
713 currOutTracklet->fCharge = ( int ) tp.GetSign();
714 currOutTracklet->fPt = TMath::Abs( tp.GetSignedPt() );
715 float snp = tp.GetSnp() ;
716 if ( snp > .999 ) snp = .999;
717 if ( snp < -.999 ) snp = -.999;
718 currOutTracklet->fPsi = TMath::ASin( snp );
719 currOutTracklet->fTgl = tp.GetTgl();
721 currOutTracklet->fY0err = tp.GetSigmaY2();
722 currOutTracklet->fZ0err = tp.GetSigmaZ2();
723 float h = -currOutTracklet->fPt * currOutTracklet->fPt;
724 currOutTracklet->fPterr = h * h * tp.GetSigma1Pt2();
725 h = 1. / TMath::Sqrt( 1 - snp * snp );
726 currOutTracklet->fPsierr = h * h * tp.GetSigmaSnp2();
727 currOutTracklet->fTglerr = tp.GetSigmaTgl2();
729 if ( par.TransportToX( clusterData[islice].X( iLastHit ), .99 ) ) {
730 currOutTracklet->fLastX = par.GetX();
731 currOutTracklet->fLastY = par.GetY();
732 currOutTracklet->fLastZ = par.GetZ();
734 currOutTracklet->fLastX = clusterData[islice].X( iLastHit );
735 currOutTracklet->fLastY = clusterData[islice].Y( iLastHit );
736 currOutTracklet->fLastZ = clusterData[islice].Z( iLastHit );
738 //if( currOutTracklet->fLastX<10. ) {
739 //HLTError("CA last point: hitxyz=%f,%f,%f, track=%f,%f,%f, tracklet=%f,%f,%f, nhits=%d",clusterData[islice].X( iLastHit ),clusterData[islice].Y( iLastHit],clusterData[islice].Z( iLastHit],
740 //par.GetX(), par.GetY(),par.GetZ(),currOutTracklet->fLastX,currOutTracklet->fLastY ,currOutTracklet->fLastZ, t.NHits());
742 #ifdef INCLUDE_TPC_HOUGH
743 #ifdef ROWHOUGHPARAMS
744 currOutTracklet->fTrackID = 0;
745 currOutTracklet->fRowRange1 = clusterData[islice].RowNumber( iFirstHit );
746 currOutTracklet->fRowRange2 = clusterData[islice].RowNumber( iLastHit );
747 currOutTracklet->fSector = slice;
748 currOutTracklet->fPID = 211;
750 #endif // INCLUDE_TPC_HOUGH
753 currOutTracklet->fNPoints = t.NHits();
755 for ( int i = 0; i < t.NHits(); i++ ) {
756 currOutTracklet->fPointIDs[i] = clusterData[islice].Id( sliceOutput[islice]->OutTrackHit(t.FirstHitRef()+i) );
759 currOutTracklet = ( AliHLTTPCTrackSegmentData* )( ( Byte_t * )currOutTracklet + dSize );
761 outPtr->fTrackletCnt++;
764 } else { // default output type
766 Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reconstruct",
767 "%d tracks found for slice %d", sliceOutput[islice]->NTracks(), slice );
769 mySize += sliceOutput[islice]->OutputMemorySize();
770 ntracks += sliceOutput[islice]->NTracks();
775 HLTWarning( "Output buffer size exceed (buffer size %d, current size %d), tracks are not stored", maxBufferSize, mySize );
787 for (int islice = 0;islice < slicecount;islice++)
789 slice = minslice + islice;
790 if (!fOutputTRAKSEGS) mySize = sliceOutput[islice]->OutputMemorySize();
793 AliHLTComponentBlockData bd;
795 bd.fOffset = fOutputTRAKSEGS ? 0 : ((char*) sliceOutput[islice] - (char*) outputPtr);
797 bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, sliceminPatch[islice], slicemaxPatch[islice] );
798 bd.fDataType = GetOutputDataType();
799 outputBlocks.push_back( bd );
806 delete[] clusterData;
807 //These are only temporary pointers to the output and no longer needed
808 delete[] sliceOutput;
812 fFullTime += timer.RealTime();
813 fRecoTime += timerReco.RealTime();
816 // Set log level to "Warning" for on-line system monitoring
817 int hz = ( int ) ( fFullTime > 1.e-10 ? fNEvents / fFullTime : 100000 );
818 int hz1 = ( int ) ( fRecoTime > 1.e-10 ? fNEvents / fRecoTime : 100000 );
819 //Min and Max Patch are taken for first slice processed...
820 HLTInfo( "CATracker slices %d-%d: output %d tracks; input %d clusters, patches %d..%d, rows %d..%d; time: full %d / reco %d Hz",
821 minslice, maxslice, ntracks, nClustersTotalSum, sliceminPatch[0], slicemaxPatch[0], slicerow[0], slicerow[1], hz, hz1 );