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