]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliHLTGlobalAgent.cxx
30199f0dbe4ed3f4b81935595950877f15e384ae
[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
35 /** global instance for agent registration */
36 AliHLTGlobalAgent gAliHLTGlobalAgent;
37
38 /** ROOT macro for the implementation of ROOT specific class methods */
39 ClassImp(AliHLTGlobalAgent)
40
41 AliHLTGlobalAgent::AliHLTGlobalAgent()
42   :
43   AliHLTModuleAgent("Global")
44 {
45   // see header file for class documentation
46   // or
47   // refer to README to build package
48   // or
49   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
50 }
51
52 AliHLTGlobalAgent::~AliHLTGlobalAgent()
53 {
54   // see header file for class documentation
55 }
56
57 int AliHLTGlobalAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
58 {
59   // see header file for class documentation
60   assert(pHandler);
61   if (!pHandler) return -EINVAL;
62   pHandler->AddComponent(new AliHLTGlobalTrackMergerComponent);
63   pHandler->AddComponent(new AliHLTGlobalEsdConverterComponent);
64   return 0;
65 }
66
67 int AliHLTGlobalAgent::CreateConfigurations(AliHLTConfigurationHandler* pHandler,
68                                             AliRawReader* /*rawReader*/,
69                                             AliRunLoader* /*runloader*/) const
70 {
71   // see header file for class documentation
72   if (!pHandler) return -EINVAL;
73
74   /////////////////////////////////////////////////////////////////////////////////////
75   //
76   // assembly of the global ESD
77
78   // define the inputs to the global ESD
79   TString esdInputs="TPC-globalmerger TPC-mcTrackMarker";
80
81   // check for the availibility
82   TObjArray* pTokens=esdInputs.Tokenize(" ");
83   esdInputs="";
84   if (pTokens) {
85     for (int n=0; n<pTokens->GetEntriesFast(); n++) {
86       TString module=((TObjString*)pTokens->At(n))->GetString();
87       if (pHandler->FindConfiguration(module.Data())) {
88         esdInputs+=module;
89         esdInputs+=" ";
90       }
91     }
92     delete pTokens;
93   }
94
95   if (esdInputs.Length()>0) {
96     HLTInfo("Configuring inputs to global HLT ESD: %s", esdInputs.Data());
97   } else {
98     HLTWarning("No inputs to global HLT ESD found");
99   }
100
101   pHandler->CreateConfiguration("GLOBAL-esd-converter", "GlobalEsdConverter", esdInputs.Data(), "");
102   
103   return 0;
104 }
105
106 const char* AliHLTGlobalAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
107                                                     AliRunLoader* runloader) const
108 {
109   // see header file for class documentation
110   if (runloader) {
111     // reconstruction chains for AliRoot simulation
112     // Note: run loader is only available while running embedded into
113     // AliRoot simulation
114     return "GLOBAL-esd-converter";
115   }
116   return NULL;
117 }
118
119 const char* AliHLTGlobalAgent::GetRequiredComponentLibraries() const
120 {
121   // see header file for class documentation
122
123   return "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so libAliHLTITS.so";
124 }
125
126 int AliHLTGlobalAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
127                                              AliHLTUInt32_t /*spec*/,
128                                              AliHLTOUTHandlerDesc& /*desc*/) const
129 {
130   // see header file for class documentation
131
132   return 0;
133 }
134
135 AliHLTOUTHandler* AliHLTGlobalAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/,
136                                                       AliHLTUInt32_t /*spec*/)
137 {
138   // see header file for class documentation
139
140   return NULL;
141 }
142
143 int AliHLTGlobalAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
144 {
145   // see header file for class documentation
146   if (pInstance==NULL) return -EINVAL;
147
148   return 0;
149 }