added port numbers to ldap schema and config classes (alberto)
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / AliTestPreprocessor.cxx
CommitLineData
5c6b40ae 1#include "AliTestPreprocessor.h"
2
3#include "AliCDBMetaData.h"
4#include "AliDCSValue.h"
5#include "AliLog.h"
6#include "AliTestDataDCS.h"
7
8#include <TTimeStamp.h>
9
10//
11// This class is an example for a simple preprocessor.
12// It takes data from DCS and passes it to the class AliTestDataDCS, which
13// reformats its. This class is then written to the CDB.
14//
15
16ClassImp(AliTestPreprocessor)
17
36137ac1 18//______________________________________________________________________________________________
fc5a4708 19AliTestPreprocessor::AliTestPreprocessor(AliShuttleInterface* shuttle) :
20 AliPreprocessor("TPC", shuttle),
5c6b40ae 21 fData(0)
22{
23 // constructor
24}
25
36137ac1 26//______________________________________________________________________________________________
5c6b40ae 27AliTestPreprocessor::~AliTestPreprocessor()
28{
29 // destructor
30}
31
36137ac1 32//______________________________________________________________________________________________
5c6b40ae 33void AliTestPreprocessor::Initialize(Int_t run, UInt_t startTime,
34 UInt_t endTime)
35{
36 // Creates AliTestDataDCS object
37
38 AliPreprocessor::Initialize(run, startTime, endTime);
39
40 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
41 TTimeStamp(startTime).AsString(),
42 TTimeStamp(endTime).AsString()));
43
44 fData = new AliTestDataDCS(fRun, fStartTime, fEndTime);
45}
46
36137ac1 47//______________________________________________________________________________________________
48UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
5c6b40ae 49{
50 // Fills data into a AliTestDataDCS object
51
52 if (!dcsAliasMap)
36137ac1 53 return 0;
5c6b40ae 54
36137ac1 55 // The processing of the DCS input data is forwarded to AliTestDataDCS
5c6b40ae 56 fData->ProcessData(*dcsAliasMap);
57
58 const char* fileName = GetFile(kDAQ, "PEDESTALS", "GDC");
59 if (fileName)
60 AliInfo(Form("Got the file %s, now we can extract some values.", fileName));
36137ac1 61 //TODO here the file could be opened, some values extracted and written to e.g. fData
62
63 TList* list = GetFileSources(kDAQ, "DRIFTVELOCITY");
64 if (list)
65 {
66 AliInfo("The following sources produced files with the id DRIFTVELOCITY");
67 list->Print();
68 delete list;
69 }
70 //TODO here the files could be opened, some values extracted and written to e.g. fData
71
eba76848 72 // Example of how to retrieve a run parameter using GetRunParameter function
73 // TODO Here the parameter must be set manually with SetInputRunParameter function,
74 // in reality it will be read from the run logbook!
75
76 // note that the parameters are returned as character strings!
77 const char* nEvents = GetRunParameter("totalEvents");
78 if (nEvents) {
79 Log(Form("Number of events for run %d: %s",fRun, nEvents));
80 } else {
81 Log(Form("Number of events not put in logbook!"));
82 }
83
84
36137ac1 85 //Now we have to store the final CDB file
5c6b40ae 86 AliCDBMetaData metaData;
87 metaData.SetBeamPeriod(0);
88 metaData.SetResponsible("Alberto Colla");
89 metaData.SetComment("This preprocessor fills an AliTestDataDCS object.");
90
84090f85 91 UInt_t result = Store("SHUTTLE", "Data", fData, &metaData, 0, 0);
5c6b40ae 92 delete fData;
93 fData = 0;
94
36137ac1 95 return result;
5c6b40ae 96}
97