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 // **********************
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 // **********************
26 #include <TObjString.h>
28 #include "AliGRPObject.h"
29 #include "AliDCSSensor.h"
32 ClassImp(AliGRPObject)
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] = {
44 "L3_BSF17_Temperature",
48 "L3_BSF4_Temperature",
52 "L3_BKF17_Temperature",
56 "L3_BKF4_Temperature",
60 "L3_BSF13_Temperature",
64 "L3_BSF8_Temperature",
68 "L3_BKF13_Temperature",
72 "L3_BKF8_Temperature",
76 "Dipole_Inside_Temperature",
80 "Dipole_Outside_Temperature",
83 //-----------------------------------------------------------------------------
84 AliGRPObject::AliGRPObject():
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),
106 fMachineMode(fgkInvalidString),
108 fMachineModeArray(0x0),
109 fMaxTimeLHCValidity(0)
113 // AliGRPObject default ctor
116 fDimension = fgknDCSDPHallProbes*fPoints;
117 fHallProbes = new Float_t[fDimension];
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]));
130 fHallProbes[nhp] = fgkInvalidFloat;
135 for (Int_t i = 0; i < fPoints; i++){
137 fL3Current[i] = fgkInvalidFloat;
138 fDipoleCurrent[i] = fgkInvalidFloat;
139 fCavernTemperature[i] = fgkInvalidFloat;
143 //-----------------------------------------------------------------------------
145 AliGRPObject::AliGRPObject(const AliGRPObject &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),
167 fMachineMode(obj.fMachineMode),
168 fLHCStateArray(obj.fLHCStateArray),
169 fMachineModeArray(obj.fMachineModeArray),
170 fMaxTimeLHCValidity(obj.fMaxTimeLHCValidity)
175 // AliGRPObject copy ctor
178 fHallProbes = new Float_t[fDimension];
180 for (Int_t nhp=0; nhp< fDimension; nhp++){
181 fHallProbes[nhp] = obj.fHallProbes[nhp];
184 for (Int_t i = 0; i < fPoints; i++){
186 fL3Current[i] = obj.fL3Current[i];
187 fDipoleCurrent[i] = obj.fDipoleCurrent[i];
188 fCavernTemperature[i] = obj.fCavernTemperature[i];
192 //-----------------------------------------------------------------------------
194 AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj)
198 // AliGRPObject assignment operator
201 if (&obj == this) return *this;
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();
221 this->fL3Current = new Float_t[fPoints];
222 this->fDipoleCurrent = new Float_t[fPoints];
223 this->fCavernTemperature = new Float_t[fPoints];
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);
230 for (Int_t i = 0; i < fPoints; i++){
232 this->fL3Current[i] = obj.GetL3Current((Stats)i);
233 this->fDipoleCurrent[i] = obj.GetDipoleCurrent((Stats)i);
234 this->fCavernTemperature[i] = obj.GetCavernTemperature((Stats)i);
237 this->fMachineMode = obj.fMachineMode;
238 this->fLHCStateArray = obj.fLHCStateArray;
239 this->fMachineModeArray = obj.fMachineModeArray;
240 this->fMaxTimeLHCValidity = obj.fMaxTimeLHCValidity;
244 //-----------------------------------------------------------------------------
246 AliGRPObject::~AliGRPObject() {
253 delete [] fHallProbes;
254 delete [] fL3Current;
255 delete [] fDipoleCurrent;
256 delete [] fCavernTemperature;
258 if (fCavernAtmosPressure){
259 delete fCavernAtmosPressure;
260 fCavernAtmosPressure = 0x0;
262 if (fCavernAtmosPressure2){
263 delete fCavernAtmosPressure2;
264 fCavernAtmosPressure2 = 0x0;
266 if (fSurfaceAtmosPressure){
267 delete fSurfaceAtmosPressure;
268 fSurfaceAtmosPressure = 0x0;
271 delete fLHCStateArray;
272 fLHCStateArray = 0x0;
274 if (fMachineModeArray){
275 delete fMachineModeArray;
276 fMachineModeArray = 0x0;
280 //-----------------------------------------------------------------------------
281 Float_t* AliGRPObject::GetHallProbesArray(DP_HallProbes hp) const {
284 // method to return array of statistical
285 // variables for Hall Probe hp
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++){
292 array[i] = fHallProbes[shift+i];
298 //-------------------------------------------------------------------------------
300 void AliGRPObject::SetHallProbes(DP_HallProbes hp, const Float_t* hall_probe){
303 // method to set hall probe hp
304 // from a given array
307 Int_t shift = fPoints*hp;
308 for (Int_t i = 0; i< fPoints; i++){
310 fHallProbes[i+shift] = hall_probe[i];
315 //-------------------------------------------------------------------------------
317 void AliGRPObject::ReadValuesFromMap(const TMap* mapGRP){
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
325 if (mapGRP->GetValue("fAliceStartTime")){
326 SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());
329 AliError(Form("No fAliceStartTime value found in GRP map!"));
331 if (mapGRP->GetValue("fAliceStopTime")){
332 SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());
336 AliError(Form("No fAliceStopTime value found in GRP map!"));
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)
345 AliError(Form("No fAliceBeamEnergy value found in GRP map!"));
347 if(mapGRP->GetValue("fAliceBeamType")){
348 SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());
351 AliError(Form("No fAliceBeamType value found in GRP map!"));
353 if(mapGRP->GetValue("fNumberOfDetectors")){
354 SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi());
357 AliError(Form("No fNumberOfDetectors value found in GRP map!"));
359 if(mapGRP->GetValue("fDetectorMask")){
360 SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi());
363 AliError(Form("No fDetectorMask value found in GRP map!"));
365 if(mapGRP->GetValue("fLHCPeriod")){
366 SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());
369 AliError(Form("No fLHCPeriod value found in GRP map!"));
371 if(mapGRP->GetValue("fRunType")){
372 SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());
375 AliError(Form("No fRunType value found in GRP map!"));
377 if(mapGRP->GetValue("fLHCState")){
378 SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());
381 AliError(Form("No fLHCState value found in GRP map!"));
383 if(mapGRP->GetValue("fLHCluminosity")){
384 AliInfo(Form("fLHCLuminosity found, but not there anymore in the new object"));
387 AliError(Form("No fLHCLuminosity value found in GRP map!"));
389 if(mapGRP->GetValue("fBeamIntensity")){
390 AliInfo(Form("fBeamIntensity found, but not there anymore in the new object"));
393 AliError(Form("No fBeamIntensity value found in GRP map!"));
395 if(mapGRP->GetValue("fL3Polarity")){
396 SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());
399 AliError(Form("No fL3Polarity value found in GRP map!"));
401 if(mapGRP->GetValue("fDipolePolarity")){
402 SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi());
405 AliError(Form("No fDipolePolarity value found in GRP map!"));
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);
412 AliError(Form("No fL3Current value found in GRP map!"));
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);
419 AliError(Form("No fDipoleCurrent value found in GRP map!"));
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);
426 AliError(Form("No fCavernTemperature value found in GRP map!"));
428 if(mapGRP->GetValue("fCavernAtmosPressure")){
429 AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));
432 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
434 if(mapGRP->GetValue("fP2Pressure")){
435 SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));
438 AliError(Form("No fP2Pressure value found in GRP map!"));