]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliGRPPreprocessor.cxx
First Run and Last Run members added, infinite validity of calib obj implemented.
[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");
1f9bf847 77 UInt_t iStartTime = atoi(timeStart);
3dedb44a 78 const char* timeEnd = GetRunParameter("time_end");
1f9bf847 79 UInt_t iStopTime = atoi(timeEnd);
125567f8 80 const char* beamEnergy = GetRunParameter("beamEnergy");
81 const char* beamType = GetRunParameter("beamType");
82 const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
83 const char* detectorMask = GetRunParameter("detectorMask");
fed5d40b 84 const char* lhcPeriod = GetRunParameter("LHCperiod");
125567f8 85
4a33bdd9 86 TList* list = GetFileSources(kDAQ);
87 TIterator* iter = list->MakeIterator();
88 TObject* obj = 0;
958ecabf 89 while ((obj = iter->Next())) {
90 TObjString* objStr = dynamic_cast<TObjString*> (obj);
91 if (objStr) {
92 Log(Form("Found source %s", objStr->String().Data()));
93 TList* list2 = GetFileIDs(kDAQ, objStr->String());
94 list2->Print();
95 delete list2;
96 }
97 }
98 delete iter;
99 delete list;
4a33bdd9 100
e97cc90e 101 //===========//
102 //DCS data points
103 //===========//
104 TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue("LHCState");
105 if(!aliasLHCState) {
106 Log(Form("LHCState not found!!!"));
9827400b 107 return 1;
8ecdaed6 108 }
958ecabf 109 AliInfo(Form("==========LHCState==========="));
1f9bf847 110 AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,iStartTime,iStopTime);
e97cc90e 111 TString sLHCState = dcs1->ProcessDCS(3);
112 if (sLHCState) {
113 Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
114 } else {
115 Log(Form("LHCState not put in TMap!"));
116 }
117
118 TObjArray *aliasLHCPeriod = (TObjArray *)valueMap->GetValue("LHCPeriod");
119 if(!aliasLHCPeriod) {
120 Log(Form("LHCPeriod not found!!!"));
9827400b 121 return 1;
e97cc90e 122 }
958ecabf 123 AliInfo(Form("==========LHCPeriod==========="));
1f9bf847 124 AliGRPDCS *dcs2 = new AliGRPDCS(aliasLHCPeriod,iStartTime,iStopTime);
e97cc90e 125 TString sLHCPeriod = dcs2->ProcessDCS(3);
126 if (sLHCPeriod) {
127 Log(Form("<LHCPeriod> for run %d: %s",fRun, sLHCPeriod.Data()));
3dedb44a 128 } else {
e97cc90e 129 Log(Form("LHCPeriod not put in TMap!"));
3dedb44a 130 }
125567f8 131
e97cc90e 132 TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue("LHCLuminosity");
133 if(!aliasLHCLuminosity) {
134 Log(Form("LHCLuminosity not found!!!"));
9827400b 135 return 1;
e97cc90e 136 }
958ecabf 137 AliInfo(Form("==========LHCLuminosity==========="));
1f9bf847 138 AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,iStartTime,iStopTime);
e97cc90e 139 TString sMeanLHCLuminosity = dcs3->ProcessDCS(2);
140 if (sMeanLHCLuminosity) {
141 Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
142 } else {
143 Log(Form("LHCLuminosity not put in TMap!"));
144 }
145
146 TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue("BeamIntensity");
147 if(!aliasBeamIntensity) {
148 Log(Form("BeamIntensity not found!!!"));
9827400b 149 return 1;
e97cc90e 150 }
958ecabf 151 AliInfo(Form("==========BeamIntensity==========="));
1f9bf847 152 AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,iStartTime,iStopTime);
e97cc90e 153 TString sMeanBeamIntensity = dcs4->ProcessDCS(2);
154 if (sMeanBeamIntensity) {
155 Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
156 } else {
157 Log(Form("BeamIntensity not put in TMap!"));
158 }
159
160 TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue("L3Current");
161 if(!aliasL3Current) {
162 Log(Form("L3Current not found!!!"));
9827400b 163 return 1;
e97cc90e 164 }
958ecabf 165 AliInfo(Form("==========L3Current==========="));
1f9bf847 166 AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,iStartTime,iStopTime);
e97cc90e 167 TString sMeanL3Current = dcs5->ProcessDCS(2);
168 if (sMeanL3Current) {
169 Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
170 } else {
171 Log(Form("L3Current not put in TMap!"));
172 }
173
174 TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue("L3Polarity");
175 if(!aliasL3Polarity) {
176 Log(Form("L3Polarity not found!!!"));
9827400b 177 return 1;
e97cc90e 178 }
958ecabf 179 AliInfo(Form("==========L3Polarity==========="));
1f9bf847 180 AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,iStartTime,iStopTime);
e97cc90e 181 TString sL3Polarity = dcs6->ProcessDCS(4);
182 if (sL3Polarity) {
183 Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
184 } else {
185 Log(Form("L3Polarity not put in TMap!"));
186 }
187
188 TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue("DipoleCurrent");
189 if(!aliasDipoleCurrent) {
190 Log(Form("DipoleCurrent not found!!!"));
9827400b 191 return 1;
e97cc90e 192 }
958ecabf 193 AliInfo(Form("==========DipoleCurrent==========="));
1f9bf847 194 AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,iStartTime,iStopTime);
e97cc90e 195 TString sMeanDipoleCurrent = dcs7->ProcessDCS(2);
196 if (sMeanDipoleCurrent) {
197 Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
198 } else {
199 Log(Form("DipoleCurrent not put in TMap!"));
200 }
201
202 TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue("DipolePolarity");
203 if(!aliasDipolePolarity) {
204 Log(Form("DipolePolarity not found!!!"));
9827400b 205 return 1;
e97cc90e 206 }
958ecabf 207 AliInfo(Form("==========DipolePolarity==========="));
1f9bf847 208 AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,iStartTime,iStopTime);
e97cc90e 209 TString sDipolePolarity = dcs8->ProcessDCS(4);
210 if (sDipolePolarity) {
211 Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
212 } else {
213 Log(Form("DipolePolarity not put in TMap!"));
214 }
215
216 TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue("CavernTemperature");
217 if(!aliasCavernTemperature) {
218 Log(Form("CavernTemperature not found!!!"));
9827400b 219 return 1;
e97cc90e 220 }
958ecabf 221 AliInfo(Form("==========CavernTemperature==========="));
1f9bf847 222 AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,iStartTime,iStopTime);
e97cc90e 223 TString sMeanCavernTemperature = dcs9->ProcessDCS(2);
224 if (sMeanCavernTemperature) {
225 Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
226 } else {
227 Log(Form("CavernTemperature not put in TMap!"));
228 }
229
5e328d2e 230 TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue("CavernAtmosPressure");
e97cc90e 231 if(!aliasCavernPressure) {
232 Log(Form("CavernPressure not found!!!"));
9827400b 233 return 1;
e97cc90e 234 }
958ecabf 235 AliInfo(Form("==========CavernPressure==========="));
1f9bf847 236 AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,iStartTime,iStopTime);
e97cc90e 237 TString sMeanCavernPressure = dcs10->ProcessDCS(2);
238 if (sMeanCavernPressure) {
239 Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
240 } else {
241 Log(Form("CavernPressure not put in TMap!"));
242 }
243
244 //===========//
125567f8 245 //DAQ logbook
e97cc90e 246 //===========//
3dedb44a 247 if (timeStart) {
248 Log(Form("Start time for run %d: %s",fRun, timeStart));
249 } else {
250 Log(Form("Start time not put in logbook!"));
251 }
252 if (timeEnd) {
253 Log(Form("End time for run %d: %s",fRun, timeEnd));
254 } else {
255 Log(Form("End time not put in logbook!"));
256 }
125567f8 257 if (beamEnergy) {
258 Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
259 } else {
260 Log(Form("Beam energy not put in logbook!"));
261 }
262 if (beamType) {
263 Log(Form("Beam type for run %d: %s",fRun, beamType));
264 } else {
265 Log(Form("Beam type not put in logbook!"));
266 }
267 if (numberOfDetectors) {
268 Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
269 } else {
270 Log(Form("Number of active detectors not put in logbook!"));
271 }
272 if (detectorMask) {
273 Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
274 } else {
275 Log(Form("Detector mask not put in logbook!"));
276 }
fed5d40b 277 if (lhcPeriod) {
278 Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
279 } else {
280 Log(Form("LHCperiod not put in logbook!"));
281 }
125567f8 282
3dedb44a 283 TList *values = new TList();
284 values->SetOwner(1);
285
125567f8 286 //DAQ logbook
287 TMap *mapDAQ1 = new TMap();
288 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
289 values->Add(mapDAQ1);
290
291 TMap *mapDAQ2 = new TMap();
292 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
293 values->Add(mapDAQ2);
294
295 TMap *mapDAQ3 = new TMap();
296 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString(beamEnergy));
297 values->Add(mapDAQ3);
298
299 TMap *mapDAQ4 = new TMap();
300 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString(beamType));
301 values->Add(mapDAQ4);
302
303 TMap *mapDAQ5 = new TMap();
304 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(numberOfDetectors));
305 values->Add(mapDAQ5);
306
307 TMap *mapDAQ6 = new TMap();
308 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(detectorMask));
309 values->Add(mapDAQ6);
310
fed5d40b 311 TMap *mapDAQ7 = new TMap();
312 mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString(lhcPeriod));
313 values->Add(mapDAQ7);
314
125567f8 315 //DCS dp
316 TMap *mapDCS1 = new TMap();
e97cc90e 317 mapDCS1->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
125567f8 318 values->Add(mapDCS1);
319
320 TMap *mapDCS2 = new TMap();
fed5d40b 321 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString(sLHCPeriod));
125567f8 322 values->Add(mapDCS2);
3dedb44a 323
e97cc90e 324 TMap *mapDCS3 = new TMap();
325 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString(sMeanLHCLuminosity));
326 values->Add(mapDCS3);
327
328 TMap *mapDCS4 = new TMap();
329 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
330 values->Add(mapDCS4);
331
332 TMap *mapDCS5 = new TMap();
333 mapDCS5->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
334 values->Add(mapDCS5);
335
336 TMap *mapDCS6 = new TMap();
337 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
338 values->Add(mapDCS6);
339
340 TMap *mapDCS7 = new TMap();
341 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
342 values->Add(mapDCS7);
343
344 TMap *mapDCS8 = new TMap();
345 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
346 values->Add(mapDCS8);
347
348 TMap *mapDCS9 = new TMap();
349 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
350 values->Add(mapDCS9);
351
352 TMap *mapDCS10 = new TMap();
353 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
354 values->Add(mapDCS10);
355
3dedb44a 356 AliCDBMetaData md;
357 md.SetResponsible("Panos");
358
9827400b 359 Bool_t result = Store("GRP", "Values", values, &md);
3dedb44a 360
361 delete values;
362
9827400b 363 if (result)
364 return 0;
365 else
366 return 1;
3dedb44a 367}
368