fix a stupid mistake from previous commit
[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"
32
242bb794 33/** global instance for agent registration */
34AliHLTAgentSample gAliHLTAgentSample;
35
90ebac25 36const char* AliHLTAgentSample::fgkAliHLTAgentSampleData="/tmp/testdata";
37const char* AliHLTAgentSample::fgkAliHLTAgentSampleOut="/tmp/hltout";
242bb794 38
39/** ROOT macro for the implementation of ROOT specific class methods */
40ClassImp(AliHLTAgentSample)
41
42AliHLTAgentSample::AliHLTAgentSample()
43{
44 // see header file for class documentation
45 // or
46 // refer to README to build package
47 // or
48 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
49}
50
51AliHLTAgentSample::~AliHLTAgentSample()
52{
53 // see header file for class documentation
54
55 // delete the test data
90ebac25 56 ofstream dump(fgkAliHLTAgentSampleData, ios::in);
242bb794 57 if (dump.good()) {
58 TString arg("rm -f ");
90ebac25 59 arg+=fgkAliHLTAgentSampleData;
242bb794 60 gSystem->Exec(arg.Data());
61 }
62}
63
64int AliHLTAgentSample::CreateConfigurations(AliHLTConfigurationHandler* handler,
dee38f1b 65 AliRawReader* rawReader,
90ebac25 66 AliRunLoader* runloader) const
242bb794 67{
68 // see header file for class documentation
69
70 // create some test data
90ebac25 71 ofstream dump(fgkAliHLTAgentSampleData, (ios::openmode)0);
242bb794 72 dump << "This is just some test data for the ALICE HLT analysis example";
73 dump << "---- not copied" << endl;
74 dump.close();
75
76 if (handler) {
77 // the publisher configuration for the test data
90191691 78 TString arg("-datatype DUMMYDAT TEST -datafile ");
90ebac25 79 arg+=fgkAliHLTAgentSampleData;
242bb794 80 HLTDebug(arg.Data());
90ebac25 81 handler->CreateConfiguration("sample-fp1" , "FilePublisher", NULL , arg.Data());
242bb794 82
83 // the configuration for the dummy component
90ebac25 84 handler->CreateConfiguration("sample-cp" , "Dummy" , "sample-fp1", "output_percentage 80");
242bb794 85
86 // the writer configuration
90ebac25 87 arg="-datafile "; arg+=fgkAliHLTAgentSampleOut;
88 handler->CreateConfiguration("sample-sink1", "FileWriter" , "sample-cp" , arg.Data());
89
90 // sample offline source
91 handler->CreateConfiguration("sample-offsrc", "AliLoaderPublisher" , NULL , "-loader TPCLoader -tree digits -verbose");
92
93 // sample offline sink
94 handler->CreateConfiguration("sample-offsnk", "SampleOfflineDataSink" , "sample-offsrc" , NULL);
242bb794 95 }
96 return 0;
97}
98
dee38f1b 99const char* AliHLTAgentSample::GetReconstructionChains(AliRawReader* rawReader,
100 AliRunLoader* runloader) const
242bb794 101{
102 // see header file for class documentation
90ebac25 103 return "sample-sink1 sample-offsnk";
242bb794 104}
105
106const char* AliHLTAgentSample::GetRequiredComponentLibraries() const
107{
108 // see header file for class documentation
109 return "libAliHLTUtil.so libAliHLTSample.so";
110}
f3506ea2 111
112int AliHLTAgentSample::RegisterComponents(AliHLTComponentHandler* pHandler) const
113{
114 // see header file for class documentation
115 assert(pHandler);
116 if (!pHandler) return -EINVAL;
117 pHandler->AddComponent(new AliHLTDummyComponent);
118 return 0;
119}