]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliGRPPreprocessor.cxx
Adding a protection in the DCS d.p. object.
[u/mrichter/AliRoot.git] / STEER / AliGRPPreprocessor.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //-------------------------------------------------------------------------
17 //                          Class AliGRPPreprocessor
18 //                  Global Run Parameters (GRP) preprocessor
19 //    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
20 //-------------------------------------------------------------------------
21
22 #include "AliGRPPreprocessor.h"
23 #include "AliGRPDCS.h"
24
25 #include "AliCDBMetaData.h"
26 #include "AliLog.h"
27
28 #include <TTimeStamp.h>
29 #include <TMap.h>
30 #include <TObjString.h>
31
32 class AliDCSValue;
33 class AliShuttleInterface;
34
35 #include <TH1.h>
36
37 ClassImp(AliGRPPreprocessor)
38
39 //_______________________________________________________________
40 AliGRPPreprocessor::AliGRPPreprocessor():
41   AliPreprocessor("GRP",0) {
42   // default constructor - Don't use this!
43   
44 }
45
46 //_______________________________________________________________
47 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
48   AliPreprocessor("GRP",shuttle) {
49   // constructor - shuttle must be instantiated!
50   
51 }
52
53 //_______________________________________________________________
54 AliGRPPreprocessor::~AliGRPPreprocessor() {
55   //destructor
56 }
57
58 //_______________________________________________________________
59 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
60   // Initialize preprocessor
61   
62   AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
63   
64   fRun = run;
65   fStartTime = startTime;
66   fEndTime = endTime;
67   AliInfo("This preprocessor is to test the GetRunParameter function.");
68 }
69
70 //_______________________________________________________________
71 UInt_t AliGRPPreprocessor::Process(TMap* valueMap) {
72   // process data retrieved by the Shuttle
73   const char* timeStart = GetRunParameter("time_start");
74   const char* timeEnd = GetRunParameter("time_end");
75   TObjArray *alias1 = (TObjArray *)valueMap->GetValue("SFTTemp1.FloatValue");
76   if(!alias1) {
77     Log(Form("SFTTemp1.FloatValue not found!!!"));
78     return 0;
79   }
80   AliGRPDCS *dcs = new AliGRPDCS(alias1);
81   TH1F *h1 = new TH1F("alias1","",100,15,25);
82   TString sAlias1Mean = dcs->ProcessDCS(h1);  
83   
84   Int_t result=0;
85   
86   if (sAlias1Mean) {
87     Log(Form("<alias1> for run %d: %s",fRun, sAlias1Mean.Data()));
88   } else {
89     Log(Form("DCSAlias1 not put in TMap!"));
90   }
91   if (timeStart) {
92     Log(Form("Start time for run %d: %s",fRun, timeStart));
93   } else {
94     Log(Form("Start time not put in logbook!"));
95   }
96   if (timeEnd) {
97     Log(Form("End time for run %d: %s",fRun, timeEnd));
98   } else {
99     Log(Form("End time not put in logbook!"));
100   }
101   
102   TList *values = new TList();
103   values->SetOwner(1);
104   
105   TMap *map1 = new TMap();
106   map1->Add(new TObjString("histoDCS1"),h1);
107   values->Add(map1);
108
109   TMap *map2 = new TMap();
110   map2->Add(new TObjString("DCS1"),new TObjString(sAlias1Mean));
111   values->Add(map2);
112
113   TMap *map3 = new TMap();
114   map3->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
115   values->Add(map3);
116
117   TMap *map4 = new TMap();
118   map4->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
119   values->Add(map4);
120
121   AliCDBMetaData md;
122   md.SetResponsible("Panos");
123   
124   result = Store("GRP", "Values", values, &md);
125   
126   delete values;
127   
128   return result;
129 }
130