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