]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCVertexFinderComponent.cxx
changes according to coding conventions
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCVertexFinderComponent.cxx
CommitLineData
71d7c760 1// $Id$
2
3/**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * for The ALICE Off-line Project. *
9 * *
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 **************************************************************************/
18
19///////////////////////////////////////////////////////////////////////////////
20// //
21// a TPC vertex finder processing component for the HLT //
22// //
23///////////////////////////////////////////////////////////////////////////////
24
25#if __GNUC__== 3
26using namespace std;
27#endif
28
29#include "AliHLTTPCVertexFinderComponent.h"
a6c02c85 30#include "AliHLTTPCVertexFinder.h"
31#include "AliHLTTPCSpacePointData.h"
32#include "AliHLTTPCVertexData.h"
71d7c760 33#include "AliHLTTPCClusterDataFormat.h"
a6c02c85 34#include "AliHLTTPCTransform.h"
71d7c760 35#include <stdlib.h>
36#include <errno.h>
37
38// this is a global object used for automatic component registration, do not use this
39AliHLTTPCVertexFinderComponent gAliHLTTPCVertexFinderComponent;
40
41ClassImp(AliHLTTPCVertexFinderComponent)
42
43AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent()
44 {
45 fVertexFinder = NULL;
46 }
47
48AliHLTTPCVertexFinderComponent::~AliHLTTPCVertexFinderComponent()
49 {
50 }
51
52// Public functions to implement AliHLTComponent's interface.
53// These functions are required for the registration process
54
55const char* AliHLTTPCVertexFinderComponent::GetComponentID()
56 {
57 return "TPCVertexFinder";
58 }
59
8ede8717 60void AliHLTTPCVertexFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
71d7c760 61 {
62 list.clear();
63 list.push_back( AliHLTTPCDefinitions::gkClustersDataType );
64 }
65
8ede8717 66AliHLTComponentDataType AliHLTTPCVertexFinderComponent::GetOutputDataType()
71d7c760 67 {
68 return AliHLTTPCDefinitions::gkVertexDataType;
69 }
70
71void AliHLTTPCVertexFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
72 {
73 // XXX TODO: Find more realistic values.
a6c02c85 74 constBase = sizeof(AliHLTTPCVertexData);
71d7c760 75 inputMultiplier = 0;
76 }
77
78AliHLTComponent* AliHLTTPCVertexFinderComponent::Spawn()
79 {
80 return new AliHLTTPCVertexFinderComponent;
81 }
82
83int AliHLTTPCVertexFinderComponent::DoInit( int argc, const char** argv )
84 {
85 if ( fVertexFinder )
86 return EINPROGRESS;
a6c02c85 87 fVertexFinder = new AliHLTTPCVertexFinder();
71d7c760 88 return 0;
89 }
90
91int AliHLTTPCVertexFinderComponent::DoDeinit()
92 {
93 if ( !fVertexFinder )
94 return ECANCELED;
95 if ( fVertexFinder )
96 delete fVertexFinder;
97 fVertexFinder = NULL;
98 return 0;
99 }
100
8ede8717 101int AliHLTTPCVertexFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
102 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
103 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
71d7c760 104 {
8ede8717 105 const AliHLTComponentBlockData* iter = NULL;
71d7c760 106 unsigned long ndx;
107
108 AliHLTTPCClusterData* inPtr;
a6c02c85 109 AliHLTTPCVertexData* outPtr;
71d7c760 110 AliHLTUInt8_t* outBPtr;
111 UInt_t offset, mysize, tSize = 0;
112 outBPtr = outputPtr;
113 Int_t slice, patch, row[2];
114 AliHLTUInt32_t realPoints;
115
116 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
117 {
118 iter = blocks+ndx;
119 mysize = 0;
120 offset = tSize;
121 if ( iter->fDataType != AliHLTTPCDefinitions::gkClustersDataType )
122 {
123 continue;
124 }
125
126 inPtr = (AliHLTTPCClusterData*)(iter->fPtr);
127 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
128 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
a6c02c85 129 row[0] = AliHLTTPCTransform::GetFirstRow( patch );
130 row[1] = AliHLTTPCTransform::GetLastRow( patch );
71d7c760 131 realPoints = inPtr->fSpacePointCnt;
132
133 Logging( kHLTLogDebug, "HLT::TPCVertexFinder::DoEvent", "Spacepoint count",
134 "realpoints: %lu.", realPoints );
135
a6c02c85 136 outPtr = (AliHLTTPCVertexData*)outBPtr;
71d7c760 137
138 fVertexFinder->Reset();
139
140 fVertexFinder->Read( realPoints, inPtr->fSpacePoints );
141 fVertexFinder->Analyze();
142
143 //publish Vertex
144 fVertexFinder->Write( outPtr );
145
146
a6c02c85 147 mysize += sizeof(AliHLTTPCVertexData);
71d7c760 148
8ede8717 149 AliHLTComponentBlockData bd;
71d7c760 150 FillBlockData( bd );
151 bd.fOffset = offset;
152 bd.fSize = mysize;
153 bd.fSpecification = iter->fSpecification;
154 //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
155 outputBlocks.push_back( bd );
156
157 tSize += mysize;
158 outBPtr += mysize;
159
160 if ( tSize > size )
161 {
162 Logging( kHLTLogFatal, "HLT::TPCVertexFinder::DoEvent", "Too much data",
163 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
164 , tSize, size );
165 return EMSGSIZE;
166 }
167 }
168
169 size = tSize;
170 return 0;
171 }
172
173