1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\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
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
25 #include <TObject.h>
\r
26 #include <TObjString.h>
\r
28 #include "AliGRPObject.h"
\r
29 #include "AliDCSSensor.h"
\r
32 ClassImp(AliGRPObject)
\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
44 "L3_BSF17_Temperature",
\r
48 "L3_BSF4_Temperature",
\r
52 "L3_BKF17_Temperature",
\r
56 "L3_BKF4_Temperature",
\r
60 "L3_BSF13_Temperature",
\r
64 "L3_BSF8_Temperature",
\r
68 "L3_BKF13_Temperature",
\r
72 "L3_BKF8_Temperature",
\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
83 //-----------------------------------------------------------------------------
\r
84 AliGRPObject::AliGRPObject():
\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(0x0),
\r
107 fCavernAtmosPressure2(0x0),
\r
108 fSurfaceAtmosPressure(0x0),
\r
110 fMachineMode(fgkInvalidString),
\r
111 fLHCStateArray(0x0),
\r
112 fMachineModeArray(0x0)
\r
116 // AliGRPObject default ctor
\r
119 fDimension = fgknDCSDPHallProbes*fPoints;
\r
120 fHallProbes = new Float_t[fDimension];
\r
122 for (Int_t nhp=0; nhp< fDimension; nhp++){
\r
123 fHallProbes[nhp] = fgkInvalidFloat;
\r
126 for (Int_t i = 0; i < fPoints; i++){
\r
128 fLHCLuminosity[i] = fgkInvalidFloat;
\r
129 fBeamIntensity[i] = fgkInvalidFloat;
\r
130 fL3Current[i] = fgkInvalidFloat;
\r
131 fDipoleCurrent[i] = fgkInvalidFloat;
\r
132 fCavernTemperature[i] = fgkInvalidFloat;
\r
136 //-----------------------------------------------------------------------------
\r
138 AliGRPObject::AliGRPObject(const AliGRPObject &obj):
\r
140 fPoints(obj.fPoints),
\r
141 fDimension(obj.fDimension),
\r
142 fTimeStart(obj.fTimeStart),
\r
143 fTimeEnd(obj.fTimeEnd),
\r
144 fBeamEnergy(obj.fBeamEnergy),
\r
145 fBeamType(obj.fBeamType),
\r
146 fNumberOfDetectors(obj.fNumberOfDetectors),
\r
147 fDetectorMask(obj.fDetectorMask),
\r
148 fLHCPeriod(obj.fLHCPeriod),
\r
149 fRunType(obj.fRunType),
\r
150 fLHCState(obj.fLHCState),
\r
151 fLHCLuminosity(new Float_t[fPoints]),
\r
152 fLHCLuminositySplineFit(obj.fLHCLuminositySplineFit),
\r
153 fBeamIntensity(new Float_t[fPoints]),
\r
154 fBeamIntensitySplineFit(obj.fBeamIntensitySplineFit),
\r
155 fL3Polarity(obj.fL3Polarity),
\r
156 fDipolePolarity(obj.fDipolePolarity),
\r
157 fL3Current(new Float_t[fPoints]),
\r
158 fDipoleCurrent(new Float_t[fPoints]),
\r
159 fCavernTemperature(new Float_t[fPoints]),
\r
160 fCavernAtmosPressure(obj.fCavernAtmosPressure),
\r
161 fCavernAtmosPressure2(obj.fCavernAtmosPressure2),
\r
162 fSurfaceAtmosPressure(obj.fSurfaceAtmosPressure),
\r
164 fMachineMode(obj.fMachineMode),
\r
165 fLHCStateArray(obj.fLHCStateArray),
\r
166 fMachineModeArray(obj.fMachineModeArray)
\r
172 // AliGRPObject copy ctor
\r
175 fHallProbes = new Float_t[fDimension];
\r
177 for (Int_t nhp=0; nhp< fDimension; nhp++){
\r
178 fHallProbes[nhp] = obj.fHallProbes[nhp];
\r
181 for (Int_t i = 0; i < fPoints; i++){
\r
183 fLHCLuminosity[i] = obj.fLHCLuminosity[i];
\r
184 fBeamIntensity[i] = obj.fBeamIntensity[i];
\r
185 fL3Current[i] = obj.fL3Current[i];
\r
186 fDipoleCurrent[i] = obj.fDipoleCurrent[i];
\r
187 fCavernTemperature[i] = obj.fCavernTemperature[i];
\r
191 //-----------------------------------------------------------------------------
\r
193 AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj)
\r
197 // AliGRPObject assignment operator
\r
200 if (&obj == this) return *this;
\r
202 TObject::operator=(obj);
\r
203 this->fTimeStart = obj.GetTimeStart();
\r
204 this->fTimeEnd = obj.GetTimeEnd();
\r
205 this->fBeamEnergy = obj.GetBeamEnergy();
\r
206 this->fBeamType = obj.GetBeamType();
\r
207 this->fNumberOfDetectors = obj.GetNumberOfDetectors();
\r
208 this->fDetectorMask = obj.GetDetectorMask();
\r
209 this->fLHCPeriod = obj.GetLHCPeriod();
\r
210 this->fRunType = obj.GetRunType();
\r
211 this->fLHCState = obj.GetLHCState();
\r
212 this->fLHCLuminositySplineFit = obj.GetLHCLuminositySplineFit();
\r
213 this->fBeamIntensitySplineFit = obj.GetBeamIntensitySplineFit();
\r
214 this->fL3Polarity = obj.GetL3Polarity();
\r
215 this->fDipolePolarity = obj.GetDipolePolarity();
\r
216 this->fCavernAtmosPressure = obj.GetCavernAtmosPressure();
\r
217 this->fCavernAtmosPressure2 = obj.GetCavernAtmosPressure2();
\r
218 this->fSurfaceAtmosPressure = obj.GetSurfaceAtmosPressure();
\r
219 this->fPoints = obj.GetPoints();
\r
220 this->fDimension = obj.GetDimension();
\r
222 this->fLHCLuminosity = new Float_t[fPoints];
\r
223 this->fBeamIntensity = new Float_t[fPoints];
\r
224 this->fL3Current = new Float_t[fPoints];
\r
225 this->fDipoleCurrent = new Float_t[fPoints];
\r
226 this->fCavernTemperature = new Float_t[fPoints];
\r
228 if (this->fHallProbes==NULL) this->fHallProbes = new Float_t[this->fDimension];
\r
229 for (Int_t nhp=0; nhp< fDimension; nhp++){
\r
230 this->fHallProbes[nhp] = obj.GetHallProbes(nhp);
\r
233 for (Int_t i = 0; i < fPoints; i++){
\r
235 this->fLHCLuminosity[i] = obj.GetLHCLuminosity((Stats)i);
\r
236 this->fBeamIntensity[i] = obj.GetBeamIntensity((Stats)i);
\r
237 this->fL3Current[i] = obj.GetL3Current((Stats)i);
\r
238 this->fDipoleCurrent[i] = obj.GetDipoleCurrent((Stats)i);
\r
239 this->fCavernTemperature[i] = obj.GetCavernTemperature((Stats)i);
\r
242 this->fMachineMode = obj.fMachineMode;
\r
243 this->fLHCStateArray = obj.fLHCStateArray;
\r
244 this->fMachineModeArray = obj.fMachineModeArray;
\r
249 //-----------------------------------------------------------------------------
\r
251 AliGRPObject::~AliGRPObject() {
\r
258 delete [] fHallProbes;
\r
259 delete [] fLHCLuminosity;
\r
260 delete [] fBeamIntensity;
\r
261 delete [] fL3Current;
\r
262 delete [] fDipoleCurrent;
\r
263 delete [] fCavernTemperature;
\r
265 if (fLHCLuminositySplineFit){
\r
266 delete fLHCLuminositySplineFit;
\r
267 fLHCLuminositySplineFit = 0x0;
\r
269 if (fBeamIntensitySplineFit){
\r
270 delete fBeamIntensitySplineFit;
\r
271 fBeamIntensitySplineFit = 0x0;
\r
273 if (fCavernAtmosPressure){
\r
274 delete fCavernAtmosPressure;
\r
275 fCavernAtmosPressure = 0x0;
\r
277 if (fCavernAtmosPressure2){
\r
278 delete fCavernAtmosPressure2;
\r
279 fCavernAtmosPressure2 = 0x0;
\r
281 if (fSurfaceAtmosPressure){
\r
282 delete fSurfaceAtmosPressure;
\r
283 fSurfaceAtmosPressure = 0x0;
\r
285 if (fLHCStateArray){
\r
286 delete fLHCStateArray;
\r
287 fLHCStateArray = 0x0;
\r
289 if (fMachineModeArray){
\r
290 delete fMachineModeArray;
\r
291 fMachineModeArray = 0x0;
\r
295 //-----------------------------------------------------------------------------
\r
296 Float_t* AliGRPObject::GetHallProbesArray(DP_HallProbes hp) const {
\r
299 // method to return array of statistical
\r
300 // variables for Hall Probe hp
\r
303 Float_t* array = new Float_t[fPoints];
\r
304 Int_t shift = fPoints*(Int_t)hp;
\r
305 for (Int_t i=0;i<fPoints; i++){
\r
307 array[i] = fHallProbes[shift+i];
\r
313 //-------------------------------------------------------------------------------
\r
315 void AliGRPObject::SetHallProbes(DP_HallProbes hp, const Float_t* hall_probe){
\r
318 // method to set hall probe hp
\r
319 // from a given array
\r
322 Int_t shift = fPoints*hp;
\r
323 for (Int_t i = 0; i< fPoints; i++){
\r
325 fHallProbes[i+shift] = hall_probe[i];
\r
330 //-------------------------------------------------------------------------------
\r
332 void AliGRPObject::ReadValuesFromMap(const TMap* mapGRP){
\r
335 // method to set the values of the GRP parameters
\r
336 // reading them from the old format of the GRP
\r
337 // object, i.e. a TMap
\r
340 if (mapGRP->GetValue("fAliceStartTime")){
\r
341 SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());
\r
344 AliError(Form("No fAliceStartTime value found in GRP map!"));
\r
346 if (mapGRP->GetValue("fAliceStopTime")){
\r
347 SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());
\r
351 AliError(Form("No fAliceStopTime value found in GRP map!"));
\r
354 if(mapGRP->GetValue("fAliceBeamEnergy")){
\r
355 double be = (((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof();
\r
356 if (IsBeamEnergyIsSqrtSHalfGeV()) be/=2; // old format was storig sqrt(s)
\r
360 AliError(Form("No fAliceBeamEnergy value found in GRP map!"));
\r
362 if(mapGRP->GetValue("fAliceBeamType")){
\r
363 SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());
\r
366 AliError(Form("No fAliceBeamType value found in GRP map!"));
\r
368 if(mapGRP->GetValue("fNumberOfDetectors")){
\r
369 SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi());
\r
372 AliError(Form("No fNumberOfDetectors value found in GRP map!"));
\r
374 if(mapGRP->GetValue("fDetectorMask")){
\r
375 SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi());
\r
378 AliError(Form("No fDetectorMask value found in GRP map!"));
\r
380 if(mapGRP->GetValue("fLHCPeriod")){
\r
381 SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());
\r
384 AliError(Form("No fLHCPeriod value found in GRP map!"));
\r
386 if(mapGRP->GetValue("fRunType")){
\r
387 SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());
\r
390 AliError(Form("No fRunType value found in GRP map!"));
\r
392 if(mapGRP->GetValue("fLHCState")){
\r
393 SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());
\r
396 AliError(Form("No fLHCState value found in GRP map!"));
\r
398 if(mapGRP->GetValue("fLHCluminosity")){
\r
399 AliInfo(Form("fLHCLuminosity found, but porting only average to the new object, since the other values are not available in the old object"));
\r
400 SetLHCLuminosity((Float_t)(((TObjString*)(mapGRP->GetValue("fLHCLuminosity")))->GetString()).Atof(),(Stats)0);
\r
403 AliError(Form("No fLHCLuminosity value found in GRP map!"));
\r
405 if(mapGRP->GetValue("fBeamIntensity")){
\r
406 AliInfo(Form("fBeamIntensity found, but porting only average to the new object, since the other values are not available in the old object"));
\r
407 SetBeamIntensity((Float_t)(((TObjString*)(mapGRP->GetValue("fBeamIntensity")))->GetString()).Atof(),(Stats)0);
\r
410 AliError(Form("No fBeamIntensity value found in GRP map!"));
\r
412 if(mapGRP->GetValue("fL3Polarity")){
\r
413 SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());
\r
416 AliError(Form("No fL3Polarity value found in GRP map!"));
\r
418 if(mapGRP->GetValue("fDipolePolarity")){
\r
419 SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi());
\r
422 AliError(Form("No fDipolePolarity value found in GRP map!"));
\r
424 if(mapGRP->GetValue("fL3Current")){
\r
425 AliInfo(Form("fL3Current found, but porting only average to the new object, since the other values are not available in the old object"));
\r
426 SetL3Current((Float_t)(((TObjString*)(mapGRP->GetValue("fL3Current")))->GetString()).Atof(),(Stats)0);
\r
429 AliError(Form("No fL3Current value found in GRP map!"));
\r
431 if(mapGRP->GetValue("fDipoleCurrent")){
\r
432 AliInfo(Form("fDipoleCurrent found, but porting only average to the new object, since the other values are not available in the old object"));
\r
433 SetDipoleCurrent((Float_t)(((TObjString*)(mapGRP->GetValue("fDipoleCurrent")))->GetString()).Atof(),(Stats)0);
\r
436 AliError(Form("No fDipoleCurrent value found in GRP map!"));
\r
438 if(mapGRP->GetValue("fCavernTemperature")){
\r
439 AliInfo(Form("fCaverntemperature found, but porting only average to the new object, since the other values are not available in the old object"));
\r
440 SetCavernTemperature((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernTemperature")))->GetString()).Atof(),(Stats)0);
\r
443 AliError(Form("No fCavernTemperature value found in GRP map!"));
\r
445 if(mapGRP->GetValue("fCavernAtmosPressure")){
\r
446 AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));
\r
449 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
\r
451 if(mapGRP->GetValue("fP2Pressure")){
\r
452 SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));
\r
455 AliError(Form("No fP2Pressure value found in GRP map!"));
\r