// @(#) $Id$
-//***************************************************************************
+// **************************************************************************
// This file is property of and copyright by the ALICE HLT Project *
// ALICE Experiment at CERN, All rights reserved. *
// *
// appear in the supporting documentation. The authors make no claims *
// about the suitability of this software for any purpose. It is *
// provided "as is" without express or implied warranty. *
+// *
//***************************************************************************
+
///////////////////////////////////////////////////////////////////////////////
// //
using namespace std;
#endif
-#include <climits>
#include "AliHLTTPCCATrackerComponent.h"
#include "AliHLTTPCTransform.h"
#include "AliHLTTPCCATracker.h"
-#include "AliHLTTPCCAHit.h"
#include "AliHLTTPCCAOutTrack.h"
#include "AliHLTTPCCAParam.h"
#include "AliHLTTPCCATrackConvertor.h"
#include "AliExternalTrackParam.h"
#include "TStopwatch.h"
#include "TMath.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "TObjString.h"
+#include "TObjArray.h"
+#include "AliHLTTPCCASliceOutput.h"
+
+const AliHLTComponentDataType AliHLTTPCCADefinitions::fgkTrackletsDataType = AliHLTComponentDataTypeInitializer( "CATRACKL", kAliHLTDataOriginTPC );
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTPCCATrackerComponent)
+/** global object for registration
+ * Matthias 2009-01-13 temporarily using the global object approach again.
+ * CA cade had to be disabled because of various compilation problems, so
+ * the global object approach fits better for the moment.
+ */
+
+AliHLTTPCCATrackerComponent gAliHLTTPCCATrackerComponent;
+
AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent()
:
fTracker(NULL),
fSolenoidBz(0),
fMinNTrackClusters(0),
- fCellConnectionAngleXY(45),
- fCellConnectionAngleXZ(45),
fClusterZCut(500.),
fFullTime(0),
fRecoTime(0),
- fNEvents(0)
+ fNEvents(0),
+ fNewOutputType(0)
{
// see header file for class documentation
// or
fTracker(NULL),
fSolenoidBz(0),
fMinNTrackClusters(30),
- fCellConnectionAngleXY(35),
- fCellConnectionAngleXZ(35),
fClusterZCut(500.),
- fFullTime(0),
+ fFullTime(0),
fRecoTime(0),
- fNEvents(0)
+ fNEvents(0),
+ fNewOutputType(0)
{
// see header file for class documentation
HLTFatal("copy constructor untested");
AliHLTComponentDataType AliHLTTPCCATrackerComponent::GetOutputDataType()
{
// see header file for class documentation
- return AliHLTTPCDefinitions::fgkTrackSegmentsDataType;
+ if( fNewOutputType ) return AliHLTTPCCADefinitions::fgkTrackletsDataType;
+ else return AliHLTTPCDefinitions::fgkTrackSegmentsDataType;
}
void AliHLTTPCCATrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
return new AliHLTTPCCATrackerComponent;
}
-int AliHLTTPCCATrackerComponent::DoInit( int argc, const char** argv )
+Int_t AliHLTTPCCATrackerComponent::DoInit( Int_t argc, const char** argv )
{
- // Initialize the CA tracker component
- //
- // arguments could be:
- // solenoidBz - the magnetic field value
- // minNTrackClusters - required minimum of clusters on the track
- //
-
- if ( fTracker ) return EINPROGRESS;
+ // Configure the CA tracker component
+ fSolenoidBz = 5;
+ fMinNTrackClusters = 0;
+ fClusterZCut = 500.;
fFullTime = 0;
fRecoTime = 0;
- fNEvents = 0;
+ fNEvents = 0;
+ fNewOutputType = 0;
+ if ( fTracker ) return EINPROGRESS;
fTracker = new AliHLTTPCCATracker();
- // read command line
-
- int i = 0;
- char* cpErr;
- while ( i < argc ){
- if ( !strcmp( argv[i], "solenoidBz" ) || !strcmp( argv[i], "-solenoidBz" ) ){
- if ( i+1 >= argc )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing solenoidBz", "Missing solenoidBz specifier." );
- return ENOTSUP;
- }
- fSolenoidBz = strtod( argv[i+1], &cpErr );
- if ( *cpErr )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing multiplicity", "Cannot convert solenoidBz specifier '%s'.", argv[i+1] );
- return EINVAL;
- }
-
- Logging( kHLTLogInfo, "HLT::TPCCATracker::DoInit", "Reading command line",
- "Magnetic field value is set to %f kG", fSolenoidBz );
-
- i += 2;
- continue;
- }
-
- if ( !strcmp( argv[i], "minNTrackClusters" ) || !strcmp( argv[i], "-minNTrackClusters" ) ){
- if ( i+1 >= argc )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing minNTrackClusters", "Missing minNTrackClusters specifier." );
- return ENOTSUP;
- }
- fMinNTrackClusters = (Int_t ) strtod( argv[i+1], &cpErr );
- if ( *cpErr )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing multiplicity", "Cannot convert minNTrackClusters '%s'.", argv[i+1] );
- return EINVAL;
- }
-
- Logging( kHLTLogInfo, "HLT::TPCCATracker::DoInit", "Reading command line",
- "minNTrackClusters is set to %i ", fMinNTrackClusters );
+ Int_t iResult = 0;
- i += 2;
- continue;
- }
-
- if ( !strcmp( argv[i], "cellConnectionAngleXY" ) || !strcmp( argv[i], "-cellConnectionAngleXY" ) ){
- if ( i+1 >= argc )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing cellConnectionAngleXY", "Missing cellConnectionAngleXY specifier." );
- return ENOTSUP;
- }
- fCellConnectionAngleXY = strtod( argv[i+1], &cpErr );
- if ( *cpErr )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing multiplicity", "Cannot convert cellConnectionAngleXY '%s'.", argv[i+1] );
- return EINVAL;
- }
-
- Logging( kHLTLogInfo, "HLT::TPCCATracker::DoInit", "Reading command line",
- "cellConnectionAngleXY is set to %f ", fCellConnectionAngleXY );
+ TString arguments="";
+ for (int i=0; i<argc; i++) {
+ TString argument=argv[i];
+ if (!arguments.IsNull()) arguments+=" ";
+ arguments+=argument;
+ }
+ if (!arguments.IsNull()) {
+ iResult=Configure(arguments.Data());
+ } else {
+ iResult=Reconfigure(NULL, NULL);
+ }
+ return iResult;
+}
- i += 2;
- continue;
- }
- if ( !strcmp( argv[i], "cellConnectionAngleXZ" ) || !strcmp( argv[i], "-cellConnectionAngleXZ" ) ){
- if ( i+1 >= argc )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing cellConnectionAngleXZ", "Missing cellConnectionAngleXZ specifier." );
- return ENOTSUP;
- }
- fCellConnectionAngleXZ = strtod( argv[i+1], &cpErr );
- if ( *cpErr )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing multiplicity", "Cannot convert cellConnectionAngleXZ '%s'.", argv[i+1] );
- return EINVAL;
- }
- Logging( kHLTLogInfo, "HLT::TPCCATracker::DoInit", "Reading command line",
- "cellConnectionAngleXZ is set to %f ", fCellConnectionAngleXZ );
+Int_t AliHLTTPCCATrackerComponent::DoDeinit()
+{
+ // see header file for class documentation
+ if ( fTracker ) delete fTracker;
+ fTracker = NULL;
+ return 0;
+}
- i += 2;
- continue;
- }
- if ( !strcmp( argv[i], "clusterZCut" ) || !strcmp( argv[i], "-clusterZCut" ) ){
- if ( i+1 >= argc )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing clusterZCut", "Missing clusterZCut specifier." );
- return ENOTSUP;
- }
- fClusterZCut = TMath::Abs(strtod( argv[i+1], &cpErr ));
- if ( *cpErr )
- {
- Logging( kHLTLogError, "HLT::TPCCATracker::DoInit", "Missing multiplicity", "Cannot convert clusterZCut '%s'.", argv[i+1] );
- return EINVAL;
- }
+Int_t AliHLTTPCCATrackerComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
+{
+ // see header file for class documentation
+
+ HLTWarning("TODO: dummy Reconfigure() method" );
- Logging( kHLTLogInfo, "HLT::TPCCATracker::DoInit", "Reading command line",
- "clusterZCut is set to %f ", fClusterZCut );
+ return 0;
- i += 2;
- continue;
+ /*
+
+ Int_t iResult=0;
+ const char* path="HLT/ConfigTPC/CATrackerComponent";
+ const char* defaultNotify="";
+ if (cdbEntry) {
+ path=cdbEntry;
+ defaultNotify=" (default)";
+ }
+ if (path) {
+ HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+ AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
+ if (pEntry) {
+ TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+ if (pString) {
+ HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
+ iResult=Configure(pString->GetString().Data());
+ } else {
+ HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+ }
+ } else {
+ HLTError("cannot fetch object \"%s\" from CDB", path);
}
-
- Logging(kHLTLogError, "HLT::TPCCATracker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
- return EINVAL;
}
- return 0;
+ const char* pathBField=kAliHLTCDBSolenoidBz;
+
+ if (pathBField) {
+ HLTInfo("reconfigure B-Field from entry %s, chain id %s", path,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+ AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField);//,GetRunNo());
+ if (pEntry) {
+ TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+ if (pString) {
+ HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
+ iResult=Configure(pString->GetString().Data());
+ } else {
+ HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+ }
+ } else {
+ HLTError("cannot fetch object \"%s\" from CDB", path);
+ }
+ }
+ return iResult;
+*/
}
-int AliHLTTPCCATrackerComponent::DoDeinit()
-{
- // see header file for class documentation
- if ( fTracker ) delete fTracker;
- fTracker = NULL;
- return 0;
-}
Bool_t AliHLTTPCCATrackerComponent::CompareClusters(AliHLTTPCSpacePointData *a, AliHLTTPCSpacePointData *b)
{
return (a->fZ < b->fZ);
}
-int AliHLTTPCCATrackerComponent::DoEvent
+
+Int_t AliHLTTPCCATrackerComponent::Configure( const char* arguments )
+{
+ //* Set parameters
+
+ Int_t iResult=0;
+ if (!arguments) return iResult;
+
+ TString allArgs=arguments;
+ TString argument;
+ Int_t bMissingParam=0;
+
+ TObjArray* pTokens=allArgs.Tokenize(" ");
+
+ Int_t nArgs = pTokens ?pTokens->GetEntries() :0;
+
+ for (int i=0; i<nArgs; i++ ){
+ argument=((TObjString*)pTokens->At(i))->GetString();
+ if (argument.IsNull()){
+ }
+ else if (argument.CompareTo("-solenoidBz")==0 ){
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ fSolenoidBz = ((TObjString*)pTokens->At(i))->GetString().Atof();
+ HLTInfo("Magnetic Field set to: %f", fSolenoidBz );
+ }
+ else if ( argument.CompareTo("-minNClustersOnTrack")==0 ||
+ argument.CompareTo("-minNTrackClusters")==0 ){
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ fMinNTrackClusters = ((TObjString*)pTokens->At(i))->GetString().Atoi();
+ HLTInfo("minNClustersOnTrack set to: %d", fMinNTrackClusters );
+ }
+ else if ( argument.CompareTo("-clusterZCut")==0 ){
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ fClusterZCut = TMath::Abs( ((TObjString*)pTokens->At(i))->GetString().Atof());
+ HLTInfo("ClusterZCut set to: %f", fClusterZCut );
+ }
+ else if ( argument.CompareTo("-newOutputType")==0 ){
+ fNewOutputType = 1;
+ HLTInfo("NewOutputType is set");
+ }
+ else {
+ HLTError("Unknown option %s ", argument.Data());
+ iResult=-EINVAL;
+ }
+ }
+ delete pTokens;
+
+ if (bMissingParam) {
+ HLTError("Specifier missed for %s", argument.Data());
+ iResult=-EINVAL;
+ }
+
+ return iResult;
+}
+
+
+
+
+Int_t AliHLTTPCCATrackerComponent::DoEvent
(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
AliHLTUInt32_t& size,
vector<AliHLTComponentBlockData>& outputBlocks )
{
-
- AliHLTUInt32_t MaxBufferSize = size;
+ //* process event
+ AliHLTUInt32_t maxBufferSize = size;
size = 0; // output size
if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){
//Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "CA::DoEvent()" );
if ( evtData.fBlockCnt<=0 )
{
- Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "no blocks in event" );
+ HLTWarning("no blocks in event" );
return 0;
}
}
if( slice<0 ){
- Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "DoEvent", "CA:: no slices found in event" );
+ HLTWarning("no slices found in event" );
return 0;
}
// Initialize the tracker
- Float_t Bz = fSolenoidBz;
{
if( !fTracker ) fTracker = new AliHLTTPCCATracker;
//TPCZmin = -249.645, ZMax = 249.778
// Float_t rMin = inRmin;
// Float_t rMax = outRmax;
- Int_t NRows = AliHLTTPCTransform::GetNRows();
+ Int_t nRows = AliHLTTPCTransform::GetNRows();
Float_t padPitch = 0.4;
Float_t sigmaZ = 0.228808;
- Float_t *rowX = new Float_t [NRows];
- for( Int_t irow=0; irow<NRows; irow++){
+ Float_t *rowX = new Float_t [nRows];
+ for( Int_t irow=0; irow<nRows; irow++){
rowX[irow] = AliHLTTPCTransform::Row2X( irow );
}
AliHLTTPCCAParam param;
- param.Initialize( iSec, NRows, rowX, alpha, dalpha,
- inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, Bz );
- param.YErrorCorrection() = 1;
- param.ZErrorCorrection() = 2;
- param.CellConnectionAngleXY() = fCellConnectionAngleXY/180.*TMath::Pi();
- param.CellConnectionAngleXZ() = fCellConnectionAngleXZ/180.*TMath::Pi();
+ param.Initialize( iSec, nRows, rowX, alpha, dalpha,
+ inRmin, outRmax, zMin, zMax, padPitch, sigmaZ, fSolenoidBz );
+ param.SetHitPickUpFactor( 2 );
param.Update();
fTracker->Initialize( param );
delete[] rowX;
// min and max patch numbers and row numbers
Int_t row[2] = {0,0};
- Int_t minPatch=INT_MAX, maxPatch = -1;
+ Int_t minPatch=100, maxPatch = -1;
// total n Hits
sort( vOrigClusters, vOrigClusters+nClusters, CompareClusters );
- AliHLTTPCCAHit *vHits = new AliHLTTPCCAHit [nHitsTotal]; // CA hit array
Float_t *vHitStoreX = new Float_t [nHitsTotal]; // hit X coordinates
Float_t *vHitStoreY = new Float_t [nHitsTotal]; // hit Y coordinates
Float_t *vHitStoreZ = new Float_t [nHitsTotal]; // hit Z coordinates
+ Int_t *vHitStoreIntID = new Int_t [nHitsTotal]; // hit ID's
Int_t *vHitStoreID = new Int_t [nHitsTotal]; // hit ID's
Int_t *vHitRowID = new Int_t [nHitsTotal]; // hit ID's
Int_t nHits = 0;
-
+
{
+ Int_t rowNHits[200];
+ Int_t rowFirstHits[200];
+ for( Int_t ir=0; ir<200; ir++ ) rowNHits[ir] = 0;
Int_t oldRow = -1;
- Int_t nRowHits = 0;
- Int_t firstRowHit = 0;
-
for (Int_t i=0; i<nClusters; i++ ){
AliHLTTPCSpacePointData* pSP = vOrigClusters[i];
- if( pSP->fPadRow != oldRow ){
- if( oldRow>=0 ){
- if( fTracker->Rows()[oldRow].NHits()!=0 ) HLTError("CA: clusters from row %d are readed twice",oldRow);
- fTracker->ReadHitRow( oldRow, vHits+firstRowHit, nRowHits );
- }
- oldRow = pSP->fPadRow;
- firstRowHit = nHits;
- nRowHits = 0;
- }
- AliHLTTPCCAHit &h = vHits[nHits];
- //if( TMath::Abs(pSP->fX- fTracker->Rows()[pSP->fPadRow].X() )>1.e-4 ) cout<<"row "<<(Int_t)pSP->fPadRow<<" "<<fTracker->Rows()[pSP->fPadRow].X()-pSP->fX <<endl;
- if( TMath::Abs(pSP->fX- fTracker->Rows()[pSP->fPadRow].X() )>1.e-4 ) HLTError( "row %d, %f",(Int_t)pSP->fPadRow, fTracker->Rows()[pSP->fPadRow].X()-pSP->fX );
-
- h.Y() = pSP->fY;
- h.Z() = pSP->fZ;
- if( TMath::Abs(h.Z())>fClusterZCut) continue;
- h.ErrY() = TMath::Sqrt(TMath::Abs(pSP->fSigmaY2));
- h.ErrZ() = TMath::Sqrt(TMath::Abs(pSP->fSigmaZ2));
- if( h.ErrY()<.1 ) h.ErrY() = .1;
- if( h.ErrZ()<.1 ) h.ErrZ() = .1;
- if( h.ErrY()>1. ) h.ErrY() = 1.;
- if( h.ErrZ()>1. ) h.ErrZ() = 1.;
- h.ID() = nHits;
- vHitStoreX[nHits] = pSP->fX;
- vHitStoreY[nHits] = h.Y();
- vHitStoreZ[nHits] = h.Z();
+ if( oldRow>=0 && pSP->fPadRow < oldRow )
+ HLTError("CA: clusters from row %d are readed twice",oldRow);
+
+ if( TMath::Abs(pSP->fZ)>fClusterZCut) continue;
+
+ vHitStoreX[nHits] = pSP->fX;
+ vHitStoreY[nHits] = pSP->fY;
+ vHitStoreZ[nHits] = pSP->fZ;
+ vHitStoreIntID[nHits] = nHits;
vHitStoreID[nHits] = pSP->fID;
vHitRowID[nHits] = pSP->fPadRow;
- nHits++;
- nRowHits++;
+ nHits++;
+ rowNHits[pSP->fPadRow]++;
}
- if( oldRow>=0 ){
- if( fTracker->Rows()[oldRow].NHits()!=0 ) HLTError("CA: clusters from row %d are readed twice",oldRow);
- fTracker->ReadHitRow( oldRow, vHits+firstRowHit, nRowHits );
+
+ Int_t firstRowHit = 0;
+ for( Int_t ir=0; ir<200; ir++ ){
+ rowFirstHits[ir] = firstRowHit;
+ firstRowHit+=rowNHits[ir];
}
+
+ fTracker->ReadEvent( rowFirstHits, rowNHits, vHitStoreX, vHitStoreY, vHitStoreZ, nHits );
}
+
if( vOrigClusters ) delete[] vOrigClusters;
// reconstruct the event
Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Reconstruct",
"%d tracks found for slice %d",fTracker->NOutTracks(), slice);
- // write reconstructed tracks
-
- AliHLTTPCTrackletData* outPtr = (AliHLTTPCTrackletData*)(outputPtr);
- AliHLTTPCTrackSegmentData* currOutTracklet = outPtr->fTracklets;
-
- Int_t ntracks = fTracker->NOutTracks();
+ // write reconstructed tracks
- UInt_t mySize = ((AliHLTUInt8_t *)currOutTracklet) - ((AliHLTUInt8_t *)outputPtr);
+ UInt_t mySize = 0;
+ Int_t ntracks = *fTracker->NOutTracks();
- outPtr->fTrackletCnt = 0;
+
+ if( !fNewOutputType ){
- for( int itr=0; itr<ntracks; itr++ ){
+ AliHLTTPCTrackletData* outPtr = (AliHLTTPCTrackletData*)(outputPtr);
- AliHLTTPCCAOutTrack &t = fTracker->OutTracks()[itr];
-
- //Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Wrtite output","track %d with %d hits", itr, t.NHits());
-
- if( t.NHits()<fMinNTrackClusters ) continue;
-
- // calculate output track size
-
- UInt_t dSize = sizeof(AliHLTTPCTrackSegmentData) + t.NHits()*sizeof(UInt_t);
+ AliHLTTPCTrackSegmentData* currOutTracklet = outPtr->fTracklets;
- if( mySize + dSize > MaxBufferSize ){
- Logging( kHLTLogWarning, "HLT::TPCCATracker::DoEvent", "Wrtite output","Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", MaxBufferSize, mySize, ntracks-itr+1);
- ret = -ENOSPC;
- break;
- }
+ mySize = ((AliHLTUInt8_t *)currOutTracklet) - ((AliHLTUInt8_t *)outputPtr);
- // convert CA track parameters to HLT Track Segment
-
- Int_t iFirstRow = 1000;
- Int_t iLastRow = -1;
- Int_t iFirstHit = fTracker->OutTrackHits()[t.FirstHitRef()];
- Int_t iLastHit = iFirstHit;
- for( Int_t ih=0; ih<t.NHits(); ih++ ){
- Int_t hitID = fTracker->OutTrackHits()[t.FirstHitRef() + ih ];
- Int_t iRow = vHitRowID[hitID];
- if( iRow<iFirstRow ){ iFirstRow = iRow; iFirstHit = hitID; }
- if( iRow>iLastRow ){ iLastRow = iRow; iLastHit = hitID; }
- }
-
- AliHLTTPCCATrackParam par = t.StartPoint();
-
- par.TransportToX( vHitStoreX[iFirstHit] );
-
- AliExternalTrackParam tp;
- AliHLTTPCCATrackConvertor::GetExtParam( par, tp, 0, fSolenoidBz );
-
- currOutTracklet->fX = tp.GetX();
- currOutTracklet->fY = tp.GetY();
- currOutTracklet->fZ = tp.GetZ();
- currOutTracklet->fCharge = -(Int_t ) tp.GetSign();
- currOutTracklet->fPt = TMath::Abs(tp.GetSignedPt());
- Float_t snp = tp.GetSnp() ;
- if( snp>.999 ) snp=.999;
- if( snp<-.999 ) snp=-.999;
- currOutTracklet->fPsi = TMath::ASin( snp );
- currOutTracklet->fTgl = tp.GetTgl();
-
- currOutTracklet->fY0err = tp.GetSigmaY2();
- currOutTracklet->fZ0err = tp.GetSigmaZ2();
- Float_t h = -currOutTracklet->fPt*currOutTracklet->fPt;
- currOutTracklet->fPterr = h*h*tp.GetSigma1Pt2();
- h = 1./TMath::Sqrt(1-snp*snp);
- currOutTracklet->fPsierr = h*h*tp.GetSigmaSnp2();
- currOutTracklet->fTglerr = tp.GetSigmaTgl2();
+ outPtr->fTrackletCnt = 0;
- if( par.TransportToX( vHitStoreX[iLastHit] ) ){
- currOutTracklet->fLastX = par.GetX();
- currOutTracklet->fLastY = par.GetY();
- currOutTracklet->fLastZ = par.GetZ();
- } else {
- currOutTracklet->fLastX = vHitStoreX[iLastHit];
- currOutTracklet->fLastY = vHitStoreY[iLastHit];
- currOutTracklet->fLastZ = vHitStoreZ[iLastHit];
- }
- //if( currOutTracklet->fLastX<10. ) {
- //HLTError("CA last point: hitxyz=%f,%f,%f, track=%f,%f,%f, tracklet=%f,%f,%f, nhits=%d",vHitStoreX[iLastHit],vHitStoreY[iLastHit],vHitStoreZ[iLastHit],
- //par.GetX(), par.GetY(),par.GetZ(),currOutTracklet->fLastX,currOutTracklet->fLastY ,currOutTracklet->fLastZ, t.NHits());
- //}
+ for( Int_t itr=0; itr<ntracks; itr++ ){
+
+ AliHLTTPCCAOutTrack &t = fTracker->OutTracks()[itr];
+
+ //Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Wrtite output","track %d with %d hits", itr, t.NHits());
+
+ if( t.NHits()<fMinNTrackClusters ) continue;
+
+ // calculate output track size
+
+ UInt_t dSize = sizeof(AliHLTTPCTrackSegmentData) + t.NHits()*sizeof(UInt_t);
+
+ if( mySize + dSize > maxBufferSize ){
+ HLTWarning("Output buffer size exceed (buffer size %d, current size %d), %d tracks are not stored", maxBufferSize, mySize, ntracks-itr+1);
+ ret = -ENOSPC;
+ break;
+ }
+
+ // convert CA track parameters to HLT Track Segment
+
+ Int_t iFirstRow = 1000;
+ Int_t iLastRow = -1;
+ Int_t iFirstHit = fTracker->OutTrackHits()[t.FirstHitRef()];
+ Int_t iLastHit = iFirstHit;
+ for( Int_t ih=0; ih<t.NHits(); ih++ ){
+ Int_t hitID = fTracker->OutTrackHits()[t.FirstHitRef() + ih ];
+ Int_t iRow = vHitRowID[hitID];
+ if( iRow<iFirstRow ){ iFirstRow = iRow; iFirstHit = hitID; }
+ if( iRow>iLastRow ){ iLastRow = iRow; iLastHit = hitID; }
+ }
+
+ AliHLTTPCCATrackParam par = t.StartPoint();
+
+ par.TransportToX( vHitStoreX[iFirstHit], .99 );
+
+ AliExternalTrackParam tp;
+ AliHLTTPCCATrackConvertor::GetExtParam( par, tp, 0 );
+
+ currOutTracklet->fX = tp.GetX();
+ currOutTracklet->fY = tp.GetY();
+ currOutTracklet->fZ = tp.GetZ();
+ currOutTracklet->fCharge = (Int_t ) tp.GetSign();
+ currOutTracklet->fPt = TMath::Abs(tp.GetSignedPt());
+ Float_t snp = tp.GetSnp() ;
+ if( snp>.999 ) snp=.999;
+ if( snp<-.999 ) snp=-.999;
+ currOutTracklet->fPsi = TMath::ASin( snp );
+ currOutTracklet->fTgl = tp.GetTgl();
+
+ currOutTracklet->fY0err = tp.GetSigmaY2();
+ currOutTracklet->fZ0err = tp.GetSigmaZ2();
+ Float_t h = -currOutTracklet->fPt*currOutTracklet->fPt;
+ currOutTracklet->fPterr = h*h*tp.GetSigma1Pt2();
+ h = 1./TMath::Sqrt(1-snp*snp);
+ currOutTracklet->fPsierr = h*h*tp.GetSigmaSnp2();
+ currOutTracklet->fTglerr = tp.GetSigmaTgl2();
+
+ if( par.TransportToX( vHitStoreX[iLastHit],.99 ) ){
+ currOutTracklet->fLastX = par.GetX();
+ currOutTracklet->fLastY = par.GetY();
+ currOutTracklet->fLastZ = par.GetZ();
+ } else {
+ currOutTracklet->fLastX = vHitStoreX[iLastHit];
+ currOutTracklet->fLastY = vHitStoreY[iLastHit];
+ currOutTracklet->fLastZ = vHitStoreZ[iLastHit];
+ }
+ //if( currOutTracklet->fLastX<10. ) {
+ //HLTError("CA last point: hitxyz=%f,%f,%f, track=%f,%f,%f, tracklet=%f,%f,%f, nhits=%d",vHitStoreX[iLastHit],vHitStoreY[iLastHit],vHitStoreZ[iLastHit],
+ //par.GetX(), par.GetY(),par.GetZ(),currOutTracklet->fLastX,currOutTracklet->fLastY ,currOutTracklet->fLastZ, t.NHits());
+ //}
#ifdef INCLUDE_TPC_HOUGH
#ifdef ROWHOUGHPARAMS
- currOutTracklet->fTrackID = 0;
- currOutTracklet->fRowRange1 = vHitRowID[iFirstHit];
- currOutTracklet->fRowRange2 = vHitRowID[iLastHit];
- currOutTracklet->fSector = slice;
- currOutTracklet->fPID = 211;
+ currOutTracklet->fTrackID = 0;
+ currOutTracklet->fRowRange1 = vHitRowID[iFirstHit];
+ currOutTracklet->fRowRange2 = vHitRowID[iLastHit];
+ currOutTracklet->fSector = slice;
+ currOutTracklet->fPID = 211;
#endif
#endif // INCLUDE_TPC_HOUGH
-
-
- currOutTracklet->fNPoints = t.NHits();
-
- for( Int_t i=0; i<t.NHits(); i++ ){
- currOutTracklet->fPointIDs[i] = vHitStoreID[fTracker->OutTrackHits()[t.FirstHitRef()+i]];
+
+
+ currOutTracklet->fNPoints = t.NHits();
+
+ for( Int_t i=0; i<t.NHits(); i++ ){
+ currOutTracklet->fPointIDs[i] = vHitStoreID[fTracker->OutTrackHits()[t.FirstHitRef()+i]];
+ }
+
+ currOutTracklet = (AliHLTTPCTrackSegmentData*)( (Byte_t *)currOutTracklet + dSize );
+ mySize+=dSize;
+ outPtr->fTrackletCnt++;
+ }
+ } else { // new output type
+
+ mySize = fTracker->Output()->EstimateSize( fTracker->Output()->NTracks(),
+ fTracker->Output()->NTrackClusters() );
+ if( mySize <= maxBufferSize ){
+ const AliHLTUInt8_t* outputevent = reinterpret_cast<const AliHLTUInt8_t*>(fTracker->Output());
+ for( UInt_t i=0; i<mySize; i++ ) outputPtr[i] = outputevent[i];
+ } else {
+ HLTWarning("Output buffer size exceed (buffer size %d, current size %d), tracks are not stored", maxBufferSize, mySize );
+ mySize = 0;
+ ret = -ENOSPC;
}
-
- currOutTracklet = (AliHLTTPCTrackSegmentData*)( (Byte_t *)currOutTracklet + dSize );
- mySize+=dSize;
- outPtr->fTrackletCnt++;
}
-
- if( vHits ) delete[] vHits;
+
if( vHitStoreX ) delete[] vHitStoreX;
if( vHitStoreY ) delete[] vHitStoreY;
if( vHitStoreZ ) delete[] vHitStoreZ;
+ if( vHitStoreIntID ) delete[] vHitStoreIntID;
if( vHitStoreID ) delete[] vHitStoreID;
if( vHitRowID ) delete[] vHitRowID;
-
- AliHLTComponentBlockData bd;
- FillBlockData( bd );
- bd.fOffset = 0;
- bd.fSize = mySize;
- bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch );
- outputBlocks.push_back( bd );
-
+
+ if( mySize>0 ){
+ AliHLTComponentBlockData bd;
+ FillBlockData( bd );
+ bd.fOffset = 0;
+ bd.fSize = mySize;
+ bd.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch );
+ outputBlocks.push_back( bd );
+ }
size = mySize;
timer.Stop();
// Set log level to "Warning" for on-line system monitoring
Int_t hz = (Int_t) (fFullTime>1.e-10 ?fNEvents/fFullTime :100000);
Int_t hz1 = (Int_t) (fRecoTime>1.e-10 ?fNEvents/fRecoTime :100000);
- Logging( kHLTLogDebug, "HLT::TPCCATracker::DoEvent", "Tracks",
- "CATracker slice %d: output %d tracks; input %d clusters, patches %d..%d, rows %d..%d; reco time %d/%d Hz",
- slice, ntracks, nClusters, minPatch, maxPatch, row[0], row[1], hz, hz1 );
+ HLTWarning( "CATracker slice %d: output %d tracks; input %d clusters, patches %d..%d, rows %d..%d; reco time %d/%d Hz",
+ slice, ntracks, nClusters, minPatch, maxPatch, row[0], row[1], hz, hz1 );
return ret;
-
}