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