]>
Commit | Line | Data |
---|---|---|
71d7c760 | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
9be2600f | 4 | * This file is property of and copyright by the ALICE HLT Project * |
5 | * ALICE Experiment at CERN, All rights reserved. * | |
71d7c760 | 6 | * * |
9be2600f | 7 | * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * |
8 | * Timm Steinbeck <timm@kip.uni-heidelberg.de> * | |
9 | * for The ALICE HLT Project. * | |
71d7c760 | 10 | * * |
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 | **************************************************************************/ | |
19 | ||
e67b0680 | 20 | /** @file AliHLTTPCVertexFinderComponent.cxx |
21 | @author Timm Steinbeck, Matthias Richter | |
22 | @date | |
23 | @brief TPC vertex finder processing component | |
24 | */ | |
25 | ||
71d7c760 | 26 | /////////////////////////////////////////////////////////////////////////////// |
27 | // // | |
e67b0680 | 28 | // a TPC vertex finder processing component for the HLT // |
29 | // // | |
30 | // see header file for class documentation // | |
31 | // or // | |
32 | // refer to README to build package // | |
33 | // or // | |
34 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt // | |
71d7c760 | 35 | // // |
36 | /////////////////////////////////////////////////////////////////////////////// | |
37 | ||
e67b0680 | 38 | #if __GNUC__>= 3 |
71d7c760 | 39 | using namespace std; |
40 | #endif | |
41 | ||
42 | #include "AliHLTTPCVertexFinderComponent.h" | |
a6c02c85 | 43 | #include "AliHLTTPCVertexFinder.h" |
44 | #include "AliHLTTPCSpacePointData.h" | |
45 | #include "AliHLTTPCVertexData.h" | |
71d7c760 | 46 | #include "AliHLTTPCClusterDataFormat.h" |
a6c02c85 | 47 | #include "AliHLTTPCTransform.h" |
e67b0680 | 48 | #include "AliHLTTPCDefinitions.h" |
49 | #include <cstdlib> | |
50 | #include <cerrno> | |
71d7c760 | 51 | |
72ae28cd | 52 | #ifndef ECANCELED |
53 | #define ECANCELED 125 | |
54 | #endif | |
55 | ||
672f8b8c | 56 | /** ROOT macro for the implementation of ROOT specific class methods */ |
e67b0680 | 57 | ClassImp(AliHLTTPCVertexFinderComponent); |
71d7c760 | 58 | |
59 | AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent() | |
e419b223 | 60 | : |
5d2abf3b | 61 | AliHLTProcessor(), |
e419b223 | 62 | fVertexFinder(NULL) |
63 | { | |
e67b0680 | 64 | // see header file for class documentation |
65 | // or | |
66 | // refer to README to build package | |
67 | // or | |
68 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
e419b223 | 69 | } |
70 | ||
71 | AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent(const AliHLTTPCVertexFinderComponent&) | |
72 | : | |
5d2abf3b | 73 | AliHLTProcessor(), |
e419b223 | 74 | fVertexFinder(NULL) |
75 | { | |
76 | // see header file for class documentation | |
77 | } | |
78 | ||
79 | AliHLTTPCVertexFinderComponent& AliHLTTPCVertexFinderComponent::operator=(const AliHLTTPCVertexFinderComponent&) | |
80 | { | |
81 | // see header file for class documentation | |
82 | return *this; | |
83 | } | |
71d7c760 | 84 | |
85 | AliHLTTPCVertexFinderComponent::~AliHLTTPCVertexFinderComponent() | |
e419b223 | 86 | { |
e67b0680 | 87 | // see header file for class documentation |
e419b223 | 88 | } |
71d7c760 | 89 | |
90 | // Public functions to implement AliHLTComponent's interface. | |
91 | // These functions are required for the registration process | |
92 | ||
93 | const char* AliHLTTPCVertexFinderComponent::GetComponentID() | |
e67b0680 | 94 | { |
95 | // see header file for class documentation | |
96 | return "TPCVertexFinder"; | |
97 | } | |
71d7c760 | 98 | |
8ede8717 | 99 | void AliHLTTPCVertexFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
e67b0680 | 100 | { |
101 | // see header file for class documentation | |
102 | list.clear(); | |
103 | list.push_back( AliHLTTPCDefinitions::fgkClustersDataType ); | |
104 | } | |
71d7c760 | 105 | |
8ede8717 | 106 | AliHLTComponentDataType AliHLTTPCVertexFinderComponent::GetOutputDataType() |
e67b0680 | 107 | { |
108 | // see header file for class documentation | |
109 | return AliHLTTPCDefinitions::fgkVertexDataType; | |
110 | } | |
71d7c760 | 111 | |
112 | void AliHLTTPCVertexFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
e67b0680 | 113 | { |
114 | // see header file for class documentation | |
115 | // XXX TODO: Find more realistic values. | |
116 | constBase = sizeof(AliHLTTPCVertexData); | |
117 | inputMultiplier = 0; | |
118 | } | |
71d7c760 | 119 | |
120 | AliHLTComponent* AliHLTTPCVertexFinderComponent::Spawn() | |
e67b0680 | 121 | { |
122 | // see header file for class documentation | |
123 | return new AliHLTTPCVertexFinderComponent; | |
124 | } | |
125 | ||
5d2abf3b | 126 | int AliHLTTPCVertexFinderComponent::DoInit( int /*argc*/, const char** /*argv*/ ) |
e67b0680 | 127 | { |
128 | // see header file for class documentation | |
129 | if ( fVertexFinder ) | |
130 | return EINPROGRESS; | |
131 | fVertexFinder = new AliHLTTPCVertexFinder(); | |
132 | return 0; | |
133 | } | |
71d7c760 | 134 | |
135 | int AliHLTTPCVertexFinderComponent::DoDeinit() | |
e67b0680 | 136 | { |
137 | // see header file for class documentation | |
138 | if ( !fVertexFinder ) | |
139 | return ECANCELED; | |
140 | if ( fVertexFinder ) | |
141 | delete fVertexFinder; | |
142 | fVertexFinder = NULL; | |
143 | return 0; | |
144 | } | |
71d7c760 | 145 | |
8ede8717 | 146 | int AliHLTTPCVertexFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, |
5d2abf3b | 147 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, |
8ede8717 | 148 | AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) |
e67b0680 | 149 | { |
150 | // see header file for class documentation | |
151 | const AliHLTComponentBlockData* iter = NULL; | |
152 | unsigned long ndx; | |
153 | ||
154 | AliHLTTPCClusterData* inPtr; | |
155 | AliHLTTPCVertexData* outPtr; | |
156 | AliHLTUInt8_t* outBPtr; | |
157 | UInt_t offset, mysize, tSize = 0; | |
158 | outBPtr = outputPtr; | |
159 | Int_t slice, patch, row[2]; | |
160 | AliHLTUInt32_t realPoints; | |
161 | ||
162 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
71d7c760 | 163 | { |
e67b0680 | 164 | iter = blocks+ndx; |
165 | mysize = 0; | |
166 | offset = tSize; | |
167 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) | |
71d7c760 | 168 | { |
e67b0680 | 169 | continue; |
170 | } | |
71d7c760 | 171 | |
e67b0680 | 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; | |
178 | ||
179 | Logging( kHLTLogDebug, "HLT::TPCVertexFinder::DoEvent", "Spacepoint count", | |
180 | "realpoints: %lu.", realPoints ); | |
71d7c760 | 181 | |
e67b0680 | 182 | outPtr = (AliHLTTPCVertexData*)outBPtr; |
71d7c760 | 183 | |
e67b0680 | 184 | fVertexFinder->Reset(); |
71d7c760 | 185 | |
e67b0680 | 186 | fVertexFinder->Read( realPoints, inPtr->fSpacePoints ); |
187 | fVertexFinder->Analyze(); | |
71d7c760 | 188 | |
e67b0680 | 189 | //publish Vertex |
190 | fVertexFinder->Write( outPtr ); | |
71d7c760 | 191 | |
192 | ||
e67b0680 | 193 | mysize += sizeof(AliHLTTPCVertexData); |
71d7c760 | 194 | |
e67b0680 | 195 | AliHLTComponentBlockData bd; |
196 | FillBlockData( bd ); | |
197 | bd.fOffset = offset; | |
198 | bd.fSize = mysize; | |
199 | bd.fSpecification = iter->fSpecification; | |
200 | //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes ); | |
201 | outputBlocks.push_back( bd ); | |
202 | ||
203 | tSize += mysize; | |
204 | outBPtr += mysize; | |
205 | ||
206 | if ( tSize > size ) | |
207 | { | |
208 | Logging( kHLTLogFatal, "HLT::TPCVertexFinder::DoEvent", "Too much data", | |
209 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." | |
210 | , tSize, size ); | |
211 | return EMSGSIZE; | |
71d7c760 | 212 | } |
71d7c760 | 213 | } |
e67b0680 | 214 | |
215 | size = tSize; | |
216 | return 0; | |
217 | } | |
71d7c760 | 218 | |
219 |