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 /** @file AliHLTTPCVertexFinderComponent.cxx
21 @author Timm Steinbeck, Matthias Richter
23 @brief TPC vertex finder processing component
26 ///////////////////////////////////////////////////////////////////////////////
28 // a TPC vertex finder processing component for the HLT //
30 // see header file for class documentation //
32 // refer to README to build package //
34 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt //
36 ///////////////////////////////////////////////////////////////////////////////
42 #include "AliHLTTPCVertexFinderComponent.h"
43 #include "AliHLTTPCVertexFinder.h"
44 #include "AliHLTTPCSpacePointData.h"
45 #include "AliHLTTPCVertexData.h"
46 #include "AliHLTTPCClusterDataFormat.h"
47 #include "AliHLTTPCTransform.h"
48 #include "AliHLTTPCDefinitions.h"
52 /** ROOT macro for the implementation of ROOT specific class methods */
53 ClassImp(AliHLTTPCVertexFinderComponent);
55 AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent()
60 // see header file for class documentation
62 // refer to README to build package
64 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
67 AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent(const AliHLTTPCVertexFinderComponent&)
72 // see header file for class documentation
75 AliHLTTPCVertexFinderComponent& AliHLTTPCVertexFinderComponent::operator=(const AliHLTTPCVertexFinderComponent&)
77 // see header file for class documentation
81 AliHLTTPCVertexFinderComponent::~AliHLTTPCVertexFinderComponent()
83 // see header file for class documentation
86 // Public functions to implement AliHLTComponent's interface.
87 // These functions are required for the registration process
89 const char* AliHLTTPCVertexFinderComponent::GetComponentID()
91 // see header file for class documentation
92 return "TPCVertexFinder";
95 void AliHLTTPCVertexFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
97 // see header file for class documentation
99 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
102 AliHLTComponentDataType AliHLTTPCVertexFinderComponent::GetOutputDataType()
104 // see header file for class documentation
105 return AliHLTTPCDefinitions::fgkVertexDataType;
108 void AliHLTTPCVertexFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
110 // see header file for class documentation
111 // XXX TODO: Find more realistic values.
112 constBase = sizeof(AliHLTTPCVertexData);
116 AliHLTComponent* AliHLTTPCVertexFinderComponent::Spawn()
118 // see header file for class documentation
119 return new AliHLTTPCVertexFinderComponent;
122 int AliHLTTPCVertexFinderComponent::DoInit( int /*argc*/, const char** /*argv*/ )
124 // see header file for class documentation
127 fVertexFinder = new AliHLTTPCVertexFinder();
131 int AliHLTTPCVertexFinderComponent::DoDeinit()
133 // see header file for class documentation
134 if ( !fVertexFinder )
137 delete fVertexFinder;
138 fVertexFinder = NULL;
142 int AliHLTTPCVertexFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
143 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
144 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
146 // see header file for class documentation
147 const AliHLTComponentBlockData* iter = NULL;
150 AliHLTTPCClusterData* inPtr;
151 AliHLTTPCVertexData* outPtr;
152 AliHLTUInt8_t* outBPtr;
153 UInt_t offset, mysize, tSize = 0;
155 Int_t slice, patch, row[2];
156 AliHLTUInt32_t realPoints;
158 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
163 if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType )
168 inPtr = (AliHLTTPCClusterData*)(iter->fPtr);
169 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
170 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
171 row[0] = AliHLTTPCTransform::GetFirstRow( patch );
172 row[1] = AliHLTTPCTransform::GetLastRow( patch );
173 realPoints = inPtr->fSpacePointCnt;
175 Logging( kHLTLogDebug, "HLT::TPCVertexFinder::DoEvent", "Spacepoint count",
176 "realpoints: %lu.", realPoints );
178 outPtr = (AliHLTTPCVertexData*)outBPtr;
180 fVertexFinder->Reset();
182 fVertexFinder->Read( realPoints, inPtr->fSpacePoints );
183 fVertexFinder->Analyze();
186 fVertexFinder->Write( outPtr );
189 mysize += sizeof(AliHLTTPCVertexData);
191 AliHLTComponentBlockData bd;
195 bd.fSpecification = iter->fSpecification;
196 //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
197 outputBlocks.push_back( bd );
204 Logging( kHLTLogFatal, "HLT::TPCVertexFinder::DoEvent", "Too much data",
205 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."