]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliGRPObject.cxx
Coding rule violations fixed.
[u/mrichter/AliRoot.git] / STEER / AliGRPObject.cxx
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 // 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.
21
22 #include "AliGRPObject.h"
23 #include "AliSplineFit.h"
24 #include "AliDCSSensor.h"
25 #include "AliLog.h"
26 #include <TObject.h>
27
28 ClassImp(AliGRPObject)
29         
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] = {
37                    "L3_BSF17_H1",
38                    "L3_BSF17_H2",
39                    "L3_BSF17_H3",
40                    "L3_BSF17_Temperature",
41                    "L3_BSF4_H1",
42                    "L3_BSF4_H2",
43                    "L3_BSF4_H3",
44                    "L3_BSF4_Temperature",
45                    "L3_BKF17_H1",
46                    "L3_BKF17_H2",
47                    "L3_BKF17_H3",
48                    "L3_BKF17_Temperature",
49                    "L3_BKF4_H1",
50                    "L3_BKF4_H2",
51                    "L3_BKF4_H3",
52                    "L3_BKF4_Temperature",
53                    "L3_BSF13_H1",
54                    "L3_BSF13_H2",
55                    "L3_BSF13_H3",
56                    "L3_BSF13_Temperature",
57                    "L3_BSF8_H1",
58                    "L3_BSF8_H2",
59                    "L3_BSF8_H3",
60                    "L3_BSF8_Temperature",
61                    "L3_BKF13_H1",
62                    "L3_BKF13_H2",
63                    "L3_BKF13_H3",
64                    "L3_BKF13_Temperature",
65                    "L3_BKF8_H1",
66                    "L3_BKF8_H2",
67                    "L3_BKF8_H3",
68                    "L3_BKF8_Temperature",
69                    "Dipole_Inside_H1",
70                    "Dipole_Inside_H2",
71                    "Dipole_Inside_H3",
72                    "Dipole_Inside_Temperature",
73                    "Dipole_Outside_H1",
74                    "Dipole_Outside_H2",
75                    "Dipole_Outside_H3",
76                    "Dipole_Outside_Temperature",
77                  };
78
79 //-----------------------------------------------------------------------------
80 AliGRPObject::AliGRPObject():
81         TObject(),
82         fPoints(5),
83         fDimension(0),
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),
105         fHallProbes(0x0)
106 {
107
108         //
109         // AliGRPObject default ctor
110         //
111
112         fDimension = fgknDCSDP_HallProbes*fPoints;
113         fHallProbes = new Float_t[fDimension];
114
115         for (Int_t nhp=0; nhp< fDimension; nhp++){
116                 fHallProbes[nhp] = fgkInvalidFloat;
117         }
118
119         for (Int_t i = 0; i < fPoints; i++){
120
121                 fLHCLuminosity[i] = fgkInvalidFloat;
122                 fBeamIntensity[i] = fgkInvalidFloat;
123                 fL3Current[i] = fgkInvalidFloat;
124                 fDipoleCurrent[i] = fgkInvalidFloat;
125                 fCavernTemperature[i] = fgkInvalidFloat;
126                 //              fCavernAtmosPressure[i] = fgkInvalidFloat;
127         }
128 }
129
130 //-----------------------------------------------------------------------------
131
132 AliGRPObject::AliGRPObject(const AliGRPObject &obj):
133         TObject(),
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),
157         fHallProbes(0x0)
158
159 {
160
161         //
162         // AliGRPObject copy ctor
163         //
164
165         for (Int_t nhp=0; nhp< fDimension; nhp++){
166                 fHallProbes[nhp] = obj.fHallProbes[nhp];
167         }
168
169         for (Int_t i = 0; i < fPoints; i++){
170
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];
177         }
178 }
179
180 //-----------------------------------------------------------------------------
181
182 AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj) 
183 {
184
185         //
186         // AliGRPObject assignment operator
187         //
188
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();
206
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];
213         
214         for (Int_t nhp=0; nhp< fDimension; nhp++){
215                 this->fHallProbes[nhp] = obj.GetHallProbes(nhp);
216
217         }
218         for (Int_t i = 0; i < fPoints; i++){
219
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);
227         }
228
229         return *this;
230 }
231
232 //-----------------------------------------------------------------------------
233
234 AliGRPObject::~AliGRPObject() {
235
236         //
237         // dtor
238         //
239
240         
241         delete [] fHallProbes;
242         delete [] fLHCLuminosity;
243         delete [] fBeamIntensity;
244         delete [] fL3Current;
245         delete [] fDipoleCurrent;
246         delete [] fCavernTemperature;
247
248         if (fLHCLuminositySplineFit){
249                 delete fLHCLuminositySplineFit;
250                 fLHCLuminositySplineFit = 0x0;
251         }
252         if (fBeamIntensitySplineFit){
253                 delete fBeamIntensitySplineFit;
254                 fBeamIntensitySplineFit = 0x0;
255         }
256         if (fCavernAtmosPressure){
257                 delete fCavernAtmosPressure;
258                 fCavernAtmosPressure = 0x0;
259         }
260         if (fSurfaceAtmosPressure){
261                 delete fSurfaceAtmosPressure;
262                 fSurfaceAtmosPressure = 0x0;
263         }
264 }
265
266 //-----------------------------------------------------------------------------
267
268 Float_t* AliGRPObject::GetHallProbes(DP_HallProbes hp) {
269
270         //
271         // method to return array of statistical
272         // variables for Hall Probe hp
273         //
274
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++){
278
279                 array[i] = fHallProbes[shift+i];
280
281         }
282
283         return array;
284 }
285
286 //-------------------------------------------------------------------------------
287
288 void AliGRPObject::SetHallProbes(DP_HallProbes hp, Float_t* hall_probe){
289
290         //
291         // method to set hall probe hp 
292         // from a given array
293         //
294
295         Int_t shift = fPoints*hp;
296         for (Int_t i = 0; i< fPoints; i++){
297
298                 fHallProbes[i+shift] =  hall_probe[i];
299         }
300         return;
301 }
302
303 //-------------------------------------------------------------------------------
304
305 void AliGRPObject::ReadValuesFromMap(TMap* mapGRP){
306
307         //
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
311         //
312
313         if (mapGRP->GetValue("fAliceStartTime")){
314                 SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());
315         }
316         else {
317                 AliError(Form("No fAliceStartTime value found in GRP map!"));
318         }
319         if (mapGRP->GetValue("fAliceStopTime")){
320                 SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());
321         }
322         
323         else { 
324                 AliError(Form("No fAliceStopTime value found in GRP map!"));
325         }
326
327         if(mapGRP->GetValue("fAliceBeamEnergy")){
328                 SetBeamEnergy((((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof());
329         }
330         else { 
331                 AliError(Form("No fAliceBeamEnergy value found in GRP map!"));
332         }
333         if(mapGRP->GetValue("fAliceBeamType")){
334                 SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());
335         }
336         else { 
337                 AliError(Form("No fAliceBeamType value found in GRP map!"));
338         }
339         if(mapGRP->GetValue("fNumberOfDetectors")){
340                 SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi()); 
341         }
342         else { 
343                 AliError(Form("No fNumberOfDetectors value found in GRP map!"));
344         }
345         if(mapGRP->GetValue("fDetectorMask")){
346                 SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi());  
347         }
348         else { 
349                 AliError(Form("No fDetectorMask value found in GRP map!"));
350         }
351         if(mapGRP->GetValue("fLHCPeriod")){
352                 SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());
353         }
354         else { 
355                 AliError(Form("No fLHCPeriod value found in GRP map!"));
356         }
357         if(mapGRP->GetValue("fRunType")){
358                 SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());
359         }
360         else { 
361                 AliError(Form("No fRunType value found in GRP map!"));
362         }
363         if(mapGRP->GetValue("fLHCState")){
364                 SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());
365         }
366         else { 
367                 AliError(Form("No fLHCState value found in GRP map!"));
368         }
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);
372         }       
373         else { 
374                 AliError(Form("No fLHCLuminosity value found in GRP map!"));
375         }
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);
379         }       
380         else { 
381                 AliError(Form("No fBeamIntensity value found in GRP map!"));
382         }
383         if(mapGRP->GetValue("fL3Polarity")){
384                 SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());
385         }       
386         else { 
387                 AliError(Form("No fL3Polarity value found in GRP map!"));
388         }
389         if(mapGRP->GetValue("fDipolePolarity")){
390                 SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi());  
391         }       
392         else { 
393                 AliError(Form("No fDipolePolarity value found in GRP map!"));
394         }
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);
398         }       
399         else { 
400                 AliError(Form("No fL3Current value found in GRP map!"));
401         }
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);
405         }       
406         else { 
407                 AliError(Form("No fDipoleCurrent value found in GRP map!"));
408         }
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);
412         }       
413         else { 
414                 AliError(Form("No fCavernTemperature value found in GRP map!"));
415         }
416         /*
417         if(mapGRP->GetValue("fCavernAtmosPressure")){
418                 SetCavernAtmosPressure((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernAtmosPressure")))->GetString()).Atof(),(Stats)0);
419         }       
420         else { 
421                 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
422         }
423         */
424         if(mapGRP->GetValue("fCavernAtmosPressure")){
425                 AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));
426         }       
427         else { 
428                 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
429         }
430         if(mapGRP->GetValue("fP2Pressure")){
431                 SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));
432         }
433         else { 
434                 AliError(Form("No fP2Pressure value found in GRP map!"));
435         }
436         
437         return;
438
439 }