]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/SampleLib/AliHLTAgentSample.cxx
commenting unused arguments and deleting unused local variables
[u/mrichter/AliRoot.git] / HLT / SampleLib / AliHLTAgentSample.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 AliHLTAgentSample.cxx
20 @author Matthias Richter
21 @date
22 @brief Agent of the libAliHLTSample library
23*/
24
f3506ea2 25#include <cassert>
242bb794 26#include "AliHLTAgentSample.h"
27#include "AliHLTConfiguration.h"
28#include "TSystem.h"
29
f3506ea2 30// header files of library components
31#include "AliHLTDummyComponent.h"
5045badf 32#include "AliHLTSampleComponent1.h"
33#include "AliHLTSampleComponent2.h"
2accc11f 34#include "AliHLTSampleMonitoringComponent.h"
f3506ea2 35
12ec5482 36// header file of the module preprocessor
37#include "AliHLTSamplePreprocessor.h"
38
833b3167 39// raw data handler of HLTOUT data
40#include "AliHLTOUTHandlerEquId.h"
41
242bb794 42/** global instance for agent registration */
43AliHLTAgentSample gAliHLTAgentSample;
44
90ebac25 45const char* AliHLTAgentSample::fgkAliHLTAgentSampleData="/tmp/testdata";
46const char* AliHLTAgentSample::fgkAliHLTAgentSampleOut="/tmp/hltout";
242bb794 47
48/** ROOT macro for the implementation of ROOT specific class methods */
49ClassImp(AliHLTAgentSample)
50
51AliHLTAgentSample::AliHLTAgentSample()
626bfcc1 52 :
53 AliHLTModuleAgent("Sample")
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
62AliHLTAgentSample::~AliHLTAgentSample()
63{
64 // see header file for class documentation
65
66 // delete the test data
90ebac25 67 ofstream dump(fgkAliHLTAgentSampleData, ios::in);
242bb794 68 if (dump.good()) {
69 TString arg("rm -f ");
90ebac25 70 arg+=fgkAliHLTAgentSampleData;
242bb794 71 gSystem->Exec(arg.Data());
72 }
73}
74
75int AliHLTAgentSample::CreateConfigurations(AliHLTConfigurationHandler* handler,
d76bc02a 76 AliRawReader* /*rawReader*/,
833b3167 77 AliRunLoader* runloader) const
242bb794 78{
79 // see header file for class documentation
80
81 // create some test data
90ebac25 82 ofstream dump(fgkAliHLTAgentSampleData, (ios::openmode)0);
242bb794 83 dump << "This is just some test data for the ALICE HLT analysis example";
84 dump << "---- not copied" << endl;
85 dump.close();
86
87 if (handler) {
88 // the publisher configuration for the test data
90191691 89 TString arg("-datatype DUMMYDAT TEST -datafile ");
90ebac25 90 arg+=fgkAliHLTAgentSampleData;
242bb794 91 HLTDebug(arg.Data());
90ebac25 92 handler->CreateConfiguration("sample-fp1" , "FilePublisher", NULL , arg.Data());
242bb794 93
94 // the configuration for the dummy component
90ebac25 95 handler->CreateConfiguration("sample-cp" , "Dummy" , "sample-fp1", "output_percentage 80");
242bb794 96
97 // the writer configuration
90ebac25 98 arg="-datafile "; arg+=fgkAliHLTAgentSampleOut;
99 handler->CreateConfiguration("sample-sink1", "FileWriter" , "sample-cp" , arg.Data());
100
833b3167 101 // specific example for the AliRoot simulation (run loader present)
102 if (runloader) {
90ebac25 103 // sample offline source
104 handler->CreateConfiguration("sample-offsrc", "AliLoaderPublisher" , NULL , "-loader TPCLoader -tree digits -verbose");
105
106 // sample offline sink
107 handler->CreateConfiguration("sample-offsnk", "SampleOfflineDataSink" , "sample-offsrc" , NULL);
833b3167 108 }
242bb794 109 }
110 return 0;
111}
112
d76bc02a 113const char* AliHLTAgentSample::GetReconstructionChains(AliRawReader* /*rawReader*/,
833b3167 114 AliRunLoader* runloader) const
242bb794 115{
116 // see header file for class documentation
833b3167 117 if (runloader) return "sample-sink1 sample-offsnk";
118
119 return "sample-sink1";
242bb794 120}
121
122const char* AliHLTAgentSample::GetRequiredComponentLibraries() const
123{
124 // see header file for class documentation
125 return "libAliHLTUtil.so libAliHLTSample.so";
126}
f3506ea2 127
128int AliHLTAgentSample::RegisterComponents(AliHLTComponentHandler* pHandler) const
129{
130 // see header file for class documentation
131 assert(pHandler);
132 if (!pHandler) return -EINVAL;
133 pHandler->AddComponent(new AliHLTDummyComponent);
5045badf 134 pHandler->AddComponent(new AliHLTSampleComponent1);
135 pHandler->AddComponent(new AliHLTSampleComponent2);
2accc11f 136 pHandler->AddComponent(new AliHLTSampleMonitoringComponent);
5045badf 137
f3506ea2 138 return 0;
139}
d76bc02a 140
12ec5482 141AliHLTModulePreprocessor* AliHLTAgentSample::GetPreprocessor()
142{
143 // see header file for class documentation
144 return new AliHLTSamplePreprocessor;
145}
833b3167 146
147int AliHLTAgentSample::GetHandlerDescription(AliHLTComponentDataType dt,
148 AliHLTUInt32_t spec,
149 AliHLTOUTHandlerDesc& desc) const
150{
151 // see header file for class documentation
152 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginSample)) {
153 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
154 HLTInfo("module %s handles data block type %s specification %d (0x%x)",
155 GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
156 return 1;
157 }
158 return 0;
159}
160
161AliHLTOUTHandler* AliHLTAgentSample::GetOutputHandler(AliHLTComponentDataType dt,
162 AliHLTUInt32_t /*spec*/)
163{
164 // see header file for class documentation
165 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginSample)) {
166 // use the default handler
167 return new AliHLTOUTHandlerEquId;
168 }
169 return NULL;
170}
171
172int AliHLTAgentSample::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
173{
174 // see header file for class documentation
175 if (pInstance==NULL) return -EINVAL;
176
177 delete pInstance;
178 return 0;
179}