]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/STEER/AliGRPObject.cxx
Adding the new detector MFT (Antonio Uras)
[u/mrichter/AliRoot.git] / STEER / 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 // **********************
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 Double_t kCavernCut = 1.0;           // tolerable difference between cavern pressure sensors
35 const Double_t kSurfaceDifference = 4.5;   //  offset between surface and cavern pressure sensors
36         
37 const Float_t AliGRPObject::fgkInvalidFloat = 1E-33; // value to identify invalid data - float
38 const TString AliGRPObject::fgkInvalidString = "";  // value to identify invalid data - string
39 const Char_t AliGRPObject::fgkInvalidChar = -1;         // value to identify invalid data - uchar
40 const Int_t AliGRPObject::fgkInvalidInt = -1;  // value to identify invalid data - uint
41 const Int_t AliGRPObject::fgkInvalidUInt = 0;  // value to identify invalid data - uint
42 const Int_t AliGRPObject::fgknDCSDPHallProbes = 40;   // number of dcs dps
43 const char* AliGRPObject::fgkDCSDataPointsHallProbes[AliGRPObject::fgknDCSDPHallProbes] = {
44                    "L3_BSF17_H1",
45                    "L3_BSF17_H2",
46                    "L3_BSF17_H3",
47                    "L3_BSF17_Temperature",
48                    "L3_BSF4_H1",
49                    "L3_BSF4_H2",
50                    "L3_BSF4_H3",
51                    "L3_BSF4_Temperature",
52                    "L3_BKF17_H1",
53                    "L3_BKF17_H2",
54                    "L3_BKF17_H3",
55                    "L3_BKF17_Temperature",
56                    "L3_BKF4_H1",
57                    "L3_BKF4_H2",
58                    "L3_BKF4_H3",
59                    "L3_BKF4_Temperature",
60                    "L3_BSF13_H1",
61                    "L3_BSF13_H2",
62                    "L3_BSF13_H3",
63                    "L3_BSF13_Temperature",
64                    "L3_BSF8_H1",
65                    "L3_BSF8_H2",
66                    "L3_BSF8_H3",
67                    "L3_BSF8_Temperature",
68                    "L3_BKF13_H1",
69                    "L3_BKF13_H2",
70                    "L3_BKF13_H3",
71                    "L3_BKF13_Temperature",
72                    "L3_BKF8_H1",
73                    "L3_BKF8_H2",
74                    "L3_BKF8_H3",
75                    "L3_BKF8_Temperature",
76                    "Dipole_Inside_H1",
77                    "Dipole_Inside_H2",
78                    "Dipole_Inside_H3",
79                    "Dipole_Inside_Temperature",
80                    "Dipole_Outside_H1",
81                    "Dipole_Outside_H2",
82                    "Dipole_Outside_H3",
83                    "Dipole_Outside_Temperature",
84                  };
85
86 //-----------------------------------------------------------------------------
87 AliGRPObject::AliGRPObject():
88         TObject(),
89         fPoints(5),
90         fDimension(0),
91         fTimeStart((time_t)fgkInvalidFloat),
92         fTimeEnd((time_t)fgkInvalidFloat),
93         fBeamEnergy(fgkInvalidFloat),
94         fBeamType(fgkInvalidString),
95         fNumberOfDetectors(fgkInvalidChar),
96         fDetectorMask(fgkInvalidUInt),
97         fLHCPeriod(fgkInvalidString),
98         fRunType(fgkInvalidString),
99         fLHCState(fgkInvalidString),
100         fL3Polarity(fgkInvalidChar),
101         fDipolePolarity(fgkInvalidChar),
102         fL3Current(new Float_t[fPoints]),
103         fDipoleCurrent(new Float_t[fPoints]),
104         fCavernTemperature(new Float_t[fPoints]),
105         fCavernAtmosPressure(0x0),
106         fCavernAtmosPressure2(0x0),
107         fSurfaceAtmosPressure(0x0),
108         fHallProbes(0x0),
109         fMachineMode(fgkInvalidString),
110         fLHCStateArray(0x0),
111         fMachineModeArray(0x0),
112         fQATrigClasses(0x0),
113         fQACloningRequest(0x0),
114         fMaxTimeLHCValidity(0),
115         fNFalseDataQualityFlag(0),
116         fFalseDataQualityFlag(0x0)
117 {
118
119         //
120         // AliGRPObject default ctor
121         //
122
123         fDimension = fgknDCSDPHallProbes*fPoints;
124         fHallProbes = new Float_t[fDimension];
125
126         for (Int_t nhp=0; nhp< fDimension; nhp++){ // setting to zero values for non working HP 
127                 if ((nhp >= 0 && nhp <= 1*fPoints-1) || // L3_BSF17_H1
128                     (nhp >= 1*fPoints && nhp <= 2*fPoints-1) || // L3_BSF17_H2
129                     (nhp >= 2*fPoints && nhp <= 3*fPoints-1) || // L3_BSF17_H3
130                     (nhp >= 3*fPoints && nhp <= 4*fPoints-1) || // L3_BSF17_Temperature
131                     (nhp >= 6*fPoints && nhp <= 7*fPoints-1) ) { // L3_BSF4_H3
132                         fHallProbes[nhp] = 0; // setting to zero values for non working HP 
133                         AliDebug(2,Form("setting hp[%d] to zero = %f", 
134 nhp, fHallProbes[nhp]));
135                 }
136                 else {
137                         fHallProbes[nhp] = fgkInvalidFloat;
138                 }
139         }
140
141
142         for (Int_t i = 0; i < fPoints; i++){
143
144                 fL3Current[i] = fgkInvalidFloat;
145                 fDipoleCurrent[i] = fgkInvalidFloat;
146                 fCavernTemperature[i] = fgkInvalidFloat;
147         }
148
149         for (Int_t ibeamType = 0; ibeamType<2; ibeamType++){
150                 fSeparateBeamType[ibeamType] = fgkInvalidString;
151         }
152 }
153
154 //-----------------------------------------------------------------------------
155
156 AliGRPObject::AliGRPObject(const AliGRPObject &obj):
157         TObject(obj),
158         fPoints(obj.fPoints),
159         fDimension(obj.fDimension),
160         fTimeStart(obj.fTimeStart),
161         fTimeEnd(obj.fTimeEnd),
162         fBeamEnergy(obj.fBeamEnergy),
163         fBeamType(obj.fBeamType),
164         fNumberOfDetectors(obj.fNumberOfDetectors),
165         fDetectorMask(obj.fDetectorMask),
166         fLHCPeriod(obj.fLHCPeriod),
167         fRunType(obj.fRunType),
168         fLHCState(obj.fLHCState),
169         fL3Polarity(obj.fL3Polarity),
170         fDipolePolarity(obj.fDipolePolarity),
171         fL3Current(new Float_t[fPoints]),
172         fDipoleCurrent(new Float_t[fPoints]),
173         fCavernTemperature(new Float_t[fPoints]),
174         fCavernAtmosPressure(obj.fCavernAtmosPressure),
175         fCavernAtmosPressure2(obj.fCavernAtmosPressure2),
176         fSurfaceAtmosPressure(obj.fSurfaceAtmosPressure),
177         fHallProbes(0x0),
178         fMachineMode(obj.fMachineMode),
179         fLHCStateArray(obj.fLHCStateArray),
180         fMachineModeArray(obj.fMachineModeArray),
181         fQATrigClasses(obj.fQATrigClasses),
182         fQACloningRequest(obj.fQACloningRequest),
183         fMaxTimeLHCValidity(obj.fMaxTimeLHCValidity),
184         fNFalseDataQualityFlag(obj.fNFalseDataQualityFlag),
185         fFalseDataQualityFlag(obj.fFalseDataQualityFlag)
186
187
188 {
189
190         //
191         // AliGRPObject copy ctor
192         //
193
194         fHallProbes = new Float_t[fDimension]; 
195
196         for (Int_t nhp=0; nhp< fDimension; nhp++){
197                 fHallProbes[nhp] = obj.fHallProbes[nhp];
198         }
199
200         for (Int_t i = 0; i < fPoints; i++){
201
202                 fL3Current[i] = obj.fL3Current[i];
203                 fDipoleCurrent[i] = obj.fDipoleCurrent[i];
204                 fCavernTemperature[i] = obj.fCavernTemperature[i];
205         }
206
207         for (Int_t ibeamType = 0; ibeamType<2; ibeamType++){
208                 fSeparateBeamType[ibeamType] = obj.fSeparateBeamType[ibeamType];
209         }
210 }
211
212 //-----------------------------------------------------------------------------
213
214 AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj) 
215 {
216
217         //
218         // AliGRPObject assignment operator
219         //
220
221         if (&obj == this) return *this; 
222
223         TObject::operator=(obj);
224         this->fTimeStart = obj.GetTimeStart();
225         this->fTimeEnd = obj.GetTimeEnd();
226         this->fBeamEnergy = obj.GetBeamEnergy();
227         this->fBeamType = obj.GetBeamType();
228         this->fNumberOfDetectors = obj.GetNumberOfDetectors();
229         this->fDetectorMask = obj.GetDetectorMask();
230         this->fLHCPeriod = obj.GetLHCPeriod();
231         this->fRunType = obj.GetRunType();
232         this->fLHCState = obj.GetLHCState();
233         this->fL3Polarity = obj.GetL3Polarity();
234         this->fDipolePolarity = obj.GetDipolePolarity();
235         this->fCavernAtmosPressure = obj.GetCavernAtmosPressure();
236         this->fCavernAtmosPressure2 = obj.GetCavernAtmosPressure2();
237         this->fSurfaceAtmosPressure = obj.GetSurfaceAtmosPressure();
238         this->fPoints = obj.GetPoints();
239         this->fDimension = obj.GetDimension();
240
241         this->fL3Current = new Float_t[fPoints];
242         this->fDipoleCurrent = new Float_t[fPoints];
243         this->fCavernTemperature = new Float_t[fPoints];
244         
245         if (this->fHallProbes==NULL) this->fHallProbes = new Float_t[this->fDimension]; 
246         for (Int_t nhp=0; nhp< fDimension; nhp++){
247                 this->fHallProbes[nhp] = obj.GetHallProbes(nhp);
248
249         }
250         for (Int_t i = 0; i < fPoints; i++){
251
252                 this->fL3Current[i] = obj.GetL3Current((Stats)i);
253                 this->fDipoleCurrent[i] = obj.GetDipoleCurrent((Stats)i);
254                 this->fCavernTemperature[i] = obj.GetCavernTemperature((Stats)i);
255         }
256
257         this->fMachineMode = obj.fMachineMode;
258         this->fLHCStateArray = obj.fLHCStateArray;
259         this->fMachineModeArray = obj.fMachineModeArray;
260         this->fMaxTimeLHCValidity = obj.fMaxTimeLHCValidity;
261
262         this->fQATrigClasses = obj.fQATrigClasses;
263         this->fQACloningRequest = obj.fQACloningRequest;
264
265         for (Int_t ibeamType = 0; ibeamType<2; ibeamType++){
266                 this->fSeparateBeamType[ibeamType] = obj.fSeparateBeamType[ibeamType];
267         }
268
269         this->fNFalseDataQualityFlag = obj.fNFalseDataQualityFlag;
270         this->fFalseDataQualityFlag = obj.fFalseDataQualityFlag;
271
272         return *this;
273 }
274
275 //-----------------------------------------------------------------------------
276
277 AliGRPObject::~AliGRPObject() {
278
279         //
280         // dtor
281         //
282
283         
284         delete [] fHallProbes;
285         delete [] fL3Current;
286         delete [] fDipoleCurrent;
287         delete [] fCavernTemperature;
288
289         if (fCavernAtmosPressure){
290                 delete fCavernAtmosPressure;
291                 fCavernAtmosPressure = 0x0;
292         }
293         if (fCavernAtmosPressure2){
294                 delete fCavernAtmosPressure2;
295                 fCavernAtmosPressure2 = 0x0;
296         }
297         if (fSurfaceAtmosPressure){
298                 delete fSurfaceAtmosPressure;
299                 fSurfaceAtmosPressure = 0x0;
300         }
301         if (fLHCStateArray){
302                 delete fLHCStateArray;
303                 fLHCStateArray = 0x0;
304         }
305         if (fMachineModeArray){
306                 delete fMachineModeArray;
307                 fMachineModeArray = 0x0;
308         }
309         if (fQATrigClasses) {
310           delete fQATrigClasses;
311           fQATrigClasses = 0x0;
312         }
313         if (fQACloningRequest) {
314           delete fQACloningRequest;
315           fQACloningRequest = 0x0;
316         }
317         if (fFalseDataQualityFlag){
318                 delete fFalseDataQualityFlag;
319                 fFalseDataQualityFlag = 0x0;
320         }
321 }
322
323 //-----------------------------------------------------------------------------
324 Float_t* AliGRPObject::GetHallProbesArray(DP_HallProbes hp) const {
325
326         //
327         // method to return array of statistical
328         // variables for Hall Probe hp
329         //
330
331         Float_t* array = new Float_t[fPoints];
332         Int_t shift = fPoints*(Int_t)hp; 
333         for (Int_t i=0;i<fPoints; i++){
334
335                 array[i] = fHallProbes[shift+i];
336
337         }
338
339         return array;
340 }
341 //-------------------------------------------------------------------------------
342
343 void AliGRPObject::SetHallProbes(DP_HallProbes hp, const Float_t* hall_probe){
344
345         //
346         // method to set hall probe hp 
347         // from a given array
348         //
349
350         Int_t shift = fPoints*hp;
351         for (Int_t i = 0; i< fPoints; i++){
352
353                 fHallProbes[i+shift] =  hall_probe[i];
354         }
355         return;
356 }
357
358 //-------------------------------------------------------------------------------
359
360 void AliGRPObject::ReadValuesFromMap(const TMap* mapGRP){
361
362         //
363         // method to set the values of the GRP parameters 
364         // reading them from the old format of the GRP 
365         // object, i.e. a TMap
366         //
367
368         if (mapGRP->GetValue("fAliceStartTime")){
369                 SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());
370         }
371         else {
372                 AliError(Form("No fAliceStartTime value found in GRP map!"));
373         }
374         if (mapGRP->GetValue("fAliceStopTime")){
375                 SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());
376         }
377         
378         else { 
379                 AliError(Form("No fAliceStopTime value found in GRP map!"));
380         }
381
382         if(mapGRP->GetValue("fAliceBeamEnergy")){
383           double be = (((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof();
384           if (IsBeamEnergyIsSqrtSHalfGeV()) be/=2;   // old format was storig sqrt(s)
385           SetBeamEnergy(be);
386         }
387         else { 
388                 AliError(Form("No fAliceBeamEnergy value found in GRP map!"));
389         }
390         if(mapGRP->GetValue("fAliceBeamType")){
391                 SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());
392         }
393         else { 
394                 AliError(Form("No fAliceBeamType value found in GRP map!"));
395         }
396         if(mapGRP->GetValue("fNumberOfDetectors")){
397                 SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi()); 
398                 AliDebug(1, Form("fNumberOfDetectors = %d", fNumberOfDetectors));
399         }
400         else { 
401                 AliError(Form("No fNumberOfDetectors value found in GRP map!"));
402         }
403         if(mapGRP->GetValue("fDetectorMask")){
404                 SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi());  
405                 AliDebug(1, Form("fDetectorMask = %d",fDetectorMask));
406         }
407         else { 
408                 AliError(Form("No fDetectorMask value found in GRP map!"));
409         }
410         if(mapGRP->GetValue("fLHCPeriod")){
411                 SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());
412         }
413         else { 
414                 AliError(Form("No fLHCPeriod value found in GRP map!"));
415         }
416         if(mapGRP->GetValue("fRunType")){
417                 SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());
418         }
419         else { 
420                 AliError(Form("No fRunType value found in GRP map!"));
421         }
422         if(mapGRP->GetValue("fLHCState")){
423                 SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());
424         }
425         else { 
426                 AliError(Form("No fLHCState value found in GRP map!"));
427         }
428         if(mapGRP->GetValue("fLHCluminosity")){
429                 AliInfo(Form("fLHCLuminosity found, but not there anymore in the new object"));
430         }       
431         else { 
432                 AliError(Form("No fLHCLuminosity value found in GRP map!"));
433         }
434         if(mapGRP->GetValue("fBeamIntensity")){
435                 AliInfo(Form("fBeamIntensity found, but not there anymore in the new object"));
436         }       
437         else { 
438                 AliError(Form("No fBeamIntensity value found in GRP map!"));
439         }
440         if(mapGRP->GetValue("fL3Polarity")){
441                 SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());
442         }       
443         else { 
444                 AliError(Form("No fL3Polarity value found in GRP map!"));
445         }
446         if(mapGRP->GetValue("fDipolePolarity")){
447                 SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi());  
448         }       
449         else { 
450                 AliError(Form("No fDipolePolarity value found in GRP map!"));
451         }
452         if(mapGRP->GetValue("fL3Current")){
453                 AliInfo(Form("fL3Current found, but porting only average to the new object, since the other values are not available in the old object"));
454                 SetL3Current((Float_t)(((TObjString*)(mapGRP->GetValue("fL3Current")))->GetString()).Atof(),(Stats)0);
455         }       
456         else { 
457                 AliError(Form("No fL3Current value found in GRP map!"));
458         }
459         if(mapGRP->GetValue("fDipoleCurrent")){
460                 AliInfo(Form("fDipoleCurrent found, but porting only average to the new object, since the other values are not available in the old object"));
461                 SetDipoleCurrent((Float_t)(((TObjString*)(mapGRP->GetValue("fDipoleCurrent")))->GetString()).Atof(),(Stats)0);
462         }       
463         else { 
464                 AliError(Form("No fDipoleCurrent value found in GRP map!"));
465         }
466         if(mapGRP->GetValue("fCavernTemperature")){
467                 AliInfo(Form("fCaverntemperature found, but porting only average to the new object, since the other values are not available in the old object"));
468                 SetCavernTemperature((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernTemperature")))->GetString()).Atof(),(Stats)0);
469         }       
470         else { 
471                 AliError(Form("No fCavernTemperature value found in GRP map!"));
472         }
473         if(mapGRP->GetValue("fCavernAtmosPressure")){
474                 AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));
475         }       
476         else { 
477                 AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
478         }
479         if(mapGRP->GetValue("fP2Pressure")){
480                 SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));
481         }
482         else { 
483                 AliError(Form("No fP2Pressure value found in GRP map!"));
484         }
485         
486         return;
487
488 }
489 //-------------------------------------------------------------------------------
490
491 Float_t AliGRPObject::GetBeamEnergy() const {
492
493         //
494         // Getting the energy
495         // in case of BeamType = A-A, multiplying by 82/208 (for PbPb)
496         //
497
498         Float_t energy = fBeamEnergy;
499         if (fBeamType=="A-A"){
500                 energy = energy*82./208;
501         }
502         return IsBeamEnergyIsSqrtSHalfGeV() ? energy : energy/2;
503 }
504
505 //-------------------------------------------------------------------------------
506
507 Double_t AliGRPObject::EvalCavernPressure(const TTimeStamp& time, Bool_t& inside) const { 
508 //
509 //  Return current pressure value from 'best' cavern sensor
510 //    (default sensor 2. If sensor 1 and sensor 2 are sufficiently different,
511 //     use sensor most compatible with surface sensor
512
513   return EvalCavernPressure(fCavernAtmosPressure,fCavernAtmosPressure2,
514              fSurfaceAtmosPressure,time,inside);
515                                 
516 }
517
518 //-------------------------------------------------------------------------------
519
520 Double_t AliGRPObject::EvalCavernPressure(AliDCSSensor* cavern1, 
521                       AliDCSSensor* cavern2, AliDCSSensor* surface, 
522                       const TTimeStamp& time, Bool_t& inside)  {
523 //
524 //  Return current pressure value from 'best' cavern sensor
525 //    (default sensor 2. If sensor 1 and sensor 2 are sufficiently different,
526 //     use sensor most compatible with surface sensor
527
528      
529     Double_t valueSensor2 = cavern2->Eval(time,inside);
530     Double_t valueSensor1 = cavern1->Eval(time,inside);
531     if (TMath::Abs(valueSensor2-valueSensor1)<kCavernCut) {
532         return valueSensor2;
533     } else { 
534         Double_t valueSurface = surface->Eval(time,inside);
535         Double_t diff1 = TMath::Abs(valueSensor1-valueSurface-kSurfaceDifference);
536         Double_t diff2 = TMath::Abs(valueSensor2-valueSurface-kSurfaceDifference);
537         if (TMath::Abs(diff1)<TMath::Abs(diff2) ) {
538             return valueSensor1;
539         } else {
540             return valueSensor2;
541         }
542      }
543 }
544
545 //-------------------------------------------------------------------------------
546
547 AliDCSSensor* AliGRPObject::GetBestCavernAtmosPressure(AliDCSSensor* cavern1, 
548              AliDCSSensor* cavern2, AliDCSSensor* surface, const TTimeStamp& time) {
549
550 //
551 //  Return pointer to 'best' cavern sensor
552 //    (default sensor 2. If sensor 1 and sensor 2 are sufficiently different,
553 //     use sensor most compatible with surface sensor
554 //    Pressure measuread at time specified by TTimestamp
555
556
557     Bool_t inside; 
558     Double_t valueSensor2 = cavern2->Eval(time,inside);
559     Double_t valueSensor1 = cavern1->Eval(time,inside);
560     if (TMath::Abs(valueSensor2-valueSensor1)<kCavernCut) {
561         return cavern2;
562     } else { 
563         Double_t valueSurface = surface->Eval(time,inside);
564         Double_t diff1 = TMath::Abs(valueSensor1-valueSurface-kSurfaceDifference);
565         Double_t diff2 = TMath::Abs(valueSensor2-valueSurface-kSurfaceDifference);
566         if (TMath::Abs(diff1)<TMath::Abs(diff2) ) {
567             return cavern1;
568         } else {
569             return cavern2;
570         }
571      }
572 }
573
574 //-------------------------------------------------------------------------------
575
576 AliDCSSensor*   AliGRPObject::GetBestCavernAtmosPressure(const TTimeStamp& time) const {
577 //
578 //  Return pointer to 'best' cavern sensor
579 //    (default sensor 2. If sensor 1 and sensor 2 are sufficiently different,
580 //     use sensor most compatible with surface sensor
581 //    Pressure measuread at time specified by TTimestamp
582
583
584    return GetBestCavernAtmosPressure(fCavernAtmosPressure,
585         fCavernAtmosPressure2, fSurfaceAtmosPressure, time);
586
587 }
588     
589 //-------------------------------------------------------------------------------
590
591 AliDCSSensor*   AliGRPObject::GetBestCavernAtmosPressure() const {
592 //
593 //  Return pointer to 'best' cavern sensor
594 //    (default sensor 2. If sensor 1 and sensor 2 are sufficiently different,
595 //     use sensor most compatible with surface sensor
596 //    Pressure measuread at start-of-run
597
598    return GetBestCavernAtmosPressure(TTimeStamp(fTimeStart));
599 }
600
601 //-------------------------------------------------------------------------------
602 void AliGRPObject::SetFalseDataQualityFlagPeriods(Double_t* falses){
603         
604         //
605         // setting the starts (even positions in the array) and ends (odd positions in the array)
606         // of the periods when the Data Quality Flag was set to FALSE
607         //
608         
609         fFalseDataQualityFlag = new TArrayD(fNFalseDataQualityFlag*2,falses);
610 }
611
612 //-------------------------------------------------------------------------------
613 Double_t AliGRPObject::GetStartFalseDataQualityFlag(Int_t iperiod) const {
614         
615         // 
616         // returning the start timestamp of the FALSE period "iperiod"
617         //
618         
619         if (iperiod < fNFalseDataQualityFlag){
620                 return fFalseDataQualityFlag->At(iperiod*2);
621         }
622         else{
623                 AliError(Form("You are looking for FALSE period %d, but the number of FALSE periods was %d - returning -1!", iperiod, fNFalseDataQualityFlag));
624         }
625         return -1.;
626 }
627
628 //-------------------------------------------------------------------------------
629 Double_t AliGRPObject::GetEndFalseDataQualityFlag(Int_t iperiod) const {
630         
631         // 
632         // returning the end timestamp of the FALSE period "iperiod"
633         //
634         
635         if (iperiod < fNFalseDataQualityFlag){
636                 return fFalseDataQualityFlag->At(iperiod*2+1);
637         }
638         else{
639                 AliError(Form("You are looking for FALSE period %d, but the number of FALSE periods was %d - returning -1!", iperiod, fNFalseDataQualityFlag));
640         }
641         return -1.;
642 }