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