]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/SampleLib/AliHLTAgentSample.cxx
- support for event by event reconstruction added to AliHLTSystem
[u/mrichter/AliRoot.git] / HLT / SampleLib / AliHLTAgentSample.cxx
1 // @(#) $Id$
2
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
19 /** @file   AliHLTAgentSample.cxx
20     @author Matthias Richter
21     @date   
22     @brief  Agent of the libAliHLTSample library
23 */
24
25 #include "AliHLTAgentSample.h"
26 #include "AliHLTConfiguration.h"
27 #include "TSystem.h"
28
29 /** global instance for agent registration */
30 AliHLTAgentSample gAliHLTAgentSample;
31
32 const char* AliHLTAgentSample::fgkAliHLTAgentSampleData="/tmp/testdata";
33 const char* AliHLTAgentSample::fgkAliHLTAgentSampleOut="/tmp/hltout";
34
35 /** ROOT macro for the implementation of ROOT specific class methods */
36 ClassImp(AliHLTAgentSample)
37
38 AliHLTAgentSample::AliHLTAgentSample()
39 {
40   // see header file for class documentation
41   // or
42   // refer to README to build package
43   // or
44   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
45 }
46
47 AliHLTAgentSample::~AliHLTAgentSample()
48 {
49   // see header file for class documentation
50
51   // delete the test data
52   ofstream dump(fgkAliHLTAgentSampleData, ios::in);
53   if (dump.good()) {
54     TString arg("rm -f ");
55     arg+=fgkAliHLTAgentSampleData;
56     gSystem->Exec(arg.Data());
57   }
58 }
59
60 int AliHLTAgentSample::CreateConfigurations(AliHLTConfigurationHandler* handler,
61                                             AliRawReader* rawReader,
62                                             AliRunLoader* runloader) const
63 {
64   // see header file for class documentation
65
66   // create some test data
67   ofstream dump(fgkAliHLTAgentSampleData, (ios::openmode)0);
68   dump << "This is just some test data for the ALICE HLT analysis example";
69   dump << "---- not copied" << endl;
70   dump.close();
71
72   if (handler) {
73     // the publisher configuration for the test data
74     TString arg("-datatype DUMMYDAT TEST -datafile ");
75     arg+=fgkAliHLTAgentSampleData;
76     HLTDebug(arg.Data());
77     handler->CreateConfiguration("sample-fp1"  , "FilePublisher", NULL , arg.Data());
78
79     // the configuration for the dummy component
80     handler->CreateConfiguration("sample-cp"   , "Dummy"        , "sample-fp1", "output_percentage 80");
81
82     // the writer configuration
83     arg="-datafile "; arg+=fgkAliHLTAgentSampleOut;
84     handler->CreateConfiguration("sample-sink1", "FileWriter"   , "sample-cp" , arg.Data());
85
86     // sample offline source
87     handler->CreateConfiguration("sample-offsrc", "AliLoaderPublisher"   , NULL , "-loader TPCLoader -tree digits -verbose");
88
89     // sample offline sink
90     handler->CreateConfiguration("sample-offsnk", "SampleOfflineDataSink"   , "sample-offsrc" , NULL);
91   }
92   return 0;
93 }
94
95 const char* AliHLTAgentSample::GetReconstructionChains(AliRawReader* rawReader,
96                                                        AliRunLoader* runloader) const
97 {
98   // see header file for class documentation
99   return "sample-sink1 sample-offsnk";
100 }
101
102 const char* AliHLTAgentSample::GetRequiredComponentLibraries() const
103 {
104   // see header file for class documentation
105   return "libAliHLTUtil.so libAliHLTSample.so";
106 }