corrections to write ESD format (Gaute)
[u/mrichter/AliRoot.git] / HLT / SampleLib / AliHLTAgentSample.cxx
CommitLineData
242bb794 1// @(#) $Id$
2
3/** @file AliHLTAgentSample.cxx
4 @author Matthias Richter
5 @date
6 @brief Agent of the libAliHLTSample library
7*/
8
9#include "AliHLTAgentSample.h"
10#include "AliHLTConfiguration.h"
11#include "TSystem.h"
12
13/** global instance for agent registration */
14AliHLTAgentSample gAliHLTAgentSample;
15
90ebac25 16const char* AliHLTAgentSample::fgkAliHLTAgentSampleData="/tmp/testdata";
17const char* AliHLTAgentSample::fgkAliHLTAgentSampleOut="/tmp/hltout";
242bb794 18
19/** ROOT macro for the implementation of ROOT specific class methods */
20ClassImp(AliHLTAgentSample)
21
22AliHLTAgentSample::AliHLTAgentSample()
23{
24 // see header file for class documentation
25 // or
26 // refer to README to build package
27 // or
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29}
30
31AliHLTAgentSample::~AliHLTAgentSample()
32{
33 // see header file for class documentation
34
35 // delete the test data
90ebac25 36 ofstream dump(fgkAliHLTAgentSampleData, ios::in);
242bb794 37 if (dump.good()) {
38 TString arg("rm -f ");
90ebac25 39 arg+=fgkAliHLTAgentSampleData;
242bb794 40 gSystem->Exec(arg.Data());
41 }
42}
43
44int AliHLTAgentSample::CreateConfigurations(AliHLTConfigurationHandler* handler,
90ebac25 45 AliRunLoader* runloader) const
242bb794 46{
47 // see header file for class documentation
48
49 // create some test data
90ebac25 50 ofstream dump(fgkAliHLTAgentSampleData, (ios::openmode)0);
242bb794 51 dump << "This is just some test data for the ALICE HLT analysis example";
52 dump << "---- not copied" << endl;
53 dump.close();
54
55 if (handler) {
56 // the publisher configuration for the test data
57 TString arg("-datafile ");
90ebac25 58 arg+=fgkAliHLTAgentSampleData;
242bb794 59 HLTDebug(arg.Data());
90ebac25 60 handler->CreateConfiguration("sample-fp1" , "FilePublisher", NULL , arg.Data());
242bb794 61
62 // the configuration for the dummy component
90ebac25 63 handler->CreateConfiguration("sample-cp" , "Dummy" , "sample-fp1", "output_percentage 80");
242bb794 64
65 // the writer configuration
90ebac25 66 arg="-datafile "; arg+=fgkAliHLTAgentSampleOut;
67 handler->CreateConfiguration("sample-sink1", "FileWriter" , "sample-cp" , arg.Data());
68
69 // sample offline source
70 handler->CreateConfiguration("sample-offsrc", "AliLoaderPublisher" , NULL , "-loader TPCLoader -tree digits -verbose");
71
72 // sample offline sink
73 handler->CreateConfiguration("sample-offsnk", "SampleOfflineDataSink" , "sample-offsrc" , NULL);
242bb794 74 }
75 return 0;
76}
77
90ebac25 78const char* AliHLTAgentSample::GetLocalRecConfigurations(AliRunLoader* runloader) const
242bb794 79{
80 // see header file for class documentation
90ebac25 81 return "sample-sink1 sample-offsnk";
242bb794 82}
83
84const char* AliHLTAgentSample::GetRequiredComponentLibraries() const
85{
86 // see header file for class documentation
87 return "libAliHLTUtil.so libAliHLTSample.so";
88}