]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SHUTTLE/TestShuttle/AliTestPreprocessor.cxx
1d3f3b130ebf3fb2e15e1df32ea2e278432d9ca5
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / AliTestPreprocessor.cxx
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
16 ClassImp(AliTestPreprocessor)
17
18 AliTestPreprocessor::AliTestPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
19   AliPreprocessor(detector, shuttle),
20   fData(0)
21 {
22   // constructor
23 }
24
25 AliTestPreprocessor::~AliTestPreprocessor()
26 {
27   // destructor
28 }
29
30 void AliTestPreprocessor::Initialize(Int_t run, UInt_t startTime,
31         UInt_t endTime)
32 {
33   // Creates AliTestDataDCS object
34
35   AliPreprocessor::Initialize(run, startTime, endTime);
36
37         AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
38                 TTimeStamp(startTime).AsString(),
39                 TTimeStamp(endTime).AsString()));
40
41         fData = new AliTestDataDCS(fRun, fStartTime, fEndTime);
42 }
43
44 Int_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
45 {
46   // Fills data into a AliTestDataDCS object
47
48   if (!dcsAliasMap)
49     return -1;
50
51         fData->ProcessData(*dcsAliasMap);
52
53   const char* fileName = GetFile(kDAQ, "PEDESTALS", "GDC");
54   if (fileName)
55     AliInfo(Form("Got the file %s, now we can extract some values.", fileName));
56   // open file, extract some values, write them to fData
57
58   AliCDBMetaData metaData;
59         metaData.SetBeamPeriod(0);
60         metaData.SetResponsible("Alberto Colla");
61         metaData.SetComment("This preprocessor fills an AliTestDataDCS object.");
62
63         Store(fData, &metaData);
64         delete fData;
65         fData = 0;
66
67   return 0;
68 }
69