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