]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTAgentUtil.cxx
tracking at slice borders improved
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTAgentUtil.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   AliHLTAgentUtil.cxx
20     @author Matthias Richter
21     @date   
22     @brief  Agent of the libAliHLTUtil library
23 */
24
25 #include <cassert>
26 #include "AliHLTAgentUtil.h"
27 #include "AliHLTOUTHandlerChain.h"
28
29 // header files of library components
30 #include "AliHLTDataGenerator.h"
31 #include "AliHLTRawReaderPublisherComponent.h"
32 #include "AliHLTLoaderPublisherComponent.h"
33 #include "AliHLTRootFileStreamerComponent.h"
34 #include "AliHLTRootFileWriterComponent.h"
35 #include "AliHLTRootFilePublisherComponent.h"
36 #include "AliHLTRootSchemaEvolutionComponent.h"
37 #include "AliHLTRecoParamComponent.h"
38 //#include "AliHLTMCGeneratorComponent.h"
39 #include "AliHLTESDMCEventPublisherComponent.h"
40 #include "AliHLTFileWriter.h"
41 #include "AliHLTFilePublisher.h"
42 #include "AliHLTBlockFilterComponent.h"
43 #include "AliHLTMonitoringRelay.h"
44 #include "AliHLTEsdCollectorComponent.h"
45 #include "AliHLTReadoutListDumpComponent.h"
46 #include "AliHLTOUTPublisherComponent.h"
47 #include "AliHLTCompStatCollector.h"
48 #include "AliHLTCorruptorComponent.h"
49 #include "AliHLTObjectCompressionComponent.h"
50
51 /** global instance for agent registration */
52 AliHLTAgentUtil gAliHLTAgentUtil;
53
54 /** ROOT macro for the implementation of ROOT specific class methods */
55 ClassImp(AliHLTAgentUtil)
56
57 AliHLTAgentUtil::AliHLTAgentUtil()
58   : AliHLTModuleAgent("Util")
59   , fCompStatDataHandler(NULL)
60   , fStreamerInfoDataHandler(NULL)
61 {
62   // see header file for class documentation
63   // or
64   // refer to README to build package
65   // or
66   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
67 }
68
69 AliHLTAgentUtil::~AliHLTAgentUtil()
70 {
71   // see header file for class documentation
72 }
73
74 int AliHLTAgentUtil::CreateConfigurations(AliHLTConfigurationHandler* handler,
75                                           AliRawReader* /*rawReader*/,
76                                           AliRunLoader* /*runloader*/) const
77 {
78   // see header file for class documentation
79   if (!handler) return 0;
80
81   /////////////////////////////////////////////////////////////////////////////////////
82   //
83   // a kChain HLTOUT configuration for processing of {'COMPSTAT':'PRIV'} data blocks
84   // produces a TTree object of the component statistics and writes it to disc
85
86   // publisher component
87   handler->CreateConfiguration("UTIL-hltout-compstat-publisher", "AliHLTOUTPublisher"   , NULL, "-disable-component-stat");
88
89   // collector configuration
90   handler->CreateConfiguration("UTIL-compstat-converter", "StatisticsCollector", "UTIL-hltout-compstat-publisher", "-disable-component-stat");
91
92   // writer configuration
93   handler->CreateConfiguration("UTIL-compstat-writer", "ROOTFileWriter", "UTIL-compstat-converter", "-datafile HLT.statistics.root -concatenate-events -overwrite");
94
95   return 0;
96 }
97
98 const char* AliHLTAgentUtil::GetReconstructionChains(AliRawReader* /*rawReader*/,
99                                                      AliRunLoader* /*runloader*/) const
100 {
101   // see header file for class documentation
102   return NULL;
103 }
104
105 const char* AliHLTAgentUtil::GetRequiredComponentLibraries() const
106 {
107   // see header file for class documentation
108   return NULL;
109 }
110
111 int AliHLTAgentUtil::RegisterComponents(AliHLTComponentHandler* pHandler) const
112 {
113   // see header file for class documentation
114   assert(pHandler);
115   if (!pHandler) return -EINVAL;
116   pHandler->AddComponent(new AliHLTDataGenerator);
117   pHandler->AddComponent(new AliHLTRawReaderPublisherComponent);
118   pHandler->AddComponent(new AliHLTLoaderPublisherComponent);
119   pHandler->AddComponent(new AliHLTRootFileStreamerComponent);
120   pHandler->AddComponent(new AliHLTRootFileWriterComponent);
121   pHandler->AddComponent(new AliHLTRootFilePublisherComponent);
122   pHandler->AddComponent(new AliHLTRootSchemaEvolutionComponent);
123   pHandler->AddComponent(new AliHLTRecoParamComponent);
124   //  pHandler->AddComponent(new AliHLTMCGeneratorComponent);
125   pHandler->AddComponent(new AliHLTESDMCEventPublisherComponent);
126   pHandler->AddComponent(new AliHLTFileWriter);
127   pHandler->AddComponent(new AliHLTFilePublisher);
128   pHandler->AddComponent(new AliHLTBlockFilterComponent);
129   pHandler->AddComponent(new AliHLTMonitoringRelay);
130   pHandler->AddComponent(new AliHLTEsdCollectorComponent);
131   pHandler->AddComponent(new AliHLTReadoutListDumpComponent);
132   pHandler->AddComponent(new AliHLTOUTPublisherComponent);
133   pHandler->AddComponent(new AliHLTCompStatCollector);
134   pHandler->AddComponent(new AliHLTCorruptorComponent);
135   pHandler->AddComponent(new AliHLTObjectCompressionComponent);
136   return 0;
137 }
138
139 int AliHLTAgentUtil::GetHandlerDescription(AliHLTComponentDataType dt,
140                                            AliHLTUInt32_t /*spec*/,
141                                            AliHLTOUTHandlerDesc& desc) const
142 {
143   // see header file for class documentation
144
145   // handler for the component statistics data blocks {'COMPSTAT':'PRIV'}
146   if (dt==kAliHLTDataTypeComponentStatistics ||
147       dt==kAliHLTDataTypeComponentTable) {
148       desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
149       return 1;
150   }
151
152   // handler for the component statistics data blocks {'ROOTSTRI':'HLT '}
153   if (dt==kAliHLTDataTypeStreamerInfo) {
154       desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
155       return 1;
156   }
157   return 0;
158 }
159
160 AliHLTOUTHandler* AliHLTAgentUtil::GetOutputHandler(AliHLTComponentDataType dt,
161                                                    AliHLTUInt32_t /*spec*/)
162 {
163   // see header file for class documentation
164
165   // handler for the component statistics data blocks {'COMPSTAT':'PRIV'}
166   if (dt==kAliHLTDataTypeComponentStatistics ||
167       dt==kAliHLTDataTypeComponentTable) {
168     if (fCompStatDataHandler==NULL)
169       fCompStatDataHandler=new AliHLTOUTHandlerChain("chains=UTIL-compstat-writer");
170     return fCompStatDataHandler;
171   }
172
173   // handler for the component statistics data blocks {'ROOTSTRI':'HLT '}
174   if (dt==kAliHLTDataTypeStreamerInfo) {
175     if (fStreamerInfoDataHandler==NULL)
176       fStreamerInfoDataHandler=new AliHLTStreamerInfoHandler;
177     return fStreamerInfoDataHandler;
178   }
179
180   return NULL;
181 }
182
183 int AliHLTAgentUtil::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
184 {
185   // see header file for class documentation
186   if (pInstance==NULL) return -EINVAL;
187
188   if (pInstance==fCompStatDataHandler) {
189     delete fCompStatDataHandler;
190     fCompStatDataHandler=NULL;
191   }
192
193   if (pInstance==fStreamerInfoDataHandler) {
194     delete fStreamerInfoDataHandler;
195     fStreamerInfoDataHandler=NULL;
196   }
197   return 0;
198 }