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"
56 /** ROOT macro for the implementation of ROOT specific class methods */
57 ClassImp(AliHLTTPCVertexFinderComponent);
59 AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent()
64 // see header file for class documentation
66 // refer to README to build package
68 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
71 AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent(const AliHLTTPCVertexFinderComponent&)
76 // see header file for class documentation
79 AliHLTTPCVertexFinderComponent& AliHLTTPCVertexFinderComponent::operator=(const AliHLTTPCVertexFinderComponent&)
81 // see header file for class documentation
85 AliHLTTPCVertexFinderComponent::~AliHLTTPCVertexFinderComponent()
87 // see header file for class documentation
90 // Public functions to implement AliHLTComponent's interface.
91 // These functions are required for the registration process
93 const char* AliHLTTPCVertexFinderComponent::GetComponentID()
95 // see header file for class documentation
96 return "TPCVertexFinder";
99 void AliHLTTPCVertexFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
101 // see header file for class documentation
103 list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
106 AliHLTComponentDataType AliHLTTPCVertexFinderComponent::GetOutputDataType()
108 // see header file for class documentation
109 return AliHLTTPCDefinitions::fgkVertexDataType;
112 void AliHLTTPCVertexFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
114 // see header file for class documentation
115 // XXX TODO: Find more realistic values.
116 constBase = sizeof(AliHLTTPCVertexData);
120 AliHLTComponent* AliHLTTPCVertexFinderComponent::Spawn()
122 // see header file for class documentation
123 return new AliHLTTPCVertexFinderComponent;
126 int AliHLTTPCVertexFinderComponent::DoInit( int /*argc*/, const char** /*argv*/ )
128 // see header file for class documentation
131 fVertexFinder = new AliHLTTPCVertexFinder();
135 int AliHLTTPCVertexFinderComponent::DoDeinit()
137 // see header file for class documentation
138 if ( !fVertexFinder )
141 delete fVertexFinder;
142 fVertexFinder = NULL;
146 int AliHLTTPCVertexFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
147 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
148 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
150 // see header file for class documentation
151 const AliHLTComponentBlockData* iter = NULL;
154 AliHLTTPCClusterData* inPtr;
155 AliHLTTPCVertexData* outPtr;
156 AliHLTUInt8_t* outBPtr;
157 UInt_t offset, mysize, tSize = 0;
159 Int_t slice, patch, row[2];
160 AliHLTUInt32_t realPoints;
162 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
167 if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType )
172 inPtr = (AliHLTTPCClusterData*)(iter->fPtr);
173 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
174 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
175 row[0] = AliHLTTPCTransform::GetFirstRow( patch );
176 row[1] = AliHLTTPCTransform::GetLastRow( patch );
177 realPoints = inPtr->fSpacePointCnt;
179 Logging( kHLTLogDebug, "HLT::TPCVertexFinder::DoEvent", "Spacepoint count",
180 "realpoints: %lu.", realPoints );
182 outPtr = (AliHLTTPCVertexData*)outBPtr;
184 fVertexFinder->Reset();
186 fVertexFinder->Read( realPoints, inPtr->fSpacePoints );
187 fVertexFinder->Analyze();
190 fVertexFinder->Write( outPtr );
193 mysize += sizeof(AliHLTTPCVertexData);
195 AliHLTComponentBlockData bd;
199 bd.fSpecification = iter->fSpecification;
200 //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
201 outputBlocks.push_back( bd );
208 Logging( kHLTLogFatal, "HLT::TPCVertexFinder::DoEvent", "Too much data",
209 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."