Comments for Doxygen (mostly added comments for inline functions)
[u/mrichter/AliRoot.git] / STEER / AliGRPPreprocessor.cxx
CommitLineData
3dedb44a 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
7ca4655f 16/* $Id$ */
17
3dedb44a 18//-------------------------------------------------------------------------
19// Class AliGRPPreprocessor
20// Global Run Parameters (GRP) preprocessor
21// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22//-------------------------------------------------------------------------
23
7ca4655f 24#include <TList.h>
25#include <TMap.h>
26#include <TObjString.h>
27#include <TTimeStamp.h>
28
3dedb44a 29#include "AliGRPPreprocessor.h"
30#include "AliGRPDCS.h"
31
32#include "AliCDBMetaData.h"
33#include "AliLog.h"
34
3dedb44a 35class AliDCSValue;
36class AliShuttleInterface;
37
38#include <TH1.h>
39
40ClassImp(AliGRPPreprocessor)
41
42//_______________________________________________________________
43AliGRPPreprocessor::AliGRPPreprocessor():
44 AliPreprocessor("GRP",0) {
45 // default constructor - Don't use this!
46
47}
48
49//_______________________________________________________________
50AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
51 AliPreprocessor("GRP",shuttle) {
52 // constructor - shuttle must be instantiated!
53
54}
55
56//_______________________________________________________________
57AliGRPPreprocessor::~AliGRPPreprocessor() {
58 //destructor
59}
60
61//_______________________________________________________________
62void 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//_______________________________________________________________
74UInt_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");
125567f8 78 const char* beamEnergy = GetRunParameter("beamEnergy");
79 const char* beamType = GetRunParameter("beamType");
80 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
81 const char* detectorMask = GetRunParameter("detectorMask");
fed5d40b 82 const char* lhcPeriod = GetRunParameter("LHCperiod");
125567f8 83
e97cc90e 84 //===========//
85 //DCS data points
86 //===========//
87 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue("LHCState");
88 if(!aliasLHCState) {
89 Log(Form("LHCState not found!!!"));
8ecdaed6 90 return 0;
91 }
e97cc90e 92 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState);
93 TString sLHCState = dcs1->ProcessDCS(3);
94 if (sLHCState) {
95 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
96 } else {
97 Log(Form("LHCState not put in TMap!"));
98 }
99
100 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue("LHCPeriod");
101 if(!aliasLHCPeriod) {
102 Log(Form("LHCPeriod not found!!!"));
103 return 0;
104 }
105 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod);
106 TString sLHCPeriod = dcs2->ProcessDCS(3);
107 if (sLHCPeriod) {
108 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
3dedb44a 109 } else {
e97cc90e 110 Log(Form("LHCPeriod not put in TMap!"));
3dedb44a 111 }
125567f8 112
e97cc90e 113 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue("LHCLuminosity");
114 if(!aliasLHCLuminosity) {
115 Log(Form("LHCLuminosity not found!!!"));
116 return 0;
117 }
118 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity);
119 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
120 if (sMeanLHCLuminosity) {
121 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
122 } else {
123 Log(Form("LHCLuminosity not put in TMap!"));
124 }
125
126 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue("BeamIntensity");
127 if(!aliasBeamIntensity) {
128 Log(Form("BeamIntensity not found!!!"));
129 return 0;
130 }
131 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity);
132 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
133 if (sMeanBeamIntensity) {
134 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
135 } else {
136 Log(Form("BeamIntensity not put in TMap!"));
137 }
138
139 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue("L3Current");
140 if(!aliasL3Current) {
141 Log(Form("L3Current not found!!!"));
142 return 0;
143 }
144 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current);
145 TString sMeanL3Current = dcs5->ProcessDCS(2);
146 if (sMeanL3Current) {
147 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
148 } else {
149 Log(Form("L3Current not put in TMap!"));
150 }
151
152 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue("L3Polarity");
153 if(!aliasL3Polarity) {
154 Log(Form("L3Polarity not found!!!"));
155 return 0;
156 }
157 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity);
158 TString sL3Polarity = dcs6->ProcessDCS(4);
159 if (sL3Polarity) {
160 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
161 } else {
162 Log(Form("L3Polarity not put in TMap!"));
163 }
164
165 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue("DipoleCurrent");
166 if(!aliasDipoleCurrent) {
167 Log(Form("DipoleCurrent not found!!!"));
168 return 0;
169 }
170 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent);
171 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
172 if (sMeanDipoleCurrent) {
173 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
174 } else {
175 Log(Form("DipoleCurrent not put in TMap!"));
176 }
177
178 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue("DipolePolarity");
179 if(!aliasDipolePolarity) {
180 Log(Form("DipolePolarity not found!!!"));
181 return 0;
182 }
183 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity);
184 TString sDipolePolarity = dcs8->ProcessDCS(4);
185 if (sDipolePolarity) {
186 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
187 } else {
188 Log(Form("DipolePolarity not put in TMap!"));
189 }
190
191 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue("CavernTemperature");
192 if(!aliasCavernTemperature) {
193 Log(Form("CavernTemperature not found!!!"));
194 return 0;
195 }
196 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature);
197 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
198 if (sMeanCavernTemperature) {
199 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
200 } else {
201 Log(Form("CavernTemperature not put in TMap!"));
202 }
203
204 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue("CavernPressure");
205 if(!aliasCavernPressure) {
206 Log(Form("CavernPressure not found!!!"));
207 return 0;
208 }
209 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure);
210 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
211 if (sMeanCavernPressure) {
212 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
213 } else {
214 Log(Form("CavernPressure not put in TMap!"));
215 }
216
217 //===========//
125567f8 218 //DAQ logbook
e97cc90e 219 //===========//
3dedb44a 220 if (timeStart) {
221 Log(Form("Start time for run %d: %s",fRun, timeStart));
222 } else {
223 Log(Form("Start time not put in logbook!"));
224 }
225 if (timeEnd) {
226 Log(Form("End time for run %d: %s",fRun, timeEnd));
227 } else {
228 Log(Form("End time not put in logbook!"));
229 }
125567f8 230 if (beamEnergy) {
231 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
232 } else {
233 Log(Form("Beam energy not put in logbook!"));
234 }
235 if (beamType) {
236 Log(Form("Beam type for run %d: %s",fRun, beamType));
237 } else {
238 Log(Form("Beam type not put in logbook!"));
239 }
240 if (numberOfDetectors) {
241 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
242 } else {
243 Log(Form("Number of active detectors not put in logbook!"));
244 }
245 if (detectorMask) {
246 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
247 } else {
248 Log(Form("Detector mask not put in logbook!"));
249 }
fed5d40b 250 if (lhcPeriod) {
251 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
252 } else {
253 Log(Form("LHCperiod not put in logbook!"));
254 }
125567f8 255
3dedb44a 256 TList *values = new TList();
257 values->SetOwner(1);
258
125567f8 259 //DAQ logbook
260 TMap *mapDAQ1 = new TMap();
261 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
262 values->Add(mapDAQ1);
263
264 TMap *mapDAQ2 = new TMap();
265 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
266 values->Add(mapDAQ2);
267
268 TMap *mapDAQ3 = new TMap();
269 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
270 values->Add(mapDAQ3);
271
272 TMap *mapDAQ4 = new TMap();
273 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
274 values->Add(mapDAQ4);
275
276 TMap *mapDAQ5 = new TMap();
277 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
278 values->Add(mapDAQ5);
279
280 TMap *mapDAQ6 = new TMap();
281 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
282 values->Add(mapDAQ6);
283
fed5d40b 284 TMap *mapDAQ7 = new TMap();
285 mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString(lhcPeriod));
286 values->Add(mapDAQ7);
287
125567f8 288 //DCS dp
289 TMap *mapDCS1 = new TMap();
e97cc90e 290 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
125567f8 291 values->Add(mapDCS1);
292
293 TMap *mapDCS2 = new TMap();
fed5d40b 294 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod));
125567f8 295 values->Add(mapDCS2);
3dedb44a 296
e97cc90e 297 TMap *mapDCS3 = new TMap();
298 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
299 values->Add(mapDCS3);
300
301 TMap *mapDCS4 = new TMap();
302 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
303 values->Add(mapDCS4);
304
305 TMap *mapDCS5 = new TMap();
306 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
307 values->Add(mapDCS5);
308
309 TMap *mapDCS6 = new TMap();
310 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
311 values->Add(mapDCS6);
312
313 TMap *mapDCS7 = new TMap();
314 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
315 values->Add(mapDCS7);
316
317 TMap *mapDCS8 = new TMap();
318 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
319 values->Add(mapDCS8);
320
321 TMap *mapDCS9 = new TMap();
322 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
323 values->Add(mapDCS9);
324
325 TMap *mapDCS10 = new TMap();
326 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
327 values->Add(mapDCS10);
328
3dedb44a 329 AliCDBMetaData md;
330 md.SetResponsible("Panos");
331
e97cc90e 332 Int_t result=0;
3dedb44a 333 result = Store("GRP", "Values", values, &md);
334
335 delete values;
336
337 return result;
338}
339