3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
9 * for The ALICE HLT Project. *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // a TPC vertex finder processing component for the HLT //
24 ///////////////////////////////////////////////////////////////////////////////
30 #include "AliHLTTPCVertexFinderComponent.h"
31 #include "AliHLTTPCVertexFinder.h"
32 #include "AliHLTTPCSpacePointData.h"
33 #include "AliHLTTPCVertexData.h"
34 #include "AliHLTTPCClusterDataFormat.h"
35 #include "AliHLTTPCTransform.h"
39 // this is a global object used for automatic component registration, do not use this
40 AliHLTTPCVertexFinderComponent gAliHLTTPCVertexFinderComponent;
42 ClassImp(AliHLTTPCVertexFinderComponent)
44 AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent()
49 AliHLTTPCVertexFinderComponent::~AliHLTTPCVertexFinderComponent()
53 // Public functions to implement AliHLTComponent's interface.
54 // These functions are required for the registration process
56 const char* AliHLTTPCVertexFinderComponent::GetComponentID()
58 return "TPCVertexFinder";
61 void AliHLTTPCVertexFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
64 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
67 AliHLTComponentDataType AliHLTTPCVertexFinderComponent::GetOutputDataType()
69 return AliHLTTPCDefinitions::fgkVertexDataType;
72 void AliHLTTPCVertexFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
74 // XXX TODO: Find more realistic values.
75 constBase = sizeof(AliHLTTPCVertexData);
79 AliHLTComponent* AliHLTTPCVertexFinderComponent::Spawn()
81 return new AliHLTTPCVertexFinderComponent;
84 int AliHLTTPCVertexFinderComponent::DoInit( int argc, const char** argv )
88 fVertexFinder = new AliHLTTPCVertexFinder();
92 int AliHLTTPCVertexFinderComponent::DoDeinit()
102 int AliHLTTPCVertexFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
103 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
104 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
106 const AliHLTComponentBlockData* iter = NULL;
109 AliHLTTPCClusterData* inPtr;
110 AliHLTTPCVertexData* outPtr;
111 AliHLTUInt8_t* outBPtr;
112 UInt_t offset, mysize, tSize = 0;
114 Int_t slice, patch, row[2];
115 AliHLTUInt32_t realPoints;
117 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
122 if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType )
127 inPtr = (AliHLTTPCClusterData*)(iter->fPtr);
128 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
129 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
130 row[0] = AliHLTTPCTransform::GetFirstRow( patch );
131 row[1] = AliHLTTPCTransform::GetLastRow( patch );
132 realPoints = inPtr->fSpacePointCnt;
134 Logging( kHLTLogDebug, "HLT::TPCVertexFinder::DoEvent", "Spacepoint count",
135 "realpoints: %lu.", realPoints );
137 outPtr = (AliHLTTPCVertexData*)outBPtr;
139 fVertexFinder->Reset();
141 fVertexFinder->Read( realPoints, inPtr->fSpacePoints );
142 fVertexFinder->Analyze();
145 fVertexFinder->Write( outPtr );
148 mysize += sizeof(AliHLTTPCVertexData);
150 AliHLTComponentBlockData bd;
154 bd.fSpecification = iter->fSpecification;
155 //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
156 outputBlocks.push_back( bd );
163 Logging( kHLTLogFatal, "HLT::TPCVertexFinder::DoEvent", "Too much data",
164 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."