]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/SampleLib/AliHLTAgentSample.cxx
31f319fd301501d4ca82b73c64afc77dcc297c9e
[u/mrichter/AliRoot.git] / HLT / SampleLib / AliHLTAgentSample.cxx
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 */
14 AliHLTAgentSample gAliHLTAgentSample;
15
16 const char* gAliHLTAgentSampleData="/tmp/testdata";
17 const char* gAliHLTAgentSampleOut="/tmp/hltout";
18
19 /** ROOT macro for the implementation of ROOT specific class methods */
20 ClassImp(AliHLTAgentSample)
21
22 AliHLTAgentSample::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
31 AliHLTAgentSample::~AliHLTAgentSample()
32 {
33   // see header file for class documentation
34
35   // delete the test data
36   ofstream dump(gAliHLTAgentSampleData, ios::in);
37   if (dump.good()) {
38     TString arg("rm -f ");
39     arg+=gAliHLTAgentSampleData;
40     gSystem->Exec(arg.Data());
41   }
42 }
43
44 int AliHLTAgentSample::CreateConfigurations(AliHLTConfigurationHandler* handler,
45                                           AliRunLoader* runloader) const
46 {
47   // see header file for class documentation
48
49   // create some test data
50   ofstream dump(gAliHLTAgentSampleData, (ios::openmode)0);
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 ");
58     arg+=gAliHLTAgentSampleData;
59     HLTDebug(arg.Data());
60     handler->CreateConfiguration("fp1"  , "FilePublisher", NULL , arg.Data());
61
62     // the configuration for the dummy component
63     handler->CreateConfiguration("cp"   , "Dummy"        , "fp1", "output_percentage 80");
64
65     // the writer configuration
66     arg="-datafile "; arg+=gAliHLTAgentSampleOut;
67     handler->CreateConfiguration("sink1", "FileWriter"   , "cp" , arg.Data());
68   }
69   return 0;
70 }
71
72 const char* AliHLTAgentSample::GetTopConfigurations(AliRunLoader* runloader) const
73 {
74   // see header file for class documentation
75   return "sink1";
76 }
77
78 const char* AliHLTAgentSample::GetRequiredComponentLibraries() const
79 {
80   // see header file for class documentation
81   return "libAliHLTUtil.so libAliHLTSample.so";
82 }