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