263e1073d8efb309f6fac9c6c1586d4ce5a86734
[u/mrichter/AliRoot.git] / STEER / AliGRPObject.h
1 #ifndef ALIGRPOBJECT_H\r
2 #define ALIGRPOBJECT_H\r
3 \r
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
5  * See cxx source for full Copyright notice                               */\r
6 \r
7 /* $Id$ */\r
8 \r
9 //\r
10 // AliGRPObject\r
11 // class to store the information\r
12 // coming from the GRP preprocessor\r
13 // \r
14 \r
15 #include <time.h>\r
16 \r
17 class TMap;\r
18 \r
19 class AliDCSSensor;\r
20 class AliSplineFit;\r
21 class AliLog;\r
22 \r
23 class AliGRPObject : public TObject {\r
24  public:\r
25 \r
26         enum Stats {kMean = 0, kTruncMean = 1, kMedian = 2, kSDMean = 3, kSDMedian = 4};\r
27         \r
28         enum StatusBits {kPolConvLHC = BIT(14), kUniformBMap = BIT(15)};\r
29 \r
30         enum DP_HallProbes { \r
31                  khpL3bsf17H1= 0 , khpL3bsf17H2, khpL3bsf17H3, khpL3bsf17Temperature, \r
32                  khpL3bsf4H1, khpL3bsf4H2, khpL3bsf4H3, khpL3bsf4Temperature, \r
33                  khpL3bkf17H1, khpL3bkf17H2, khpL3bkf17H3, khpL3bkf17Temperature, \r
34                  khpL3bkf4H1, khpL3bkf4H2, khpL3bkf4H3, khpL3bkf4Temperature, \r
35                  khpL3bsf13H1, khpL3bsf13H2, khpL3bsf13H3, khpL3bsf13Temperature,\r
36                  khpL3bsf8H1, khpL3bsf8H2, khpL3bsf8H3, khpL3bsfy8Temperature,\r
37                  khpL3bkf13H1, khpL3bkf13H2, khpL3bkf13H3, khpL3bkf13Temperature,\r
38                  khpL3bkf8H1, khpL3bkf8H2, khpL3bkf8H3, khpL3bkf8Temperature,\r
39                  khpDipoleInsideH1, khpDipoleInsideH2, khpDipoleInsideH3, khpDipoleInsideTemperature,\r
40                  khpDipoleOutsideH1, khpDipoleOutsideH2, khpDipoleOutsideH3, khpDipoleOutsideTemperature};\r
41 \r
42 \r
43         AliGRPObject();\r
44         AliGRPObject(const AliGRPObject & obj);\r
45         AliGRPObject& operator=(const AliGRPObject & obj);\r
46         ~AliGRPObject();\r
47 \r
48         // getters\r
49 \r
50         Bool_t    IsPolarityConventionLHC() const {return TestBit(kPolConvLHC);}\r
51         Bool_t    IsUniformBMap() const {return TestBit(kUniformBMap);}\r
52         time_t    GetTimeStart() const {return fTimeStart;}\r
53         time_t    GetTimeEnd() const {return fTimeEnd;}\r
54         Float_t   GetBeamEnergy() const {return fBeamEnergy;}\r
55         TString   GetBeamType() const {return fBeamType;}\r
56         Char_t    GetNumberOfDetectors() const {return fNumberOfDetectors;}\r
57         UInt_t    GetDetectorMask() const {return fDetectorMask;}\r
58         TString   GetLHCPeriod() const {return fLHCPeriod;}\r
59         TString   GetRunType() const {return fRunType;}\r
60         TString   GetLHCState() const {return fLHCState;}\r
61         Float_t*  GetLHCLuminosity() const {return fLHCLuminosity;}\r
62         Float_t   GetLHCLuminosity(Stats stat) const {return fLHCLuminosity[stat];}\r
63         AliSplineFit*  GetLHCLuminositySplineFit() const {return fLHCLuminositySplineFit;}\r
64         Float_t*  GetBeamIntensity() const {return fBeamIntensity;}\r
65         Float_t   GetBeamIntensity(Stats stat) const {return fBeamIntensity[stat];}\r
66         AliSplineFit*  GetBeamIntensitySplineFit() const {return fBeamIntensitySplineFit;}\r
67         Char_t    GetL3Polarity() const {return fL3Polarity;}\r
68         Char_t    GetDipolePolarity() const {return fDipolePolarity;}\r
69         Float_t*  GetL3Current() const {return fL3Current;}\r
70         Float_t   GetL3Current(Stats stat) const {return fL3Current[stat];}\r
71         Float_t*  GetDipoleCurrent() const {return fDipoleCurrent;}\r
72         Float_t   GetDipoleCurrent(Stats stat) const {return fDipoleCurrent[stat];}\r
73         Float_t*  GetCavernTemperature() const {return fCavernTemperature;}\r
74         Float_t   GetCavernTemperature(Stats stat) const {return fCavernTemperature[stat];}\r
75         AliDCSSensor*   GetCavernAtmosPressure() const {return fCavernAtmosPressure;}\r
76         AliDCSSensor*   GetCavernAtmosPressure2() const {return fCavernAtmosPressure2;}\r
77         AliDCSSensor*   GetSurfaceAtmosPressure() const {return fSurfaceAtmosPressure;}\r
78 \r
79         Float_t*  GetHallProbesArray(DP_HallProbes hp) const;\r
80         Float_t   GetHallProbes(Int_t hp) const {return fHallProbes[hp];}\r
81         Float_t   GetHallProbes(DP_HallProbes hp, Stats stat) const {return fHallProbes[hp*fPoints+stat];}\r
82 \r
83         Int_t    GetPoints() const {return fPoints;}\r
84         Int_t    GetDimension() const {return fDimension;}\r
85 \r
86         // setters\r
87 \r
88         void SetPolarityConventionLHC(Bool_t v=kTRUE) {return SetBit(kPolConvLHC,v);}\r
89         void SetUniformBMap(Bool_t v=kTRUE) {return SetBit(kUniformBMap,v);}\r
90         void SetTimeStart(time_t timeStart)  {fTimeStart = timeStart;}\r
91         void SetTimeEnd(time_t timeEnd)  {fTimeEnd = timeEnd;}\r
92         void SetBeamEnergy(Float_t beamEnergy)  {fBeamEnergy = beamEnergy;}\r
93         void SetBeamType(TString beamType)  {fBeamType = beamType;}\r
94         void SetNumberOfDetectors(Char_t numberOfDetectors)  {fNumberOfDetectors = numberOfDetectors;}\r
95         void SetDetectorMask(UInt_t detectorMask)  {fDetectorMask = detectorMask;}\r
96         void SetLHCPeriod(TString lhcPeriod)  {fLHCPeriod = lhcPeriod;}\r
97         void SetRunType(TString runType)  {fRunType = runType;}\r
98         void SetLHCState(TString lhcState)  {fLHCState = lhcState;}\r
99         void SetLHCLuminosity(const Float_t* lhcLuminosity)  {\r
100                 for (Int_t i = 0;i<fPoints;i++) fLHCLuminosity[i] = lhcLuminosity[i];\r
101         }\r
102         void SetLHCLuminosity(Float_t lhcLuminosity, Stats stat)  {fLHCLuminosity[stat] = lhcLuminosity;}\r
103         void SetLHCLuminositySplineFit(AliSplineFit* const lhcLuminositySplineFit)  {fLHCLuminositySplineFit = lhcLuminositySplineFit;}\r
104         void SetBeamIntensity(const Float_t* beamIntensity)  {\r
105                 for (Int_t i = 0;i<fPoints;i++) fBeamIntensity[i] = beamIntensity[i];\r
106         }\r
107         void SetBeamIntensity(Float_t beamIntensity, Stats stat)  {fBeamIntensity[stat] = beamIntensity;}\r
108         void SetBeamIntensitySplineFit(AliSplineFit* const beamIntensitySplineFit)  {fBeamIntensitySplineFit = beamIntensitySplineFit;}\r
109         void SetL3Polarity(Char_t l3Polarity)  {fL3Polarity = l3Polarity;}\r
110         void SetDipolePolarity(Char_t dipolePolarity)  {fDipolePolarity = dipolePolarity;}\r
111         void SetL3Current(const Float_t* l3Current)  {\r
112                 for (Int_t i = 0;i<fPoints;i++) fL3Current[i] = l3Current[i];\r
113         }\r
114         void SetL3Current(Float_t l3Current, Stats stat)  {fL3Current[stat] = l3Current;}\r
115         void SetDipoleCurrent(const Float_t* dipoleCurrent) {\r
116                 for (Int_t i = 0;i<fPoints;i++) fDipoleCurrent[i] = dipoleCurrent[i];\r
117         }\r
118         void SetDipoleCurrent(Float_t dipoleCurrent, Stats stat)  {fDipoleCurrent[stat] = dipoleCurrent;}\r
119         void SetCavernTemperature(const Float_t* cavernTemperature)  {\r
120                 for (Int_t i = 0;i<fPoints;i++) fCavernTemperature[i] = cavernTemperature[i];\r
121         }\r
122         void SetCavernTemperature(Float_t cavernTemperature, Stats stat)  {fCavernTemperature[stat] = cavernTemperature;}\r
123         void SetCavernAtmosPressure(AliDCSSensor* const cavernAtmosPressure)  {fCavernAtmosPressure = cavernAtmosPressure;}\r
124         void SetCavernAtmosPressure2(AliDCSSensor* const cavernAtmosPressure)  {fCavernAtmosPressure2 = cavernAtmosPressure;}\r
125         void SetSurfaceAtmosPressure(AliDCSSensor* const surfacePressure)  {fSurfaceAtmosPressure = surfacePressure;}\r
126 \r
127         void SetHallProbes(DP_HallProbes hp, Float_t hall_probe, Stats stat)  {fHallProbes[hp*fPoints+stat] = hall_probe;}\r
128         void SetHallProbes(const Float_t* hall_probe){\r
129                 for (Int_t i = 0; i< fDimension; i++) fHallProbes[i] =  hall_probe[i];}\r
130 \r
131         void SetHallProbes(DP_HallProbes hp, const Float_t* hall_probe);  \r
132         void SetPoints(Int_t points) {fPoints = points;}\r
133         void SetDimension(Int_t dimension) {fDimension = dimension;}\r
134 \r
135         // getters for "invalid" flags\r
136 \r
137         static Float_t GetInvalidFloat() {return fgkInvalidFloat;}\r
138         static TString GetInvalidString() {return fgkInvalidString;}\r
139         static Int_t GetInvalidInt() {return fgkInvalidInt;}\r
140         static Int_t GetInvalidUInt() {return fgkInvalidUInt;}\r
141         static Char_t GetInvalidChar() {return fgkInvalidChar;}\r
142         static Int_t GetNumberOfHP() {return fgknDCSDPHallProbes;}\r
143         static const char* GetHPDP(Int_t indexHP) {return fgkDCSDataPointsHallProbes[indexHP];}\r
144 \r
145         // to read old GRP object in TMap format\r
146 \r
147         void ReadValuesFromMap(const TMap* map);        \r
148 \r
149  private:\r
150 \r
151         static const Float_t fgkInvalidFloat;   // value to identify invalid data - float\r
152         static const TString fgkInvalidString;  // value to identify invalid data - string\r
153         static const Char_t fgkInvalidChar;     // value to identify invalid data - char\r
154         static const Int_t fgkInvalidInt;       // value to identify invalid data - int\r
155         static const Int_t fgkInvalidUInt;       // value to identify invalid data - uint\r
156         static const Int_t   fgknDCSDPHallProbes;               //! number of dcs dps\r
157         static const char*   fgkDCSDataPointsHallProbes[];      //! names of dcs dps\r
158 \r
159         Int_t fPoints;                    // number of statistical quantities to be stored\r
160         Int_t fDimension;                 // dimension of Hall Probes array\r
161 \r
162         time_t   fTimeStart;              // DAQ_time_start entry from DAQ logbook\r
163         time_t   fTimeEnd;                // DAQ_time_end entry from DAQ logbook\r
164         Float_t  fBeamEnergy;             // beamEnergy entry from DAQ logbook\r
165         TString  fBeamType;               // beamType entry from DAQ logbook\r
166         Char_t   fNumberOfDetectors;      // numberOfDetectors entry from DAQ logbook\r
167         UInt_t   fDetectorMask;           // detectorMask entry from DAQ logbook\r
168         TString  fLHCPeriod;              // LHCperiod entry from DAQ logbook \r
169         TString  fRunType;                // RunType entry from DAQ logbook \r
170         TString  fLHCState;               // LHCState entry from DCS DB\r
171         Float_t*  fLHCLuminosity;         // [fPoints]\r
172                                           // LHCLuminosity entry from DCS DB\r
173         AliSplineFit*  fLHCLuminositySplineFit;       // LHCLuminosity SplineFit from DCS DB\r
174         Float_t*  fBeamIntensity   ;      // [fPoints]\r
175                                           // BeamIntensity entry from DCS DB\r
176         AliSplineFit*  fBeamIntensitySplineFit;       // BeamIntensity SplineFit from DCS DB\r
177         Char_t    fL3Polarity;            // L3Polarity entry from DCS DB\r
178         Char_t    fDipolePolarity;        // DipolePolarity entry from DCS DB                                     \r
179         Float_t*  fL3Current;             // [fPoints]\r
180                                           // L3Current entry from DCS DB\r
181         Float_t*  fDipoleCurrent;         // [fPoints]\r
182                                           // DipoleCurrent entry from DCS DB\r
183         Float_t*  fCavernTemperature;     // [fPoints]\r
184                                           // CavernTemperature entry from DCS DB\r
185         AliDCSSensor*  fCavernAtmosPressure;    // CavernAtmosPressure entry from DCS DB\r
186         AliDCSSensor*  fCavernAtmosPressure2;    // CavernAtmosPressure2 entry from DCS DB\r
187         AliDCSSensor*  fSurfaceAtmosPressure;   // SurfaceAtmosPressure entry from DCS DB\r
188 \r
189         // Hall Probes\r
190 \r
191         Float_t* fHallProbes;       //[fDimension] \r
192                                     // array containg the values for the Hall Probes\r
193 \r
194         ClassDef(AliGRPObject,3)\r
195 \r
196 };\r
197 \r
198 #endif\r