1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // Class containing the GRP data that have to be stored in the OCDB.
19 // Data come either from DAQ logbook or from DCS DB.
20 // Processing of the data can also be performed here.
22 #include "AliGRPObject.h"
23 #include "AliSplineFit.h"
24 #include "AliDCSSensor.h"
28 ClassImp(AliGRPObject)
30 const Float_t AliGRPObject::fgkInvalidFloat = 0xffffffff; // value to identify invalid data - float
31 const TString AliGRPObject::fgkInvalidString = ""; // value to identify invalid data - string
32 const Char_t AliGRPObject::fgkInvalidChar = -1; // value to identify invalid data - uchar
33 const Int_t AliGRPObject::fgkInvalidInt = -1; // value to identify invalid data - uint
34 const Int_t AliGRPObject::fgkInvalidUInt = 0; // value to identify invalid data - uint
35 const Int_t AliGRPObject::fgknDCSDP_HallProbes = 40; // number of dcs dps
36 const char* AliGRPObject::fgkDCSDataPoints_HallProbes[AliGRPObject::fgknDCSDP_HallProbes] = {
40 "L3_BSF17_Temperature",
44 "L3_BSF4_Temperature",
48 "L3_BKF17_Temperature",
52 "L3_BKF4_Temperature",
56 "L3_BSF13_Temperature",
60 "L3_BSF8_Temperature",
64 "L3_BKF13_Temperature",
68 "L3_BKF8_Temperature",
72 "Dipole_Inside_Temperature",
76 "Dipole_Outside_Temperature",
79 //-----------------------------------------------------------------------------
80 AliGRPObject::AliGRPObject():
84 fTimeStart((time_t)fgkInvalidFloat),
85 fTimeEnd((time_t)fgkInvalidFloat),
86 fBeamEnergy(fgkInvalidFloat),
87 fBeamType(fgkInvalidString),
88 fNumberOfDetectors(fgkInvalidChar),
89 fDetectorMask(fgkInvalidUInt),
90 fLHCPeriod(fgkInvalidString),
91 fRunType(fgkInvalidString),
92 fLHCState(fgkInvalidString),
93 fLHCLuminosity(new Float_t[fPoints]),
94 fLHCLuminositySplineFit(0x0),
95 fBeamIntensity(new Float_t[fPoints]),
96 fBeamIntensitySplineFit(0x0),
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(new Float_t[fPoints]),
103 fCavernAtmosPressure(0x0),
104 fSurfaceAtmosPressure(0x0),
109 // AliGRPObject default ctor
112 fDimension = fgknDCSDP_HallProbes*fPoints;
113 fHallProbes = new Float_t[fDimension];
115 for (Int_t nhp=0; nhp< fDimension; nhp++){
116 fHallProbes[nhp] = fgkInvalidFloat;
119 for (Int_t i = 0; i < fPoints; i++){
121 fLHCLuminosity[i] = fgkInvalidFloat;
122 fBeamIntensity[i] = fgkInvalidFloat;
123 fL3Current[i] = fgkInvalidFloat;
124 fDipoleCurrent[i] = fgkInvalidFloat;
125 fCavernTemperature[i] = fgkInvalidFloat;
126 // fCavernAtmosPressure[i] = fgkInvalidFloat;
130 //-----------------------------------------------------------------------------
132 AliGRPObject::AliGRPObject(const AliGRPObject &obj):
134 fPoints(obj.fPoints),
135 fDimension(obj.fDimension),
136 fTimeStart(obj.fTimeStart),
137 fTimeEnd(obj.fTimeEnd),
138 fBeamEnergy(obj.fBeamEnergy),
139 fBeamType(obj.fBeamType),
140 fNumberOfDetectors(obj.fNumberOfDetectors),
141 fDetectorMask(obj.fDetectorMask),
142 fLHCPeriod(obj.fLHCPeriod),
143 fRunType(obj.fRunType),
144 fLHCState(obj.fLHCState),
145 fLHCLuminosity(new Float_t[fPoints]),
146 fLHCLuminositySplineFit(obj.fLHCLuminositySplineFit),
147 fBeamIntensity(new Float_t[fPoints]),
148 fBeamIntensitySplineFit(obj.fBeamIntensitySplineFit),
149 fL3Polarity(obj.fL3Polarity),
150 fDipolePolarity(obj.fDipolePolarity),
151 fL3Current(new Float_t[fPoints]),
152 fDipoleCurrent(new Float_t[fPoints]),
153 fCavernTemperature(new Float_t[fPoints]),
154 //fCavernAtmosPressure(new Float_t[fPoints]),
155 fCavernAtmosPressure(obj.fCavernAtmosPressure),
156 fSurfaceAtmosPressure(obj.fSurfaceAtmosPressure),
162 // AliGRPObject copy ctor
165 for (Int_t nhp=0; nhp< fDimension; nhp++){
166 fHallProbes[nhp] = obj.fHallProbes[nhp];
169 for (Int_t i = 0; i < fPoints; i++){
171 fLHCLuminosity[i] = obj.fLHCLuminosity[i];
172 fBeamIntensity[i] = obj.fBeamIntensity[i];
173 fL3Current[i] = obj.fL3Current[i];
174 fDipoleCurrent[i] = obj.fDipoleCurrent[i];
175 //fCavernTemperature[i] = obj.fCavernTemperature[i];
176 fCavernAtmosPressure[i] = obj.fCavernAtmosPressure[i];
180 //-----------------------------------------------------------------------------
182 AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj)
186 // AliGRPObject assignment operator
189 this->fTimeStart = obj.GetTimeStart();
190 this->fTimeEnd = obj.GetTimeEnd();
191 this->fBeamEnergy = obj.GetBeamEnergy();
192 this->fBeamType = obj.GetBeamType();
193 this->fNumberOfDetectors = obj.GetNumberOfDetectors();
194 this->fDetectorMask = obj.GetDetectorMask();
195 this->fLHCPeriod = obj.GetLHCPeriod();
196 this->fRunType = obj.GetRunType();
197 this->fLHCState = obj.GetLHCState();
198 this->fLHCLuminositySplineFit = obj.GetLHCLuminositySplineFit();
199 this->fBeamIntensitySplineFit = obj.GetBeamIntensitySplineFit();
200 this->fL3Polarity = obj.GetL3Polarity();
201 this->fDipolePolarity = obj.GetDipolePolarity();
202 this->fCavernAtmosPressure = obj.GetCavernAtmosPressure();
203 this->fSurfaceAtmosPressure = obj.GetSurfaceAtmosPressure();
204 this->fPoints = obj.GetPoints();
205 this->fDimension = obj.GetDimension();
207 this->fLHCLuminosity = new Float_t[fPoints];
208 this->fBeamIntensity = new Float_t[fPoints];
209 this->fL3Current = new Float_t[fPoints];
210 this->fDipoleCurrent = new Float_t[fPoints];
211 this->fCavernTemperature = new Float_t[fPoints];
212 //this->fCavernAtmosPressure = new Float_t[fPoints];
214 for (Int_t nhp=0; nhp< fDimension; nhp++){
215 this->fHallProbes[nhp] = obj.GetHallProbes(nhp);
218 for (Int_t i = 0; i < fPoints; i++){
220 // this->fBeamEnergy[i] = obj.GetBeamEnergy((Stats)i);
221 this->fLHCLuminosity[i] = obj.GetLHCLuminosity((Stats)i);
222 this->fBeamIntensity[i] = obj.GetBeamIntensity((Stats)i);
223 this->fL3Current[i] = obj.GetL3Current((Stats)i);
224 this->fDipoleCurrent[i] = obj.GetDipoleCurrent((Stats)i);
225 this->fCavernTemperature[i] = obj.GetCavernTemperature((Stats)i);
226 // this->fCavernAtmosPressure[i] = obj.GetCavernAtmosPressure((Stats)i);
232 //-----------------------------------------------------------------------------
234 AliGRPObject::~AliGRPObject() {
241 delete [] fHallProbes;
242 delete [] fLHCLuminosity;
243 delete [] fBeamIntensity;
244 delete [] fL3Current;
245 delete [] fDipoleCurrent;
246 delete [] fCavernTemperature;
248 if (fLHCLuminositySplineFit){
249 delete fLHCLuminositySplineFit;
250 fLHCLuminositySplineFit = 0x0;
252 if (fBeamIntensitySplineFit){
253 delete fBeamIntensitySplineFit;
254 fBeamIntensitySplineFit = 0x0;
256 if (fCavernAtmosPressure){
257 delete fCavernAtmosPressure;
258 fCavernAtmosPressure = 0x0;
260 if (fSurfaceAtmosPressure){
261 delete fSurfaceAtmosPressure;
262 fSurfaceAtmosPressure = 0x0;
266 //-----------------------------------------------------------------------------
268 Float_t* AliGRPObject::GetHallProbes(DP_HallProbes hp) {
271 // method to return array of statistical
272 // variables for Hall Probe hp
275 Float_t * array = new Float_t[fPoints];
276 Int_t shift = fPoints*(Int_t)hp;
277 for (Int_t i=0;i<fPoints; i++){
279 array[i] = fHallProbes[shift+i];
286 //-------------------------------------------------------------------------------
288 void AliGRPObject::SetHallProbes(DP_HallProbes hp, Float_t* hall_probe){
291 // method to set hall probe hp
292 // from a given array
295 Int_t shift = fPoints*hp;
296 for (Int_t i = 0; i< fPoints; i++){
298 fHallProbes[i+shift] = hall_probe[i];
303 //-------------------------------------------------------------------------------
305 void AliGRPObject::ReadValuesFromMap(TMap* mapGRP){
308 // method to set the values of the GRP parameters
309 // reading them from the old format of the GRP
310 // object, i.e. a TMap
313 if (mapGRP->GetValue("fAliceStartTime")){
314 SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());
317 AliError(Form("No fAliceStartTime value found in GRP map!"));
319 if (mapGRP->GetValue("fAliceStopTime")){
320 SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());
324 AliError(Form("No fAliceStopTime value found in GRP map!"));
327 if(mapGRP->GetValue("fAliceBeamEnergy")){
328 SetBeamEnergy((((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof());
331 AliError(Form("No fAliceBeamEnergy value found in GRP map!"));
333 if(mapGRP->GetValue("fAliceBeamType")){
334 SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());
337 AliError(Form("No fAliceBeamType value found in GRP map!"));
339 if(mapGRP->GetValue("fNumberOfDetectors")){
340 SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi());
343 AliError(Form("No fNumberOfDetectors value found in GRP map!"));
345 if(mapGRP->GetValue("fDetectorMask")){
346 SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi());
349 AliError(Form("No fDetectorMask value found in GRP map!"));
351 if(mapGRP->GetValue("fLHCPeriod")){
352 SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());
355 AliError(Form("No fLHCPeriod value found in GRP map!"));
357 if(mapGRP->GetValue("fRunType")){
358 SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());
361 AliError(Form("No fRunType value found in GRP map!"));
363 if(mapGRP->GetValue("fLHCState")){
364 SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());
367 AliError(Form("No fLHCState value found in GRP map!"));
369 if(mapGRP->GetValue("fLHCluminosity")){
370 AliInfo(Form("fLHCLuminosity found, but porting only average to the new object, since the other values are not available in the old object"));
371 SetLHCLuminosity((Float_t)(((TObjString*)(mapGRP->GetValue("fLHCLuminosity")))->GetString()).Atof(),(Stats)0);
374 AliError(Form("No fLHCLuminosity value found in GRP map!"));
376 if(mapGRP->GetValue("fBeamIntensity")){
377 AliInfo(Form("fBeamIntensity found, but porting only average to the new object, since the other values are not available in the old object"));
378 SetBeamIntensity((Float_t)(((TObjString*)(mapGRP->GetValue("fBeamIntensity")))->GetString()).Atof(),(Stats)0);
381 AliError(Form("No fBeamIntensity value found in GRP map!"));
383 if(mapGRP->GetValue("fL3Polarity")){
384 SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());
387 AliError(Form("No fL3Polarity value found in GRP map!"));
389 if(mapGRP->GetValue("fDipolePolarity")){
390 SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi());
393 AliError(Form("No fDipolePolarity value found in GRP map!"));
395 if(mapGRP->GetValue("fL3Current")){
396 AliInfo(Form("fL3Current found, but porting only average to the new object, since the other values are not available in the old object"));
397 SetL3Current((Float_t)(((TObjString*)(mapGRP->GetValue("fL3Current")))->GetString()).Atof(),(Stats)0);
400 AliError(Form("No fL3Current value found in GRP map!"));
402 if(mapGRP->GetValue("fDipoleCurrent")){
403 AliInfo(Form("fDipoleCurrent found, but porting only average to the new object, since the other values are not available in the old object"));
404 SetDipoleCurrent((Float_t)(((TObjString*)(mapGRP->GetValue("fDipoleCurrent")))->GetString()).Atof(),(Stats)0);
407 AliError(Form("No fDipoleCurrent value found in GRP map!"));
409 if(mapGRP->GetValue("fCavernTemperature")){
410 AliInfo(Form("fCaverntemperature found, but porting only average to the new object, since the other values are not available in the old object"));
411 SetCavernTemperature((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernTemperature")))->GetString()).Atof(),(Stats)0);
414 AliError(Form("No fCavernTemperature value found in GRP map!"));
417 if(mapGRP->GetValue("fCavernAtmosPressure")){
418 SetCavernAtmosPressure((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernAtmosPressure")))->GetString()).Atof(),(Stats)0);
421 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
424 if(mapGRP->GetValue("fCavernAtmosPressure")){
425 AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));
428 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
430 if(mapGRP->GetValue("fP2Pressure")){
431 SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));
434 AliError(Form("No fP2Pressure value found in GRP map!"));