]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCPreprocessor.cxx
Small bug corrected
[u/mrichter/AliRoot.git] / ZDC / AliZDCPreprocessor.cxx
1 #include "AliZDCPreprocessor.h"
2
3 #include "AliCDBMetaData.h"
4 #include "AliDCSValue.h"
5 #include "AliLog.h"
6 #include "AliZDCDataDCS.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 AliZDCDataDCS, which
13 // reformats its. This class is then written to the CDB.
14 //
15
16 ClassImp(AliZDCPreprocessor)
17
18 //______________________________________________________________________________________________
19 AliZDCPreprocessor::AliZDCPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
20   AliPreprocessor(detector, shuttle),
21   fData(0)
22 {
23   // constructor
24 }
25
26 //______________________________________________________________________________________________
27 AliZDCPreprocessor::~AliZDCPreprocessor()
28 {
29   // destructor
30 }
31
32 //______________________________________________________________________________________________
33 void AliZDCPreprocessor::Initialize(Int_t run, UInt_t startTime,
34         UInt_t endTime)
35 {
36   // Creates AliZDCDataDCS 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 AliZDCDataDCS(fRun, fStartTime, fEndTime);
45 }
46
47 //______________________________________________________________________________________________
48 UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
49 {
50   // Fills data into a AliZDCDataDCS object
51
52   if (!dcsAliasMap)
53     return 0;
54
55   // The processing of the DCS input data is forwarded to AliZDCDataDCS
56         fData->ProcessData(*dcsAliasMap);
57
58   const char* PedfileName = GetFile(kDAQ, "PEDESTALS", "LDC0");
59   if(PedfileName){
60     AliInfo(Form("Got the file %s, now we can extract some values.", PedfileName));
61     //TODO here the file could be opened, some values extracted and  written to e.g. fData
62   }
63   else AliInfo(Form("File %s not found", PedfileName));
64
65   const char* EMDfileName = GetFile(kDAQ, "MUTUALEMD", "GDC");
66   if(EMDfileName){
67     AliInfo(Form("Got the file %s, now we can extract some values.", EMDfileName));
68     //TODO here the file could be opened, some values extracted and  written to e.g. fData
69   }
70   else AliInfo(Form("File %s not found", EMDfileName));
71
72   //Now we have to store the final CDB file
73   AliCDBMetaData metaData;
74         metaData.SetBeamPeriod(0);
75         metaData.SetResponsible("Chiara");
76         metaData.SetComment("This preprocessor fills an AliZDCDataDCS object.");
77
78         UInt_t result = Store(fData, &metaData);
79         delete fData;
80         fData = 0;
81
82   return result;
83 }
84