]>
Commit | Line | Data |
---|---|---|
78001a73 | 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 | |
26 | using namespace std; | |
27 | #endif | |
28 | ||
29 | #include "AliHLTTPCVertexFinderComponent.h" | |
30 | #include "AliHLTTPCVertexFinder.h" | |
31 | #include "AliHLTTPCSpacePointData.h" | |
32 | #include "AliHLTTPCVertexData.h" | |
33 | #include "AliHLTTPCClusterDataFormat.h" | |
34 | #include "AliHLTTPCTransform.h" | |
35 | #include <stdlib.h> | |
36 | #include <errno.h> | |
37 | ||
38 | // this is a global object used for automatic component registration, do not use this | |
39 | AliHLTTPCVertexFinderComponent gAliHLTTPCVertexFinderComponent; | |
40 | ||
41 | ClassImp(AliHLTTPCVertexFinderComponent) | |
42 | ||
43 | AliHLTTPCVertexFinderComponent::AliHLTTPCVertexFinderComponent() | |
44 | { | |
45 | fVertexFinder = NULL; | |
46 | } | |
47 | ||
48 | AliHLTTPCVertexFinderComponent::~AliHLTTPCVertexFinderComponent() | |
49 | { | |
50 | } | |
51 | ||
52 | // Public functions to implement AliHLTComponent's interface. | |
53 | // These functions are required for the registration process | |
54 | ||
55 | const char* AliHLTTPCVertexFinderComponent::GetComponentID() | |
56 | { | |
57 | return "TPCVertexFinder"; | |
58 | } | |
59 | ||
60 | void AliHLTTPCVertexFinderComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list) | |
61 | { | |
62 | list.clear(); | |
63 | list.push_back( AliHLTTPCDefinitions::gkClustersDataType ); | |
64 | } | |
65 | ||
66 | AliHLTComponent_DataType AliHLTTPCVertexFinderComponent::GetOutputDataType() | |
67 | { | |
68 | return AliHLTTPCDefinitions::gkVertexDataType; | |
69 | } | |
70 | ||
71 | void AliHLTTPCVertexFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
72 | { | |
73 | // XXX TODO: Find more realistic values. | |
74 | constBase = sizeof(AliHLTTPCVertexData); | |
75 | inputMultiplier = 0; | |
76 | } | |
77 | ||
78 | AliHLTComponent* AliHLTTPCVertexFinderComponent::Spawn() | |
79 | { | |
80 | return new AliHLTTPCVertexFinderComponent; | |
81 | } | |
82 | ||
83 | int AliHLTTPCVertexFinderComponent::DoInit( int argc, const char** argv ) | |
84 | { | |
85 | if ( fVertexFinder ) | |
86 | return EINPROGRESS; | |
87 | fVertexFinder = new AliHLTTPCVertexFinder(); | |
88 | return 0; | |
89 | } | |
90 | ||
91 | int AliHLTTPCVertexFinderComponent::DoDeinit() | |
92 | { | |
93 | if ( !fVertexFinder ) | |
94 | return ECANCELED; | |
95 | if ( fVertexFinder ) | |
96 | delete fVertexFinder; | |
97 | fVertexFinder = NULL; | |
98 | return 0; | |
99 | } | |
100 | ||
101 | int AliHLTTPCVertexFinderComponent::DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks, | |
102 | AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, | |
103 | AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks ) | |
104 | { | |
105 | const AliHLTComponent_BlockData* iter = NULL; | |
106 | unsigned long ndx; | |
107 | ||
108 | AliHLTTPCClusterData* inPtr; | |
109 | AliHLTTPCVertexData* outPtr; | |
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 ); | |
129 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); | |
130 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); | |
131 | realPoints = inPtr->fSpacePointCnt; | |
132 | ||
133 | Logging( kHLTLogDebug, "HLT::TPCVertexFinder::DoEvent", "Spacepoint count", | |
134 | "realpoints: %lu.", realPoints ); | |
135 | ||
136 | outPtr = (AliHLTTPCVertexData*)outBPtr; | |
137 | ||
138 | fVertexFinder->Reset(); | |
139 | ||
140 | fVertexFinder->Read( realPoints, inPtr->fSpacePoints ); | |
141 | fVertexFinder->Analyze(); | |
142 | ||
143 | //publish Vertex | |
144 | fVertexFinder->Write( outPtr ); | |
145 | ||
146 | ||
147 | mysize += sizeof(AliHLTTPCVertexData); | |
148 | ||
149 | AliHLTComponent_BlockData bd; | |
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 |