3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * for The ALICE Off-line 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. *
17 **************************************************************************/
19 ///////////////////////////////////////////////////////////////////////////////
21 // a TPC vertex finder processing component for the HLT //
23 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliHLTTPCVertexFinderComponent.h"
30 #include "AliHLTTPCVertexFinder.h"
31 #include "AliHLTTPCSpacePointData.h"
32 #include "AliHLTTPCVertexData.h"
33 #include "AliHLTTPCClusterDataFormat.h"
34 #include "AliHLTTPCTransform.h"
38 // this is a global object used for automatic component registration, do not use this
39 AliHLTTPCVertexFinderComponent gAliHLTTPCVertexFinderComponent;
41 ClassImp(AliHLTTPCVertexFinderComponent)
43 AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent()
48 AliHLTTPCVertexFinderComponent::~AliHLTTPCVertexFinderComponent()
52 // Public functions to implement AliHLTComponent's interface.
53 // These functions are required for the registration process
55 const char* AliHLTTPCVertexFinderComponent::GetComponentID()
57 return "TPCVertexFinder";
60 void AliHLTTPCVertexFinderComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
63 list.push_back( AliHLTTPCDefinitions::gkClustersDataType );
66 AliHLTComponent_DataType AliHLTTPCVertexFinderComponent::GetOutputDataType()
68 return AliHLTTPCDefinitions::gkVertexDataType;
71 void AliHLTTPCVertexFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
73 // XXX TODO: Find more realistic values.
74 constBase = sizeof(AliHLTTPCVertexData);
78 AliHLTComponent* AliHLTTPCVertexFinderComponent::Spawn()
80 return new AliHLTTPCVertexFinderComponent;
83 int AliHLTTPCVertexFinderComponent::DoInit( int argc, const char** argv )
87 fVertexFinder = new AliHLTTPCVertexFinder();
91 int AliHLTTPCVertexFinderComponent::DoDeinit()
101 int AliHLTTPCVertexFinderComponent::DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
102 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
103 AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks )
105 const AliHLTComponent_BlockData* iter = NULL;
108 AliHLTTPCClusterData* inPtr;
109 AliHLTTPCVertexData* outPtr;
110 AliHLTUInt8_t* outBPtr;
111 UInt_t offset, mysize, tSize = 0;
113 Int_t slice, patch, row[2];
114 AliHLTUInt32_t realPoints;
116 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
121 if ( iter->fDataType != AliHLTTPCDefinitions::gkClustersDataType )
126 inPtr = (AliHLTTPCClusterData*)(iter->fPtr);
127 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
128 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
129 row[0] = AliHLTTPCTransform::GetFirstRow( patch );
130 row[1] = AliHLTTPCTransform::GetLastRow( patch );
131 realPoints = inPtr->fSpacePointCnt;
133 Logging( kHLTLogDebug, "HLT::TPCVertexFinder::DoEvent", "Spacepoint count",
134 "realpoints: %lu.", realPoints );
136 outPtr = (AliHLTTPCVertexData*)outBPtr;
138 fVertexFinder->Reset();
140 fVertexFinder->Read( realPoints, inPtr->fSpacePoints );
141 fVertexFinder->Analyze();
144 fVertexFinder->Write( outPtr );
147 mysize += sizeof(AliHLTTPCVertexData);
149 AliHLTComponent_BlockData bd;
153 bd.fSpecification = iter->fSpecification;
154 //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
155 outputBlocks.push_back( bd );
162 Logging( kHLTLogFatal, "HLT::TPCVertexFinder::DoEvent", "Too much data",
163 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."