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