]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliGRPObject.cxx
Forgotten to commit in previous commit
[u/mrichter/AliRoot.git] / STEER / AliGRPObject.cxx
index d2e7a31e9c59a61283ca36f648045dc426e0790a..51eba3e506b05f45d0b983c8573bf566678d2cd7 100644 (file)
 
 /* $Id$ */
 
+// **********************
 // Class containing the GRP data that have to be stored in the OCDB.
 // Data come either from DAQ logbook or from DCS DB.
 // Processing of the data can also be performed here.
+// **********************
+
+#include <TMap.h>
+#include <TObject.h>
+#include <TObjString.h>
 
 #include "AliGRPObject.h"
-#include "AliSplineFit.h"
 #include "AliDCSSensor.h"
 #include "AliLog.h"
-#include <TObject.h>
 
 ClassImp(AliGRPObject)
        
-const Float_t AliGRPObject::fgkInvalidFloat = 0xffffffff; // value to identify invalid data - float
+const Float_t AliGRPObject::fgkInvalidFloat = 1E-33; // value to identify invalid data - float
 const TString AliGRPObject::fgkInvalidString = "";  // value to identify invalid data - string
 const Char_t AliGRPObject::fgkInvalidChar = -1;         // value to identify invalid data - uchar
 const Int_t AliGRPObject::fgkInvalidInt = -1;  // value to identify invalid data - uint
 const Int_t AliGRPObject::fgkInvalidUInt = 0;  // value to identify invalid data - uint
-const Int_t AliGRPObject::fgknDCSDP_HallProbes = 40;   // number of dcs dps
-const char* AliGRPObject::fgkDCSDataPoints_HallProbes[AliGRPObject::fgknDCSDP_HallProbes] = {
+const Int_t AliGRPObject::fgknDCSDPHallProbes = 40;   // number of dcs dps
+const char* AliGRPObject::fgkDCSDataPointsHallProbes[AliGRPObject::fgknDCSDPHallProbes] = {
                   "L3_BSF17_H1",
                   "L3_BSF17_H2",
                   "L3_BSF17_H3",
@@ -90,47 +94,56 @@ AliGRPObject::AliGRPObject():
        fLHCPeriod(fgkInvalidString),
        fRunType(fgkInvalidString),
        fLHCState(fgkInvalidString),
-       fLHCLuminosity(new Float_t[fPoints]),
-       fLHCLuminositySplineFit(0x0),
-       fBeamIntensity(new Float_t[fPoints]),
-       fBeamIntensitySplineFit(0x0),
        fL3Polarity(fgkInvalidChar),
        fDipolePolarity(fgkInvalidChar),
        fL3Current(new Float_t[fPoints]),
        fDipoleCurrent(new Float_t[fPoints]),
        fCavernTemperature(new Float_t[fPoints]),
-       //fCavernAtmosPressure(new Float_t[fPoints]),
        fCavernAtmosPressure(0x0),
+       fCavernAtmosPressure2(0x0),
        fSurfaceAtmosPressure(0x0),
-       fHallProbes(0x0)
+       fHallProbes(0x0),
+       fMachineMode(fgkInvalidString),
+       fLHCStateArray(0x0),
+       fMachineModeArray(0x0),
+       fMaxTimeLHCValidity(0)
 {
 
        //
        // AliGRPObject default ctor
        //
 
-       fDimension = fgknDCSDP_HallProbes*fPoints;
+       fDimension = fgknDCSDPHallProbes*fPoints;
        fHallProbes = new Float_t[fDimension];
 
-       for (Int_t nhp=0; nhp< fDimension; nhp++){
-               fHallProbes[nhp] = fgkInvalidFloat;
+       for (Int_t nhp=0; nhp< fDimension; nhp++){ // setting to zero values for non working HP 
+               if ((nhp >= 0 && nhp <= 1*fPoints-1) || // L3_BSF17_H1
+                   (nhp >= 1*fPoints && nhp <= 2*fPoints-1) || // L3_BSF17_H2
+                   (nhp >= 2*fPoints && nhp <= 3*fPoints-1) || // L3_BSF17_H3
+                    (nhp >= 3*fPoints && nhp <= 4*fPoints-1) || // L3_BSF17_Temperature
+                    (nhp >= 6*fPoints && nhp <= 7*fPoints-1) ) { // L3_BSF4_H3
+                       fHallProbes[nhp] = 0; // setting to zero values for non working HP 
+                       AliDebug(2,Form("setting hp[%d] to zero = %f", 
+nhp, fHallProbes[nhp]));
+               }
+               else {
+                       fHallProbes[nhp] = fgkInvalidFloat;
+               }
        }
 
+
        for (Int_t i = 0; i < fPoints; i++){
 
-               fLHCLuminosity[i] = fgkInvalidFloat;
-               fBeamIntensity[i] = fgkInvalidFloat;
                fL3Current[i] = fgkInvalidFloat;
                fDipoleCurrent[i] = fgkInvalidFloat;
                fCavernTemperature[i] = fgkInvalidFloat;
-               //              fCavernAtmosPressure[i] = fgkInvalidFloat;
        }
 }
 
 //-----------------------------------------------------------------------------
 
 AliGRPObject::AliGRPObject(const AliGRPObject &obj):
-       TObject(),
+       TObject(obj),
        fPoints(obj.fPoints),
        fDimension(obj.fDimension),
        fTimeStart(obj.fTimeStart),
@@ -142,19 +155,19 @@ AliGRPObject::AliGRPObject(const AliGRPObject &obj):
        fLHCPeriod(obj.fLHCPeriod),
        fRunType(obj.fRunType),
        fLHCState(obj.fLHCState),
-       fLHCLuminosity(new Float_t[fPoints]),
-       fLHCLuminositySplineFit(obj.fLHCLuminositySplineFit),
-       fBeamIntensity(new Float_t[fPoints]),
-       fBeamIntensitySplineFit(obj.fBeamIntensitySplineFit),
        fL3Polarity(obj.fL3Polarity),
        fDipolePolarity(obj.fDipolePolarity),
        fL3Current(new Float_t[fPoints]),
        fDipoleCurrent(new Float_t[fPoints]),
        fCavernTemperature(new Float_t[fPoints]),
-       //fCavernAtmosPressure(new Float_t[fPoints]),
        fCavernAtmosPressure(obj.fCavernAtmosPressure),
+       fCavernAtmosPressure2(obj.fCavernAtmosPressure2),
        fSurfaceAtmosPressure(obj.fSurfaceAtmosPressure),
-       fHallProbes(0x0)
+       fHallProbes(0x0),
+       fMachineMode(obj.fMachineMode),
+       fLHCStateArray(obj.fLHCStateArray),
+       fMachineModeArray(obj.fMachineModeArray),
+       fMaxTimeLHCValidity(obj.fMaxTimeLHCValidity)
 
 {
 
@@ -162,18 +175,17 @@ AliGRPObject::AliGRPObject(const AliGRPObject &obj):
        // AliGRPObject copy ctor
        //
 
+       fHallProbes = new Float_t[fDimension]; 
+
        for (Int_t nhp=0; nhp< fDimension; nhp++){
                fHallProbes[nhp] = obj.fHallProbes[nhp];
        }
 
        for (Int_t i = 0; i < fPoints; i++){
 
-               fLHCLuminosity[i] = obj.fLHCLuminosity[i];
-               fBeamIntensity[i] = obj.fBeamIntensity[i];
                fL3Current[i] = obj.fL3Current[i];
                fDipoleCurrent[i] = obj.fDipoleCurrent[i];
-               //fCavernTemperature[i] = obj.fCavernTemperature[i];
-               fCavernAtmosPressure[i] = obj.fCavernAtmosPressure[i];
+               fCavernTemperature[i] = obj.fCavernTemperature[i];
        }
 }
 
@@ -186,6 +198,9 @@ AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj)
        // AliGRPObject assignment operator
        //
 
+       if (&obj == this) return *this; 
+
+       TObject::operator=(obj);
        this->fTimeStart = obj.GetTimeStart();
        this->fTimeEnd = obj.GetTimeEnd();
        this->fBeamEnergy = obj.GetBeamEnergy();
@@ -195,37 +210,34 @@ AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj)
        this->fLHCPeriod = obj.GetLHCPeriod();
        this->fRunType = obj.GetRunType();
        this->fLHCState = obj.GetLHCState();
-       this->fLHCLuminositySplineFit = obj.GetLHCLuminositySplineFit();
-       this->fBeamIntensitySplineFit = obj.GetBeamIntensitySplineFit();
        this->fL3Polarity = obj.GetL3Polarity();
        this->fDipolePolarity = obj.GetDipolePolarity();
        this->fCavernAtmosPressure = obj.GetCavernAtmosPressure();
+       this->fCavernAtmosPressure2 = obj.GetCavernAtmosPressure2();
        this->fSurfaceAtmosPressure = obj.GetSurfaceAtmosPressure();
        this->fPoints = obj.GetPoints();
        this->fDimension = obj.GetDimension();
 
-       this->fLHCLuminosity = new Float_t[fPoints];
-       this->fBeamIntensity = new Float_t[fPoints];
        this->fL3Current = new Float_t[fPoints];
        this->fDipoleCurrent = new Float_t[fPoints];
        this->fCavernTemperature = new Float_t[fPoints];
-       //this->fCavernAtmosPressure = new Float_t[fPoints];
        
+       if (this->fHallProbes==NULL) this->fHallProbes = new Float_t[this->fDimension]; 
        for (Int_t nhp=0; nhp< fDimension; nhp++){
                this->fHallProbes[nhp] = obj.GetHallProbes(nhp);
 
        }
        for (Int_t i = 0; i < fPoints; i++){
 
-               //              this->fBeamEnergy[i] = obj.GetBeamEnergy((Stats)i);
-               this->fLHCLuminosity[i] = obj.GetLHCLuminosity((Stats)i);
-               this->fBeamIntensity[i] = obj.GetBeamIntensity((Stats)i);
                this->fL3Current[i] = obj.GetL3Current((Stats)i);
                this->fDipoleCurrent[i] = obj.GetDipoleCurrent((Stats)i);
                this->fCavernTemperature[i] = obj.GetCavernTemperature((Stats)i);
-               //              this->fCavernAtmosPressure[i] = obj.GetCavernAtmosPressure((Stats)i);
        }
 
+       this->fMachineMode = obj.fMachineMode;
+       this->fLHCStateArray = obj.fLHCStateArray;
+       this->fMachineModeArray = obj.fMachineModeArray;
+       this->fMaxTimeLHCValidity = obj.fMaxTimeLHCValidity;
        return *this;
 }
 
@@ -239,40 +251,41 @@ AliGRPObject::~AliGRPObject() {
 
        
        delete [] fHallProbes;
-       delete [] fLHCLuminosity;
-       delete [] fBeamIntensity;
        delete [] fL3Current;
        delete [] fDipoleCurrent;
        delete [] fCavernTemperature;
 
-       if (fLHCLuminositySplineFit){
-               delete fLHCLuminositySplineFit;
-               fLHCLuminositySplineFit = 0x0;
-       }
-       if (fBeamIntensitySplineFit){
-               delete fBeamIntensitySplineFit;
-               fBeamIntensitySplineFit = 0x0;
-       }
        if (fCavernAtmosPressure){
                delete fCavernAtmosPressure;
                fCavernAtmosPressure = 0x0;
        }
+       if (fCavernAtmosPressure2){
+               delete fCavernAtmosPressure2;
+               fCavernAtmosPressure2 = 0x0;
+       }
        if (fSurfaceAtmosPressure){
                delete fSurfaceAtmosPressure;
                fSurfaceAtmosPressure = 0x0;
        }
+       if (fLHCStateArray){
+               delete fLHCStateArray;
+               fLHCStateArray = 0x0;
+       }
+       if (fMachineModeArray){
+               delete fMachineModeArray;
+               fMachineModeArray = 0x0;
+       }
 }
 
 //-----------------------------------------------------------------------------
-
-Float_t* AliGRPObject::GetHallProbes(DP_HallProbes hp) {
+Float_t* AliGRPObject::GetHallProbesArray(DP_HallProbes hp) const {
 
        //
        // method to return array of statistical
         // variables for Hall Probe hp
        //
 
-       Float_t * array = new Float_t[fPoints];
+       Float_t* array = new Float_t[fPoints];
        Int_t shift = fPoints*(Int_t)hp; 
        for (Int_t i=0;i<fPoints; i++){
 
@@ -282,10 +295,9 @@ Float_t* AliGRPObject::GetHallProbes(DP_HallProbes hp) {
 
        return array;
 }
-
 //-------------------------------------------------------------------------------
 
-void AliGRPObject::SetHallProbes(DP_HallProbes hp, Float_t* hall_probe){
+void AliGRPObject::SetHallProbes(DP_HallProbes hp, const Float_t* hall_probe){
 
        //
        // method to set hall probe hp 
@@ -302,7 +314,7 @@ void AliGRPObject::SetHallProbes(DP_HallProbes hp, Float_t* hall_probe){
 
 //-------------------------------------------------------------------------------
 
-void AliGRPObject::ReadValuesFromMap(TMap* mapGRP){
+void AliGRPObject::ReadValuesFromMap(const TMap* mapGRP){
 
        //
        // method to set the values of the GRP parameters 
@@ -325,7 +337,9 @@ void AliGRPObject::ReadValuesFromMap(TMap* mapGRP){
        }
 
        if(mapGRP->GetValue("fAliceBeamEnergy")){
-               SetBeamEnergy((((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof());
+         double be = (((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof();
+         if (IsBeamEnergyIsSqrtSHalfGeV()) be/=2;   // old format was storig sqrt(s)
+         SetBeamEnergy(be);
        }
        else { 
                AliError(Form("No fAliceBeamEnergy value found in GRP map!"));
@@ -367,15 +381,13 @@ void AliGRPObject::ReadValuesFromMap(TMap* mapGRP){
                AliError(Form("No fLHCState value found in GRP map!"));
        }
        if(mapGRP->GetValue("fLHCluminosity")){
-               AliInfo(Form("fLHCLuminosity found, but porting only average to the new object, since the other values are not available in the old object"));
-               SetLHCLuminosity((Float_t)(((TObjString*)(mapGRP->GetValue("fLHCLuminosity")))->GetString()).Atof(),(Stats)0);
+               AliInfo(Form("fLHCLuminosity found, but not there anymore in the new object"));
        }       
        else { 
                AliError(Form("No fLHCLuminosity value found in GRP map!"));
        }
        if(mapGRP->GetValue("fBeamIntensity")){
-               AliInfo(Form("fBeamIntensity found, but porting only average to the new object, since the other values are not available in the old object"));
-               SetBeamIntensity((Float_t)(((TObjString*)(mapGRP->GetValue("fBeamIntensity")))->GetString()).Atof(),(Stats)0);
+               AliInfo(Form("fBeamIntensity found, but not there anymore in the new object"));
        }       
        else { 
                AliError(Form("No fBeamIntensity value found in GRP map!"));
@@ -413,14 +425,6 @@ void AliGRPObject::ReadValuesFromMap(TMap* mapGRP){
        else { 
                AliError(Form("No fCavernTemperature value found in GRP map!"));
        }
-       /*
-       if(mapGRP->GetValue("fCavernAtmosPressure")){
-               SetCavernAtmosPressure((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernAtmosPressure")))->GetString()).Atof(),(Stats)0);
-       }       
-       else { 
-               AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
-       }
-       */
        if(mapGRP->GetValue("fCavernAtmosPressure")){
                AliInfo(Form("fCavernAtmosPressure found, but not ported to the new object since of a different type"));
        }