]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliGRPObject.cxx
Removing the coding violation
[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
0254e751 109 fHallProbes(0x0),\r
110 fMachineMode(fgkInvalidString),\r
111 fLHCStateArray(0x0),\r
6b01e5fd 112 fMachineModeArray(0x0),\r
113 fMaxTimeLHCValidity(0)\r
39e3007b 114{\r
115\r
116 //\r
117 // AliGRPObject default ctor\r
118 //\r
119\r
120 fDimension = fgknDCSDPHallProbes*fPoints;\r
121 fHallProbes = new Float_t[fDimension];\r
122\r
123 for (Int_t nhp=0; nhp< fDimension; nhp++){\r
124 fHallProbes[nhp] = fgkInvalidFloat;\r
125 }\r
126\r
127 for (Int_t i = 0; i < fPoints; i++){\r
128\r
129 fLHCLuminosity[i] = fgkInvalidFloat;\r
130 fBeamIntensity[i] = fgkInvalidFloat;\r
131 fL3Current[i] = fgkInvalidFloat;\r
132 fDipoleCurrent[i] = fgkInvalidFloat;\r
133 fCavernTemperature[i] = fgkInvalidFloat;\r
39e3007b 134 }\r
135}\r
136\r
137//-----------------------------------------------------------------------------\r
138\r
139AliGRPObject::AliGRPObject(const AliGRPObject &obj):\r
7f53217d 140 TObject(obj),\r
39e3007b 141 fPoints(obj.fPoints),\r
142 fDimension(obj.fDimension),\r
143 fTimeStart(obj.fTimeStart),\r
144 fTimeEnd(obj.fTimeEnd),\r
145 fBeamEnergy(obj.fBeamEnergy),\r
146 fBeamType(obj.fBeamType),\r
147 fNumberOfDetectors(obj.fNumberOfDetectors),\r
148 fDetectorMask(obj.fDetectorMask),\r
149 fLHCPeriod(obj.fLHCPeriod),\r
150 fRunType(obj.fRunType),\r
151 fLHCState(obj.fLHCState),\r
152 fLHCLuminosity(new Float_t[fPoints]),\r
153 fLHCLuminositySplineFit(obj.fLHCLuminositySplineFit),\r
154 fBeamIntensity(new Float_t[fPoints]),\r
155 fBeamIntensitySplineFit(obj.fBeamIntensitySplineFit),\r
156 fL3Polarity(obj.fL3Polarity),\r
157 fDipolePolarity(obj.fDipolePolarity),\r
158 fL3Current(new Float_t[fPoints]),\r
159 fDipoleCurrent(new Float_t[fPoints]),\r
160 fCavernTemperature(new Float_t[fPoints]),\r
39e3007b 161 fCavernAtmosPressure(obj.fCavernAtmosPressure),\r
ce996d13 162 fCavernAtmosPressure2(obj.fCavernAtmosPressure2),\r
39e3007b 163 fSurfaceAtmosPressure(obj.fSurfaceAtmosPressure),\r
0254e751 164 fHallProbes(0x0),\r
165 fMachineMode(obj.fMachineMode),\r
166 fLHCStateArray(obj.fLHCStateArray),\r
6b01e5fd 167 fMachineModeArray(obj.fMachineModeArray),\r
168 fMaxTimeLHCValidity(obj.fMaxTimeLHCValidity)\r
39e3007b 169\r
170{\r
171\r
172 //\r
173 // AliGRPObject copy ctor\r
174 //\r
175\r
7f53217d 176 fHallProbes = new Float_t[fDimension]; \r
177\r
39e3007b 178 for (Int_t nhp=0; nhp< fDimension; nhp++){\r
179 fHallProbes[nhp] = obj.fHallProbes[nhp];\r
180 }\r
181\r
182 for (Int_t i = 0; i < fPoints; i++){\r
183\r
184 fLHCLuminosity[i] = obj.fLHCLuminosity[i];\r
185 fBeamIntensity[i] = obj.fBeamIntensity[i];\r
186 fL3Current[i] = obj.fL3Current[i];\r
187 fDipoleCurrent[i] = obj.fDipoleCurrent[i];\r
95eb6639 188 fCavernTemperature[i] = obj.fCavernTemperature[i];\r
39e3007b 189 }\r
190}\r
191\r
192//-----------------------------------------------------------------------------\r
193\r
194AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj) \r
195{\r
196\r
197 //\r
198 // AliGRPObject assignment operator\r
199 //\r
200\r
7f53217d 201 if (&obj == this) return *this; \r
202\r
203 TObject::operator=(obj);\r
39e3007b 204 this->fTimeStart = obj.GetTimeStart();\r
205 this->fTimeEnd = obj.GetTimeEnd();\r
206 this->fBeamEnergy = obj.GetBeamEnergy();\r
207 this->fBeamType = obj.GetBeamType();\r
208 this->fNumberOfDetectors = obj.GetNumberOfDetectors();\r
209 this->fDetectorMask = obj.GetDetectorMask();\r
210 this->fLHCPeriod = obj.GetLHCPeriod();\r
211 this->fRunType = obj.GetRunType();\r
212 this->fLHCState = obj.GetLHCState();\r
213 this->fLHCLuminositySplineFit = obj.GetLHCLuminositySplineFit();\r
214 this->fBeamIntensitySplineFit = obj.GetBeamIntensitySplineFit();\r
215 this->fL3Polarity = obj.GetL3Polarity();\r
216 this->fDipolePolarity = obj.GetDipolePolarity();\r
217 this->fCavernAtmosPressure = obj.GetCavernAtmosPressure();\r
ce996d13 218 this->fCavernAtmosPressure2 = obj.GetCavernAtmosPressure2();\r
39e3007b 219 this->fSurfaceAtmosPressure = obj.GetSurfaceAtmosPressure();\r
220 this->fPoints = obj.GetPoints();\r
221 this->fDimension = obj.GetDimension();\r
222\r
223 this->fLHCLuminosity = new Float_t[fPoints];\r
224 this->fBeamIntensity = new Float_t[fPoints];\r
225 this->fL3Current = new Float_t[fPoints];\r
226 this->fDipoleCurrent = new Float_t[fPoints];\r
227 this->fCavernTemperature = new Float_t[fPoints];\r
39e3007b 228 \r
7f53217d 229 if (this->fHallProbes==NULL) this->fHallProbes = new Float_t[this->fDimension]; \r
39e3007b 230 for (Int_t nhp=0; nhp< fDimension; nhp++){\r
231 this->fHallProbes[nhp] = obj.GetHallProbes(nhp);\r
232\r
233 }\r
234 for (Int_t i = 0; i < fPoints; i++){\r
235\r
39e3007b 236 this->fLHCLuminosity[i] = obj.GetLHCLuminosity((Stats)i);\r
237 this->fBeamIntensity[i] = obj.GetBeamIntensity((Stats)i);\r
238 this->fL3Current[i] = obj.GetL3Current((Stats)i);\r
239 this->fDipoleCurrent[i] = obj.GetDipoleCurrent((Stats)i);\r
240 this->fCavernTemperature[i] = obj.GetCavernTemperature((Stats)i);\r
39e3007b 241 }\r
242\r
0254e751 243 this->fMachineMode = obj.fMachineMode;\r
244 this->fLHCStateArray = obj.fLHCStateArray;\r
245 this->fMachineModeArray = obj.fMachineModeArray;\r
6b01e5fd 246 this->fMaxTimeLHCValidity = obj.fMaxTimeLHCValidity;\r
39e3007b 247 return *this;\r
248}\r
249\r
250//-----------------------------------------------------------------------------\r
251\r
252AliGRPObject::~AliGRPObject() {\r
253\r
254 //\r
255 // dtor\r
256 //\r
257\r
258 \r
259 delete [] fHallProbes;\r
260 delete [] fLHCLuminosity;\r
261 delete [] fBeamIntensity;\r
262 delete [] fL3Current;\r
263 delete [] fDipoleCurrent;\r
264 delete [] fCavernTemperature;\r
265\r
266 if (fLHCLuminositySplineFit){\r
267 delete fLHCLuminositySplineFit;\r
268 fLHCLuminositySplineFit = 0x0;\r
269 }\r
270 if (fBeamIntensitySplineFit){\r
271 delete fBeamIntensitySplineFit;\r
272 fBeamIntensitySplineFit = 0x0;\r
273 }\r
274 if (fCavernAtmosPressure){\r
275 delete fCavernAtmosPressure;\r
276 fCavernAtmosPressure = 0x0;\r
277 }\r
ce996d13 278 if (fCavernAtmosPressure2){\r
279 delete fCavernAtmosPressure2;\r
280 fCavernAtmosPressure2 = 0x0;\r
281 }\r
39e3007b 282 if (fSurfaceAtmosPressure){\r
283 delete fSurfaceAtmosPressure;\r
284 fSurfaceAtmosPressure = 0x0;\r
285 }\r
0254e751 286 if (fLHCStateArray){\r
287 delete fLHCStateArray;\r
288 fLHCStateArray = 0x0;\r
289 }\r
290 if (fMachineModeArray){\r
291 delete fMachineModeArray;\r
292 fMachineModeArray = 0x0;\r
293 }\r
39e3007b 294}\r
295\r
296//-----------------------------------------------------------------------------\r
a861a1ce 297Float_t* AliGRPObject::GetHallProbesArray(DP_HallProbes hp) const {\r
39e3007b 298\r
299 //\r
300 // method to return array of statistical\r
301 // variables for Hall Probe hp\r
302 //\r
303\r
a861a1ce 304 Float_t* array = new Float_t[fPoints];\r
39e3007b 305 Int_t shift = fPoints*(Int_t)hp; \r
306 for (Int_t i=0;i<fPoints; i++){\r
307\r
308 array[i] = fHallProbes[shift+i];\r
309\r
310 }\r
311\r
312 return array;\r
313}\r
39e3007b 314//-------------------------------------------------------------------------------\r
315\r
316void AliGRPObject::SetHallProbes(DP_HallProbes hp, const Float_t* hall_probe){\r
317\r
318 //\r
319 // method to set hall probe hp \r
320 // from a given array\r
321 //\r
322\r
323 Int_t shift = fPoints*hp;\r
324 for (Int_t i = 0; i< fPoints; i++){\r
325\r
326 fHallProbes[i+shift] = hall_probe[i];\r
327 }\r
328 return;\r
329}\r
330\r
331//-------------------------------------------------------------------------------\r
332\r
333void AliGRPObject::ReadValuesFromMap(const TMap* mapGRP){\r
334\r
335 //\r
336 // method to set the values of the GRP parameters \r
337 // reading them from the old format of the GRP \r
338 // object, i.e. a TMap\r
339 //\r
340\r
341 if (mapGRP->GetValue("fAliceStartTime")){\r
342 SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());\r
343 }\r
344 else {\r
345 AliError(Form("No fAliceStartTime value found in GRP map!"));\r
346 }\r
347 if (mapGRP->GetValue("fAliceStopTime")){\r
348 SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());\r
349 }\r
350 \r
351 else { \r
352 AliError(Form("No fAliceStopTime value found in GRP map!"));\r
353 }\r
354\r
355 if(mapGRP->GetValue("fAliceBeamEnergy")){\r
5cf76849 356 double be = (((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof();\r
357 if (IsBeamEnergyIsSqrtSHalfGeV()) be/=2; // old format was storig sqrt(s)\r
358 SetBeamEnergy(be);\r
39e3007b 359 }\r
360 else { \r
361 AliError(Form("No fAliceBeamEnergy value found in GRP map!"));\r
362 }\r
363 if(mapGRP->GetValue("fAliceBeamType")){\r
364 SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());\r
365 }\r
366 else { \r
367 AliError(Form("No fAliceBeamType value found in GRP map!"));\r
368 }\r
369 if(mapGRP->GetValue("fNumberOfDetectors")){\r
370 SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi()); \r
371 }\r
372 else { \r
373 AliError(Form("No fNumberOfDetectors value found in GRP map!"));\r
374 }\r
375 if(mapGRP->GetValue("fDetectorMask")){\r
376 SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi()); \r
377 }\r
378 else { \r
379 AliError(Form("No fDetectorMask value found in GRP map!"));\r
380 }\r
381 if(mapGRP->GetValue("fLHCPeriod")){\r
382 SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());\r
383 }\r
384 else { \r
385 AliError(Form("No fLHCPeriod value found in GRP map!"));\r
386 }\r
387 if(mapGRP->GetValue("fRunType")){\r
388 SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());\r
389 }\r
390 else { \r
391 AliError(Form("No fRunType value found in GRP map!"));\r
392 }\r
393 if(mapGRP->GetValue("fLHCState")){\r
394 SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());\r
395 }\r
396 else { \r
397 AliError(Form("No fLHCState value found in GRP map!"));\r
398 }\r
399 if(mapGRP->GetValue("fLHCluminosity")){\r
400 AliInfo(Form("fLHCLuminosity found, but porting only average to the new object, since the other values are not available in the old object"));\r
401 SetLHCLuminosity((Float_t)(((TObjString*)(mapGRP->GetValue("fLHCLuminosity")))->GetString()).Atof(),(Stats)0);\r
402 } \r
403 else { \r
404 AliError(Form("No fLHCLuminosity value found in GRP map!"));\r
405 }\r
406 if(mapGRP->GetValue("fBeamIntensity")){\r
407 AliInfo(Form("fBeamIntensity found, but porting only average to the new object, since the other values are not available in the old object"));\r
408 SetBeamIntensity((Float_t)(((TObjString*)(mapGRP->GetValue("fBeamIntensity")))->GetString()).Atof(),(Stats)0);\r
409 } \r
410 else { \r
411 AliError(Form("No fBeamIntensity value found in GRP map!"));\r
412 }\r
413 if(mapGRP->GetValue("fL3Polarity")){\r
414 SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());\r
415 } \r
416 else { \r
417 AliError(Form("No fL3Polarity value found in GRP map!"));\r
418 }\r
419 if(mapGRP->GetValue("fDipolePolarity")){\r
420 SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi()); \r
421 } \r
422 else { \r
423 AliError(Form("No fDipolePolarity value found in GRP map!"));\r
424 }\r
425 if(mapGRP->GetValue("fL3Current")){\r
426 AliInfo(Form("fL3Current found, but porting only average to the new object, since the other values are not available in the old object"));\r
427 SetL3Current((Float_t)(((TObjString*)(mapGRP->GetValue("fL3Current")))->GetString()).Atof(),(Stats)0);\r
428 } \r
429 else { \r
430 AliError(Form("No fL3Current value found in GRP map!"));\r
431 }\r
432 if(mapGRP->GetValue("fDipoleCurrent")){\r
433 AliInfo(Form("fDipoleCurrent found, but porting only average to the new object, since the other values are not available in the old object"));\r
434 SetDipoleCurrent((Float_t)(((TObjString*)(mapGRP->GetValue("fDipoleCurrent")))->GetString()).Atof(),(Stats)0);\r
435 } \r
436 else { \r
437 AliError(Form("No fDipoleCurrent value found in GRP map!"));\r
438 }\r
439 if(mapGRP->GetValue("fCavernTemperature")){\r
440 AliInfo(Form("fCaverntemperature found, but porting only average to the new object, since the other values are not available in the old object"));\r
441 SetCavernTemperature((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernTemperature")))->GetString()).Atof(),(Stats)0);\r
442 } \r
443 else { \r
444 AliError(Form("No fCavernTemperature value found in GRP map!"));\r
445 }\r
39e3007b 446 if(mapGRP->GetValue("fCavernAtmosPressure")){\r
447 AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));\r
448 } \r
449 else { \r
450 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));\r
451 }\r
452 if(mapGRP->GetValue("fP2Pressure")){\r
453 SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));\r
454 }\r
455 else { \r
456 AliError(Form("No fP2Pressure value found in GRP map!"));\r
457 }\r
458 \r
459 return;\r
460\r
461}\r