]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliGRPPreprocessor.cxx
573828e1d22529f013a52675591aa4339ef208fa
[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 /* $Id$ */
17
18 //-------------------------------------------------------------------------
19 //                          Class AliGRPPreprocessor
20 //                  Global Run Parameters (GRP) preprocessor
21 //    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-------------------------------------------------------------------------
23
24 #include <TList.h>
25 #include <TMap.h>
26 #include <TObjString.h>
27 #include <TTimeStamp.h>
28
29 #include "AliGRPPreprocessor.h"
30 #include "AliGRPDCS.h"
31
32 #include "AliCDBMetaData.h"
33 #include "AliLog.h"
34
35 class AliDCSValue;
36 class AliShuttleInterface;
37
38 #include <TH1.h>
39
40 ClassImp(AliGRPPreprocessor)
41
42 //_______________________________________________________________
43 AliGRPPreprocessor::AliGRPPreprocessor():
44   AliPreprocessor("GRP",0) {
45   // default constructor - Don't use this!
46   
47 }
48
49 //_______________________________________________________________
50 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
51   AliPreprocessor("GRP",shuttle) {
52   // constructor - shuttle must be instantiated!
53   
54 }
55
56 //_______________________________________________________________
57 AliGRPPreprocessor::~AliGRPPreprocessor() {
58   //destructor
59 }
60
61 //_______________________________________________________________
62 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
63   // Initialize preprocessor
64   
65   AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
66   
67   fRun = run;
68   fStartTime = startTime;
69   fEndTime = endTime;
70   AliInfo("This preprocessor is to test the GetRunParameter function.");
71 }
72
73 //_______________________________________________________________
74 UInt_t AliGRPPreprocessor::Process(TMap* valueMap) {
75   // process data retrieved by the Shuttle
76   const char* timeStart = GetRunParameter("time_start");
77   const char* timeEnd = GetRunParameter("time_end");
78   const char* beamEnergy = GetRunParameter("beamEnergy");
79   const char* beamType = GetRunParameter("beamType");
80   const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
81   const char* detectorMask = GetRunParameter("detectorMask");
82
83   TObjArray *alias1 = (TObjArray *)valueMap->GetValue("SFTTemp1.FloatValue");
84   if(!alias1) {
85     Log(Form("SFTTemp1.FloatValue not found!!!"));
86     return 0;
87   }
88   AliGRPDCS *dcs = new AliGRPDCS(alias1);
89   TH1F *h1 = new TH1F("alias1","",100,15,25);
90   TString sAlias1Mean = dcs->ProcessDCS(h1);  
91   
92   Int_t result=0;
93   
94   if (sAlias1Mean) {
95     Log(Form("<alias1> for run %d: %s",fRun, sAlias1Mean.Data()));
96   } else {
97     Log(Form("DCSAlias1 not put in TMap!"));
98   }
99
100   //DAQ logbook
101   if (timeStart) {
102     Log(Form("Start time for run %d: %s",fRun, timeStart));
103   } else {
104     Log(Form("Start time not put in logbook!"));
105   }
106   if (timeEnd) {
107     Log(Form("End time for run %d: %s",fRun, timeEnd));
108   } else {
109     Log(Form("End time not put in logbook!"));
110   }
111   if (beamEnergy) {
112     Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
113   } else {
114     Log(Form("Beam energy not put in logbook!"));
115   }
116   if (beamType) {
117     Log(Form("Beam type for run %d: %s",fRun, beamType));
118   } else {
119     Log(Form("Beam type not put in logbook!"));
120   }
121   if (numberOfDetectors) {
122     Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
123   } else {
124     Log(Form("Number of active detectors not put in logbook!"));
125   }
126   if (detectorMask) {
127     Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
128   } else {
129     Log(Form("Detector mask not put in logbook!"));
130   }
131
132   TList *values = new TList();
133   values->SetOwner(1);
134   
135   //DAQ logbook
136   TMap *mapDAQ1 = new TMap();
137   mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
138   values->Add(mapDAQ1);
139
140   TMap *mapDAQ2 = new TMap();
141   mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
142   values->Add(mapDAQ2);
143
144   TMap *mapDAQ3 = new TMap();
145   mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
146   values->Add(mapDAQ3);
147
148   TMap *mapDAQ4 = new TMap();
149   mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
150   values->Add(mapDAQ4);
151
152   TMap *mapDAQ5 = new TMap();
153   mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
154   values->Add(mapDAQ5);
155
156   TMap *mapDAQ6 = new TMap();
157   mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
158   values->Add(mapDAQ6);
159
160   //DCS dp
161   TMap *mapDCS1 = new TMap();
162   mapDCS1->Add(new TObjString("histoDCS1"),h1);
163   values->Add(mapDCS1);
164
165   TMap *mapDCS2 = new TMap();
166   mapDCS2->Add(new TObjString("DCS1"),new TObjString(sAlias1Mean));
167   values->Add(mapDCS2);
168
169   AliCDBMetaData md;
170   md.SetResponsible("Panos");
171   
172   result = Store("GRP", "Values", values, &md);
173   
174   delete values;
175   
176   return result;
177 }
178