]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/global/AliHLTGlobalOfflineVertexerComponent.cxx
In AliMUONReconstructor:
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalOfflineVertexerComponent.cxx
CommitLineData
e09e5bba 1// $Id$
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8//* for The ALICE HLT 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// @file AliHLTGlobalOfflineVertexerComponent.cxx
20// @author Matthias Richter
21// @date 2010-04-19
22// @brief Component wrapping the offline vertexer
23// @ingroup alihlt_global
24
25#if __GNUC__== 3
26using namespace std;
27#endif
28
29#include "AliHLTGlobalOfflineVertexerComponent.h"
30#include "AliESDEvent.h"
31#include "AliESDtrack.h"
32#include "AliVertexerTracks.h"
33#include "AliESDVertex.h"
34#include "AliLog.h"
35#include "TMap.h"
36
37/** ROOT macro for the implementation of ROOT specific class methods */
38ClassImp(AliHLTGlobalOfflineVertexerComponent)
39
40AliHLTGlobalOfflineVertexerComponent::AliHLTGlobalOfflineVertexerComponent()
41 : AliHLTProcessor()
42 , fVertexer(NULL)
43 , fBenchmark("GlobalOfflineVertexer")
44{
45 // The component subscribes to the HLT ESD and calculates the vertex
46 // using the offline vertexer.
47 //
48 // see header file for class documentation
49 // or
50 // refer to README to build package
51 // or
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53 //
54 // NOTE: all helper classes should be instantiated in DoInit()
55}
56
57AliHLTGlobalOfflineVertexerComponent::~AliHLTGlobalOfflineVertexerComponent()
58{
59 // destructor
60 //
61 // NOTE: implement proper cleanup in DoDeinit()
62}
63
64const char* AliHLTGlobalOfflineVertexerComponent::GetComponentID()
65{
66 // component property: id
67 return "GlobalOfflineVertexer";
68}
69
70void AliHLTGlobalOfflineVertexerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
71{
72 // component property: list of input data types
73 list.push_back(kAliHLTDataTypeESDObject);
74}
75
76AliHLTComponentDataType AliHLTGlobalOfflineVertexerComponent::GetOutputDataType()
77{
78 // component property: output data type
79 return kAliHLTAnyDataType;
80}
81
82void AliHLTGlobalOfflineVertexerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
83{
84 // component property: output size estimator
85 constBase = 0;
86 inputMultiplier = 1.0;
87}
88
89void AliHLTGlobalOfflineVertexerComponent::GetOCDBObjectDescription( TMap* const targetMap)
90{
91 // Get a list of OCDB object description.
92 // The list of objects is provided in a TMap
93 // - key: complete OCDB path, e.g. GRP/GRP/Data
94 // - value: short description why the object is needed
95 // Key and value objects created inside this class go into ownership of
96 // target TMap.
97 if (!targetMap) return;
98 targetMap->Add(new TObjString("HLT/ConfigHLT/GlobalOfflineVertexer"),
99 new TObjString("configuration object"));
100 targetMap->Add(new TObjString("GRP/GRP/Data"),
101 new TObjString("GRP object"));
102}
103
104AliHLTComponent* AliHLTGlobalOfflineVertexerComponent::Spawn()
105{
106 // Spawn function, return new class instance
107 return new AliHLTGlobalOfflineVertexerComponent;
108}
109
110int AliHLTGlobalOfflineVertexerComponent::DoInit( int argc, const char** argv )
111{
112 // see header file for class documentation
113 int iResult=0;
114
115 // init stage 1: default values for all data members
116
117 // init stage 2: read configuration object
118 // ScanConfigurationArgument() needs to be implemented
119 TString cdbPath="HLT/ConfigHLT/";
120 cdbPath+=GetComponentID();
121
122 // TODO: activate later when the object has been copied to the
123 // Grid OCDB
124 //iResult=ConfigureFromCDBTObjString(cdbPath);
125
126 // init stage 3: read the component arguments
127 if (iResult>=0) {
128 iResult=ConfigureFromArgumentString(argc, argv);
129 }
130
131 if (iResult>=0) {
132 // implement the component initialization
133 fVertexer=new AliVertexerTracks;
134 }
135
136 if (iResult<0) {
137 // implement cleanup
138 }
139
140 fBenchmark.SetTimer(0,"total");
141
142 return iResult;
143}
144
145int AliHLTGlobalOfflineVertexerComponent::ScanConfigurationArgument(int /*argc*/, const char** /*argv*/)
146{
147 // Scan configuration arguments
148 // Return the number of processed arguments
149 // -EPROTO if argument format error (e.g. number expected but not found)
150 //
151 // The AliHLTComponent base class implements a parsing loop for argument strings and
152 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
153 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
154
155 return 0;
156}
157
158int AliHLTGlobalOfflineVertexerComponent::DoDeinit()
159{
160 // component cleanup, delete all instances of helper classes here
161 if (fVertexer) delete fVertexer;
162 fVertexer=NULL;
163
164 return 0;
165}
166
167int AliHLTGlobalOfflineVertexerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
168 AliHLTComponentTriggerData& /*trigData*/)
169{
170 // event processing function
171
172 // check if this is a data event, there are a couple of special events
173 // which should be ignored for normal processing
174 if (!fVertexer) return -ENODEV;
175 if (!IsDataEvent()) return 0;
176
177 fBenchmark.StartNewEvent();
178 fBenchmark.Start(0);
179
180 const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
181
182 // input objects are not supposed to be changed by the component, so they
183 // are defined const. However, the implementation of AliESDEvent does not
184 // support this and we need the const_cast
185 const AliESDEvent* esd = dynamic_cast<const AliESDEvent*>(obj);
186 if (esd != NULL) {
187 AliESDVertex* vertex=fVertexer->FindPrimaryVertex(esd);
188 if (vertex) {
189 AliInfoClass("Offline Vertexer using the HLT ESD:");
190 vertex->Print();
191 }
192 }
193
194 fBenchmark.Stop(0);
195 AliInfoClass( fBenchmark.GetStatistics() );
196
197 return 0;
198}
199
200int AliHLTGlobalOfflineVertexerComponent::Reconfigure(const char* cdbEntry, const char* chainId)
201{
202 // reconfigure the component from the specified CDB entry, or default CDB entry
203 HLTInfo("reconfigure '%s' from entry %s", chainId, cdbEntry);
204
205 return 0;
206}
207
208int AliHLTGlobalOfflineVertexerComponent::ReadPreprocessorValues(const char* modules)
209{
210 // read the preprocessor values for the detectors in the modules list
211 int iResult=0;
212 TString detectors(modules!=NULL?modules:"");
213 HLTInfo("read preprocessor values for detector(s): %s", detectors.IsNull()?"none":detectors.Data());
214 return iResult;
215}