]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliGRPObject.cxx
Partial fix for bug #59809: putting HLT trigger decision in the ESD, not yet in stand...
[u/mrichter/AliRoot.git] / STEER / AliGRPObject.cxx
CommitLineData
39e3007b 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16/* $Id$ */\r
17\r
18// **********************\r
19// Class containing the GRP data that have to be stored in the OCDB.\r
20// Data come either from DAQ logbook or from DCS DB.\r
21// Processing of the data can also be performed here.\r
22// **********************\r
23\r
24#include <TMap.h>\r
25#include <TObject.h>\r
26#include <TObjString.h>\r
27\r
28#include "AliGRPObject.h"\r
29#include "AliDCSSensor.h"\r
30#include "AliLog.h"\r
31\r
32ClassImp(AliGRPObject)\r
33 \r
7e5aabd4 34const Float_t AliGRPObject::fgkInvalidFloat = 1E-33; // value to identify invalid data - float\r
39e3007b 35const TString AliGRPObject::fgkInvalidString = ""; // value to identify invalid data - string\r
36const Char_t AliGRPObject::fgkInvalidChar = -1; // value to identify invalid data - uchar\r
37const Int_t AliGRPObject::fgkInvalidInt = -1; // value to identify invalid data - uint\r
38const Int_t AliGRPObject::fgkInvalidUInt = 0; // value to identify invalid data - uint\r
39const Int_t AliGRPObject::fgknDCSDPHallProbes = 40; // number of dcs dps\r
40const char* AliGRPObject::fgkDCSDataPointsHallProbes[AliGRPObject::fgknDCSDPHallProbes] = {\r
41 "L3_BSF17_H1",\r
42 "L3_BSF17_H2",\r
43 "L3_BSF17_H3",\r
44 "L3_BSF17_Temperature",\r
45 "L3_BSF4_H1",\r
46 "L3_BSF4_H2",\r
47 "L3_BSF4_H3",\r
48 "L3_BSF4_Temperature",\r
49 "L3_BKF17_H1",\r
50 "L3_BKF17_H2",\r
51 "L3_BKF17_H3",\r
52 "L3_BKF17_Temperature",\r
53 "L3_BKF4_H1",\r
54 "L3_BKF4_H2",\r
55 "L3_BKF4_H3",\r
56 "L3_BKF4_Temperature",\r
57 "L3_BSF13_H1",\r
58 "L3_BSF13_H2",\r
59 "L3_BSF13_H3",\r
60 "L3_BSF13_Temperature",\r
61 "L3_BSF8_H1",\r
62 "L3_BSF8_H2",\r
63 "L3_BSF8_H3",\r
64 "L3_BSF8_Temperature",\r
65 "L3_BKF13_H1",\r
66 "L3_BKF13_H2",\r
67 "L3_BKF13_H3",\r
68 "L3_BKF13_Temperature",\r
69 "L3_BKF8_H1",\r
70 "L3_BKF8_H2",\r
71 "L3_BKF8_H3",\r
72 "L3_BKF8_Temperature",\r
73 "Dipole_Inside_H1",\r
74 "Dipole_Inside_H2",\r
75 "Dipole_Inside_H3",\r
76 "Dipole_Inside_Temperature",\r
77 "Dipole_Outside_H1",\r
78 "Dipole_Outside_H2",\r
79 "Dipole_Outside_H3",\r
80 "Dipole_Outside_Temperature",\r
81 };\r
82\r
83//-----------------------------------------------------------------------------\r
84AliGRPObject::AliGRPObject():\r
85 TObject(),\r
86 fPoints(5),\r
87 fDimension(0),\r
88 fTimeStart((time_t)fgkInvalidFloat),\r
89 fTimeEnd((time_t)fgkInvalidFloat),\r
90 fBeamEnergy(fgkInvalidFloat),\r
91 fBeamType(fgkInvalidString),\r
92 fNumberOfDetectors(fgkInvalidChar),\r
93 fDetectorMask(fgkInvalidUInt),\r
94 fLHCPeriod(fgkInvalidString),\r
95 fRunType(fgkInvalidString),\r
96 fLHCState(fgkInvalidString),\r
97 fLHCLuminosity(new Float_t[fPoints]),\r
98 fLHCLuminositySplineFit(0x0),\r
99 fBeamIntensity(new Float_t[fPoints]),\r
100 fBeamIntensitySplineFit(0x0),\r
101 fL3Polarity(fgkInvalidChar),\r
102 fDipolePolarity(fgkInvalidChar),\r
103 fL3Current(new Float_t[fPoints]),\r
104 fDipoleCurrent(new Float_t[fPoints]),\r
105 fCavernTemperature(new Float_t[fPoints]),\r
39e3007b 106 fCavernAtmosPressure(0x0),\r
ce996d13 107 fCavernAtmosPressure2(0x0),\r
39e3007b 108 fSurfaceAtmosPressure(0x0),\r
109 fHallProbes(0x0)\r
110{\r
111\r
112 //\r
113 // AliGRPObject default ctor\r
114 //\r
115\r
116 fDimension = fgknDCSDPHallProbes*fPoints;\r
117 fHallProbes = new Float_t[fDimension];\r
118\r
119 for (Int_t nhp=0; nhp< fDimension; nhp++){\r
120 fHallProbes[nhp] = fgkInvalidFloat;\r
121 }\r
122\r
123 for (Int_t i = 0; i < fPoints; i++){\r
124\r
125 fLHCLuminosity[i] = fgkInvalidFloat;\r
126 fBeamIntensity[i] = fgkInvalidFloat;\r
127 fL3Current[i] = fgkInvalidFloat;\r
128 fDipoleCurrent[i] = fgkInvalidFloat;\r
129 fCavernTemperature[i] = fgkInvalidFloat;\r
39e3007b 130 }\r
131}\r
132\r
133//-----------------------------------------------------------------------------\r
134\r
135AliGRPObject::AliGRPObject(const AliGRPObject &obj):\r
7f53217d 136 TObject(obj),\r
39e3007b 137 fPoints(obj.fPoints),\r
138 fDimension(obj.fDimension),\r
139 fTimeStart(obj.fTimeStart),\r
140 fTimeEnd(obj.fTimeEnd),\r
141 fBeamEnergy(obj.fBeamEnergy),\r
142 fBeamType(obj.fBeamType),\r
143 fNumberOfDetectors(obj.fNumberOfDetectors),\r
144 fDetectorMask(obj.fDetectorMask),\r
145 fLHCPeriod(obj.fLHCPeriod),\r
146 fRunType(obj.fRunType),\r
147 fLHCState(obj.fLHCState),\r
148 fLHCLuminosity(new Float_t[fPoints]),\r
149 fLHCLuminositySplineFit(obj.fLHCLuminositySplineFit),\r
150 fBeamIntensity(new Float_t[fPoints]),\r
151 fBeamIntensitySplineFit(obj.fBeamIntensitySplineFit),\r
152 fL3Polarity(obj.fL3Polarity),\r
153 fDipolePolarity(obj.fDipolePolarity),\r
154 fL3Current(new Float_t[fPoints]),\r
155 fDipoleCurrent(new Float_t[fPoints]),\r
156 fCavernTemperature(new Float_t[fPoints]),\r
39e3007b 157 fCavernAtmosPressure(obj.fCavernAtmosPressure),\r
ce996d13 158 fCavernAtmosPressure2(obj.fCavernAtmosPressure2),\r
39e3007b 159 fSurfaceAtmosPressure(obj.fSurfaceAtmosPressure),\r
160 fHallProbes(0x0)\r
161\r
162{\r
163\r
164 //\r
165 // AliGRPObject copy ctor\r
166 //\r
167\r
7f53217d 168 fHallProbes = new Float_t[fDimension]; \r
169\r
39e3007b 170 for (Int_t nhp=0; nhp< fDimension; nhp++){\r
171 fHallProbes[nhp] = obj.fHallProbes[nhp];\r
172 }\r
173\r
174 for (Int_t i = 0; i < fPoints; i++){\r
175\r
176 fLHCLuminosity[i] = obj.fLHCLuminosity[i];\r
177 fBeamIntensity[i] = obj.fBeamIntensity[i];\r
178 fL3Current[i] = obj.fL3Current[i];\r
179 fDipoleCurrent[i] = obj.fDipoleCurrent[i];\r
95eb6639 180 fCavernTemperature[i] = obj.fCavernTemperature[i];\r
39e3007b 181 }\r
182}\r
183\r
184//-----------------------------------------------------------------------------\r
185\r
186AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj) \r
187{\r
188\r
189 //\r
190 // AliGRPObject assignment operator\r
191 //\r
192\r
7f53217d 193 if (&obj == this) return *this; \r
194\r
195 TObject::operator=(obj);\r
39e3007b 196 this->fTimeStart = obj.GetTimeStart();\r
197 this->fTimeEnd = obj.GetTimeEnd();\r
198 this->fBeamEnergy = obj.GetBeamEnergy();\r
199 this->fBeamType = obj.GetBeamType();\r
200 this->fNumberOfDetectors = obj.GetNumberOfDetectors();\r
201 this->fDetectorMask = obj.GetDetectorMask();\r
202 this->fLHCPeriod = obj.GetLHCPeriod();\r
203 this->fRunType = obj.GetRunType();\r
204 this->fLHCState = obj.GetLHCState();\r
205 this->fLHCLuminositySplineFit = obj.GetLHCLuminositySplineFit();\r
206 this->fBeamIntensitySplineFit = obj.GetBeamIntensitySplineFit();\r
207 this->fL3Polarity = obj.GetL3Polarity();\r
208 this->fDipolePolarity = obj.GetDipolePolarity();\r
209 this->fCavernAtmosPressure = obj.GetCavernAtmosPressure();\r
ce996d13 210 this->fCavernAtmosPressure2 = obj.GetCavernAtmosPressure2();\r
39e3007b 211 this->fSurfaceAtmosPressure = obj.GetSurfaceAtmosPressure();\r
212 this->fPoints = obj.GetPoints();\r
213 this->fDimension = obj.GetDimension();\r
214\r
215 this->fLHCLuminosity = new Float_t[fPoints];\r
216 this->fBeamIntensity = new Float_t[fPoints];\r
217 this->fL3Current = new Float_t[fPoints];\r
218 this->fDipoleCurrent = new Float_t[fPoints];\r
219 this->fCavernTemperature = new Float_t[fPoints];\r
39e3007b 220 \r
7f53217d 221 if (this->fHallProbes==NULL) this->fHallProbes = new Float_t[this->fDimension]; \r
39e3007b 222 for (Int_t nhp=0; nhp< fDimension; nhp++){\r
223 this->fHallProbes[nhp] = obj.GetHallProbes(nhp);\r
224\r
225 }\r
226 for (Int_t i = 0; i < fPoints; i++){\r
227\r
39e3007b 228 this->fLHCLuminosity[i] = obj.GetLHCLuminosity((Stats)i);\r
229 this->fBeamIntensity[i] = obj.GetBeamIntensity((Stats)i);\r
230 this->fL3Current[i] = obj.GetL3Current((Stats)i);\r
231 this->fDipoleCurrent[i] = obj.GetDipoleCurrent((Stats)i);\r
232 this->fCavernTemperature[i] = obj.GetCavernTemperature((Stats)i);\r
39e3007b 233 }\r
234\r
235 return *this;\r
236}\r
237\r
238//-----------------------------------------------------------------------------\r
239\r
240AliGRPObject::~AliGRPObject() {\r
241\r
242 //\r
243 // dtor\r
244 //\r
245\r
246 \r
247 delete [] fHallProbes;\r
248 delete [] fLHCLuminosity;\r
249 delete [] fBeamIntensity;\r
250 delete [] fL3Current;\r
251 delete [] fDipoleCurrent;\r
252 delete [] fCavernTemperature;\r
253\r
254 if (fLHCLuminositySplineFit){\r
255 delete fLHCLuminositySplineFit;\r
256 fLHCLuminositySplineFit = 0x0;\r
257 }\r
258 if (fBeamIntensitySplineFit){\r
259 delete fBeamIntensitySplineFit;\r
260 fBeamIntensitySplineFit = 0x0;\r
261 }\r
262 if (fCavernAtmosPressure){\r
263 delete fCavernAtmosPressure;\r
264 fCavernAtmosPressure = 0x0;\r
265 }\r
ce996d13 266 if (fCavernAtmosPressure2){\r
267 delete fCavernAtmosPressure2;\r
268 fCavernAtmosPressure2 = 0x0;\r
269 }\r
39e3007b 270 if (fSurfaceAtmosPressure){\r
271 delete fSurfaceAtmosPressure;\r
272 fSurfaceAtmosPressure = 0x0;\r
273 }\r
274}\r
275\r
276//-----------------------------------------------------------------------------\r
a861a1ce 277Float_t* AliGRPObject::GetHallProbesArray(DP_HallProbes hp) const {\r
39e3007b 278\r
279 //\r
280 // method to return array of statistical\r
281 // variables for Hall Probe hp\r
282 //\r
283\r
a861a1ce 284 Float_t* array = new Float_t[fPoints];\r
39e3007b 285 Int_t shift = fPoints*(Int_t)hp; \r
286 for (Int_t i=0;i<fPoints; i++){\r
287\r
288 array[i] = fHallProbes[shift+i];\r
289\r
290 }\r
291\r
292 return array;\r
293}\r
39e3007b 294//-------------------------------------------------------------------------------\r
295\r
296void AliGRPObject::SetHallProbes(DP_HallProbes hp, const Float_t* hall_probe){\r
297\r
298 //\r
299 // method to set hall probe hp \r
300 // from a given array\r
301 //\r
302\r
303 Int_t shift = fPoints*hp;\r
304 for (Int_t i = 0; i< fPoints; i++){\r
305\r
306 fHallProbes[i+shift] = hall_probe[i];\r
307 }\r
308 return;\r
309}\r
310\r
311//-------------------------------------------------------------------------------\r
312\r
313void AliGRPObject::ReadValuesFromMap(const TMap* mapGRP){\r
314\r
315 //\r
316 // method to set the values of the GRP parameters \r
317 // reading them from the old format of the GRP \r
318 // object, i.e. a TMap\r
319 //\r
320\r
321 if (mapGRP->GetValue("fAliceStartTime")){\r
322 SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());\r
323 }\r
324 else {\r
325 AliError(Form("No fAliceStartTime value found in GRP map!"));\r
326 }\r
327 if (mapGRP->GetValue("fAliceStopTime")){\r
328 SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());\r
329 }\r
330 \r
331 else { \r
332 AliError(Form("No fAliceStopTime value found in GRP map!"));\r
333 }\r
334\r
335 if(mapGRP->GetValue("fAliceBeamEnergy")){\r
336 SetBeamEnergy((((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof());\r
337 }\r
338 else { \r
339 AliError(Form("No fAliceBeamEnergy value found in GRP map!"));\r
340 }\r
341 if(mapGRP->GetValue("fAliceBeamType")){\r
342 SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());\r
343 }\r
344 else { \r
345 AliError(Form("No fAliceBeamType value found in GRP map!"));\r
346 }\r
347 if(mapGRP->GetValue("fNumberOfDetectors")){\r
348 SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi()); \r
349 }\r
350 else { \r
351 AliError(Form("No fNumberOfDetectors value found in GRP map!"));\r
352 }\r
353 if(mapGRP->GetValue("fDetectorMask")){\r
354 SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi()); \r
355 }\r
356 else { \r
357 AliError(Form("No fDetectorMask value found in GRP map!"));\r
358 }\r
359 if(mapGRP->GetValue("fLHCPeriod")){\r
360 SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());\r
361 }\r
362 else { \r
363 AliError(Form("No fLHCPeriod value found in GRP map!"));\r
364 }\r
365 if(mapGRP->GetValue("fRunType")){\r
366 SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());\r
367 }\r
368 else { \r
369 AliError(Form("No fRunType value found in GRP map!"));\r
370 }\r
371 if(mapGRP->GetValue("fLHCState")){\r
372 SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());\r
373 }\r
374 else { \r
375 AliError(Form("No fLHCState value found in GRP map!"));\r
376 }\r
377 if(mapGRP->GetValue("fLHCluminosity")){\r
378 AliInfo(Form("fLHCLuminosity found, but porting only average to the new object, since the other values are not available in the old object"));\r
379 SetLHCLuminosity((Float_t)(((TObjString*)(mapGRP->GetValue("fLHCLuminosity")))->GetString()).Atof(),(Stats)0);\r
380 } \r
381 else { \r
382 AliError(Form("No fLHCLuminosity value found in GRP map!"));\r
383 }\r
384 if(mapGRP->GetValue("fBeamIntensity")){\r
385 AliInfo(Form("fBeamIntensity found, but porting only average to the new object, since the other values are not available in the old object"));\r
386 SetBeamIntensity((Float_t)(((TObjString*)(mapGRP->GetValue("fBeamIntensity")))->GetString()).Atof(),(Stats)0);\r
387 } \r
388 else { \r
389 AliError(Form("No fBeamIntensity value found in GRP map!"));\r
390 }\r
391 if(mapGRP->GetValue("fL3Polarity")){\r
392 SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());\r
393 } \r
394 else { \r
395 AliError(Form("No fL3Polarity value found in GRP map!"));\r
396 }\r
397 if(mapGRP->GetValue("fDipolePolarity")){\r
398 SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi()); \r
399 } \r
400 else { \r
401 AliError(Form("No fDipolePolarity value found in GRP map!"));\r
402 }\r
403 if(mapGRP->GetValue("fL3Current")){\r
404 AliInfo(Form("fL3Current found, but porting only average to the new object, since the other values are not available in the old object"));\r
405 SetL3Current((Float_t)(((TObjString*)(mapGRP->GetValue("fL3Current")))->GetString()).Atof(),(Stats)0);\r
406 } \r
407 else { \r
408 AliError(Form("No fL3Current value found in GRP map!"));\r
409 }\r
410 if(mapGRP->GetValue("fDipoleCurrent")){\r
411 AliInfo(Form("fDipoleCurrent found, but porting only average to the new object, since the other values are not available in the old object"));\r
412 SetDipoleCurrent((Float_t)(((TObjString*)(mapGRP->GetValue("fDipoleCurrent")))->GetString()).Atof(),(Stats)0);\r
413 } \r
414 else { \r
415 AliError(Form("No fDipoleCurrent value found in GRP map!"));\r
416 }\r
417 if(mapGRP->GetValue("fCavernTemperature")){\r
418 AliInfo(Form("fCaverntemperature found, but porting only average to the new object, since the other values are not available in the old object"));\r
419 SetCavernTemperature((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernTemperature")))->GetString()).Atof(),(Stats)0);\r
420 } \r
421 else { \r
422 AliError(Form("No fCavernTemperature value found in GRP map!"));\r
423 }\r
39e3007b 424 if(mapGRP->GetValue("fCavernAtmosPressure")){\r
425 AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));\r
426 } \r
427 else { \r
428 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));\r
429 }\r
430 if(mapGRP->GetValue("fP2Pressure")){\r
431 SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));\r
432 }\r
433 else { \r
434 AliError(Form("No fP2Pressure value found in GRP map!"));\r
435 }\r
436 \r
437 return;\r
438\r
439}\r