adding a component for statistics and monitoring of the DAQ readout list
[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"
8d37c582 37//#include "AliHLTMCGeneratorComponent.h"
fa5e8413 38#include "AliHLTESDMCEventPublisherComponent.h"
f3506ea2 39#include "AliHLTFileWriter.h"
40#include "AliHLTFilePublisher.h"
9bf94558 41#include "AliHLTBlockFilterComponent.h"
c1292031 42#include "AliHLTEsdCollectorComponent.h"
209986b4 43#include "AliHLTReadoutListDumpComponent.h"
c1292031 44#include "AliHLTOUTPublisherComponent.h"
b765ad15 45#include "AliHLTCompStatCollector.h"
f3506ea2 46
242bb794 47/** global instance for agent registration */
48AliHLTAgentUtil gAliHLTAgentUtil;
49
50/** ROOT macro for the implementation of ROOT specific class methods */
51ClassImp(AliHLTAgentUtil)
52
53AliHLTAgentUtil::AliHLTAgentUtil()
626bfcc1 54 :
b765ad15 55 AliHLTModuleAgent("Util"),
56 fCompStatDataHandler(NULL)
242bb794 57{
58 // see header file for class documentation
59 // or
60 // refer to README to build package
61 // or
62 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
63}
64
65AliHLTAgentUtil::~AliHLTAgentUtil()
66{
67 // see header file for class documentation
68}
69
b765ad15 70int AliHLTAgentUtil::CreateConfigurations(AliHLTConfigurationHandler* handler,
dee38f1b 71 AliRawReader* /*rawReader*/,
298ef463 72 AliRunLoader* /*runloader*/) const
242bb794 73{
74 // see header file for class documentation
b765ad15 75 if (!handler) return 0;
76
77 /////////////////////////////////////////////////////////////////////////////////////
78 //
79 // a kChain HLTOUT configuration for processing of {'COMPSTAT':'PRIV'} data blocks
80 // produces a TTree object of the component statistics and writes it to disc
81
82 // publisher component
83 handler->CreateConfiguration("UTIL-hltout-compstat-publisher", "AliHLTOUTPublisher" , NULL, "");
84
85 // collector configuration
86 handler->CreateConfiguration("UTIL-compstat-converter", "StatisticsCollector", "UTIL-hltout-compstat-publisher", "");
87
88 // writer configuration
89 handler->CreateConfiguration("UTIL-compstat-writer", "ROOTFileWriter", "UTIL-compstat-converter", "-datafile HLT.statistics.root -concatenate-events -overwrite");
90
242bb794 91 return 0;
92}
93
dee38f1b 94const char* AliHLTAgentUtil::GetReconstructionChains(AliRawReader* /*rawReader*/,
95 AliRunLoader* /*runloader*/) const
242bb794 96{
97 // see header file for class documentation
98 return NULL;
99}
100
101const char* AliHLTAgentUtil::GetRequiredComponentLibraries() const
102{
103 // see header file for class documentation
dee38f1b 104 return NULL;
242bb794 105}
f3506ea2 106
107int AliHLTAgentUtil::RegisterComponents(AliHLTComponentHandler* pHandler) const
108{
109 // see header file for class documentation
110 assert(pHandler);
111 if (!pHandler) return -EINVAL;
112 pHandler->AddComponent(new AliHLTDataGenerator);
113 pHandler->AddComponent(new AliHLTRawReaderPublisherComponent);
114 pHandler->AddComponent(new AliHLTLoaderPublisherComponent);
115 pHandler->AddComponent(new AliHLTRootFileStreamerComponent);
116 pHandler->AddComponent(new AliHLTRootFileWriterComponent);
117 pHandler->AddComponent(new AliHLTRootFilePublisherComponent);
8d37c582 118 // pHandler->AddComponent(new AliHLTMCGeneratorComponent);
fa5e8413 119 pHandler->AddComponent(new AliHLTESDMCEventPublisherComponent);
f3506ea2 120 pHandler->AddComponent(new AliHLTFileWriter);
121 pHandler->AddComponent(new AliHLTFilePublisher);
9bf94558 122 pHandler->AddComponent(new AliHLTBlockFilterComponent);
c1292031 123 pHandler->AddComponent(new AliHLTEsdCollectorComponent);
209986b4 124 pHandler->AddComponent(new AliHLTReadoutListDumpComponent);
c1292031 125 pHandler->AddComponent(new AliHLTOUTPublisherComponent);
b765ad15 126 pHandler->AddComponent(new AliHLTCompStatCollector);
127 return 0;
128}
129
130int AliHLTAgentUtil::GetHandlerDescription(AliHLTComponentDataType dt,
131 AliHLTUInt32_t /*spec*/,
fa5e8413 132 AliHLTOUTHandlerDesc& desc) const
b765ad15 133{
134 // see header file for class documentation
5baf307c 135 return 0;
b765ad15 136
137 // handler for the component statistics data blocks {'COMPSTAT':'PRIV'}
53f79557 138 if (dt==kAliHLTDataTypeComponentStatistics ||
139 dt==kAliHLTDataTypeComponentTable) {
b765ad15 140 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
141 return 1;
142 }
143
144 return 0;
145}
146
147AliHLTOUTHandler* AliHLTAgentUtil::GetOutputHandler(AliHLTComponentDataType dt,
148 AliHLTUInt32_t /*spec*/)
149{
150 // see header file for class documentation
5baf307c 151 return NULL;
b765ad15 152
153 // handler for the component statistics data blocks {'COMPSTAT':'PRIV'}
53f79557 154 if (dt==kAliHLTDataTypeComponentStatistics ||
155 dt==kAliHLTDataTypeComponentTable) {
b765ad15 156 if (fCompStatDataHandler==NULL)
157 fCompStatDataHandler=new AliHLTOUTHandlerChain("chains=UTIL-compstat-writer");
158 return fCompStatDataHandler;
159 }
160
161 return NULL;
162}
163
164int AliHLTAgentUtil::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
165{
166 // see header file for class documentation
167 if (pInstance==NULL) return -EINVAL;
168
169 if (pInstance==fCompStatDataHandler) {
170 delete fCompStatDataHandler;
171 fCompStatDataHandler=NULL;
172 }
f3506ea2 173 return 0;
174}