]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliHLTGlobalAgent.cxx
90d1860c7ce3f927c553ae625f85bd2e911fd814
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalAgent.cxx
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   AliHLTGlobalAgent.cxx
20     @author Matthias Richter
21     @date   
22     @brief  Agent of the libAliHLTGlobal library
23 */
24
25 #include <cassert>
26 #include "AliHLTGlobalAgent.h"
27 #include "AliHLTConfigurationHandler.h"
28 #include "TObjString.h"
29 #include "TObjArray.h"
30
31 // header files of library components
32 #include "AliHLTGlobalTrackMergerComponent.h"
33 #include "AliHLTGlobalEsdConverterComponent.h"
34 #include "AliHLTGlobalVertexerComponent.h"
35 #include "AliHLTGlobalOfflineVertexerComponent.h"
36 #include "AliHLTV0HistoComponent.h"
37 #include "AliHLTGlobalVertexerHistoComponent.h"
38 #include "AliHLTGlobalHistoComponent.h"
39 #include "AliHLTGlobalHistoCollector.h"
40 #include "AliHLTGlobalDCSPublisherComponent.h"
41
42 /** global instance for agent registration */
43 AliHLTGlobalAgent gAliHLTGlobalAgent;
44
45 /** ROOT macro for the implementation of ROOT specific class methods */
46 ClassImp(AliHLTGlobalAgent)
47
48 AliHLTGlobalAgent::AliHLTGlobalAgent()
49   :
50   AliHLTModuleAgent("Global")
51 {
52   // see header file for class documentation
53   // or
54   // refer to README to build package
55   // or
56   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
57 }
58
59 AliHLTGlobalAgent::~AliHLTGlobalAgent()
60 {
61   // see header file for class documentation
62 }
63
64 int AliHLTGlobalAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
65 {
66   // see header file for class documentation
67   assert(pHandler);
68   if (!pHandler) return -EINVAL;
69   pHandler->AddComponent(new AliHLTGlobalTrackMergerComponent);
70   pHandler->AddComponent(new AliHLTGlobalEsdConverterComponent);
71   pHandler->AddComponent(new AliHLTGlobalVertexerComponent);
72   pHandler->AddComponent(new AliHLTGlobalOfflineVertexerComponent);
73   pHandler->AddComponent(new AliHLTGlobalVertexerHistoComponent);
74   pHandler->AddComponent(new AliHLTGlobalHistoComponent);
75   pHandler->AddComponent(new AliHLTV0HistoComponent );
76   pHandler->AddComponent(new AliHLTGlobalHistoCollector );
77   pHandler->AddComponent(new AliHLTGlobalDCSPublisherComponent );
78   return 0;
79 }
80
81 int AliHLTGlobalAgent::CreateConfigurations(AliHLTConfigurationHandler* pHandler,
82                                             AliRawReader* /*rawReader*/,
83                                             AliRunLoader* /*runloader*/) const
84 {
85   // see header file for class documentation
86   if (!pHandler) return -EINVAL;
87   TObjArray* pTokens=NULL;
88
89   ///////////////////////////////////////////////////////////////////////////////////////////////////
90   //
91   // global vertexer component
92   //
93   // define the inputs 
94   TString vertexerInputs="TPC-globalmerger ITS-tracker";
95
96   // check for the availibility
97   pTokens=vertexerInputs.Tokenize(" ");
98   vertexerInputs="";
99   if (pTokens) {
100     for (int n=0; n<pTokens->GetEntriesFast(); n++) {
101       TString module=((TObjString*)pTokens->At(n))->GetString();
102       if (pHandler->FindConfiguration(module.Data())) {
103         vertexerInputs+=module;
104         vertexerInputs+=" ";
105       }
106     }
107     delete pTokens;
108     pTokens=NULL;
109   }
110   if (!vertexerInputs.IsNull()) {
111     HLTInfo("Configuring inputs to global HLT Vertexer: %s", vertexerInputs.Data());
112     pHandler->CreateConfiguration("GLOBAL-vertexer","GlobalVertexer",vertexerInputs,"");
113   } else {
114     HLTWarning("No inputs to global HLT Vertexer found");
115   }
116
117   /////////////////////////////////////////////////////////////////////////////////////
118   //
119   // assembly of the global ESD
120
121   // define the inputs to the global ESD
122   TString esdInputs="TPC-globalmerger TPC-mcTrackMarker ITS-tracker GLOBAL-vertexer TPC-dEdx VZERO-RECO";
123
124   // check for the availibility
125   pTokens=esdInputs.Tokenize(" ");
126   esdInputs="";
127   if (pTokens) {
128     for (int n=0; n<pTokens->GetEntriesFast(); n++) {
129       TString module=((TObjString*)pTokens->At(n))->GetString();
130       if (pHandler->FindConfiguration(module.Data())) {
131         esdInputs+=module;
132         esdInputs+=" ";
133       }
134     }
135     delete pTokens;
136     pTokens=NULL;
137   }
138
139   if (esdInputs.Length()>0) {
140     HLTInfo("Configuring inputs to global HLT ESD: %s", esdInputs.Data());
141   } else {
142     HLTWarning("No inputs to global HLT ESD found");
143   }
144
145   pHandler->CreateConfiguration("GLOBAL-esd-converter", "GlobalEsdConverter", esdInputs.Data(), "");
146
147   ///////////////////////////////////////////////////////////////////////////////////////////////////
148   //
149   // global histograms
150   //
151   TString vertexhistoInput="GLOBAL-vertexer ITS-SPD-vertexer";
152
153   // check for the availibility
154   pTokens=vertexhistoInput.Tokenize(" ");
155   vertexhistoInput="";
156   if (pTokens) {
157     for (int n=0; n<pTokens->GetEntriesFast(); n++) {
158       TString module=((TObjString*)pTokens->At(n))->GetString();
159       if (pHandler->FindConfiguration(module.Data())) {
160         vertexhistoInput+=module;
161         vertexhistoInput+=" ";
162       }
163     }
164     delete pTokens;
165     pTokens=NULL;
166   }
167
168   if (!vertexhistoInput.IsNull()) {
169     HLTInfo("Configuring inputs to global HLT Vertex histogram component: %s", vertexhistoInput.Data());
170     pHandler->CreateConfiguration("GLOBAL-vertexhisto","GlobalVertexerHisto", vertexhistoInput.Data(),"");
171   } else {
172     HLTWarning("No inputs to global HLT Vertex histogram component found");
173   }
174   
175   return 0;
176 }
177
178 const char* AliHLTGlobalAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
179                                                     AliRunLoader* runloader) const
180 {
181   // see header file for class documentation
182   if (runloader) {
183     // reconstruction chains for AliRoot simulation
184     // Note: run loader is only available while running embedded into
185     // AliRoot simulation
186     return "GLOBAL-esd-converter";
187   }
188   return NULL;
189 }
190
191 const char* AliHLTGlobalAgent::GetRequiredComponentLibraries() const
192 {
193   // see header file for class documentation
194
195   return "";
196 }
197
198 int AliHLTGlobalAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
199                                              AliHLTUInt32_t /*spec*/,
200                                              AliHLTOUTHandlerDesc& /*desc*/) const
201 {
202   // see header file for class documentation
203
204   return 0;
205 }
206
207 AliHLTOUTHandler* AliHLTGlobalAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/,
208                                                       AliHLTUInt32_t /*spec*/)
209 {
210   // see header file for class documentation
211
212   return NULL;
213 }
214
215 int AliHLTGlobalAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
216 {
217   // see header file for class documentation
218   if (pInstance==NULL) return -EINVAL;
219
220   return 0;
221 }