New format of the GRP object (Chiara)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Sep 2008 11:00:13 +0000 (11:00 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Sep 2008 11:00:13 +0000 (11:00 +0000)
12 files changed:
STEER/AliESDTagCreator.cxx
STEER/AliESDTagCreator.h
STEER/AliGRPObject.cxx [new file with mode: 0644]
STEER/AliGRPObject.h [new file with mode: 0644]
STEER/AliGRPPreprocessor.cxx
STEER/AliGRPPreprocessor.h
STEER/AliQAChecker.cxx
STEER/AliReconstruction.cxx
STEER/AliReconstruction.h
STEER/AliSimulation.cxx
STEER/STEERLinkDef.h
STEER/libSTEER.pkg

index 030655f140ac3d83b5f665d10f6ee985a7cb2034..23c04c796f21a74f25a3d7358cdeefb7fee9866c 100644 (file)
@@ -43,6 +43,7 @@
 #include "AliESDEvent.h"
 #include "AliESDVertex.h"
 #include "AliLog.h"
+#include "AliGRPObject.h"
 
 #include "AliESDTagCreator.h"
 
@@ -1163,29 +1164,20 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
 }
 
 //_____________________________________________________________________________
-void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *grpData) {
+void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, AliGRPObject *grpData) {
   //GRP
   Float_t lhcLuminosity = 0.0;
   TString lhcState = "test";
-  UInt_t detectorMask = 0;
+  //UInt_t detectorMask = 0;
+  Int_t detectorMask = 0;
 
-  TObjString *s = new TObjString;
-  s = (TObjString *)grpData->GetValue("fDetectorMask");
-  detectorMask = atoi(s->GetString().Data());
-  
-  s = (TObjString *)grpData->GetValue("fAliceStartTime");
-  Float_t startTime = atof(s->GetString().Data());
+  detectorMask = grpData->GetDetectorMask();
+  time_t startTime = grpData->GetTimeStart();
   TTimeStamp *t1 = new TTimeStamp(startTime);
-
-  s = (TObjString *)grpData->GetValue("fAliceStopTime");
-  Float_t stopTime = atof(s->GetString().Data());
-  TTimeStamp *t2 = new TTimeStamp(stopTime);
-
-  s = (TObjString *)grpData->GetValue("fAliceBeamType");
-  const char* beamtype = s->GetString().Data();
-
-  s = (TObjString *)grpData->GetValue("fAliceBeamEnergy");
-  Float_t beamenergy = atof(s->GetString().Data());
+  time_t endTime = grpData->GetTimeEnd();
+  TTimeStamp *t2 = new TTimeStamp(endTime);
+  const char* beamtype = grpData->GetBeamType();
+  Float_t beamenergy = grpData->GetBeamEnergy();
 
 
   /////////////
index 9778235aaadf340ac8a775aa1700340cff1e8175..75af4fd9f6a717a5237d80b7cde921a354b76f0c 100644 (file)
@@ -34,6 +34,7 @@ class TMap;
 class TFile;
 class TGridResult;
 
+class AliGRPObject;
 
 //___________________________________________________________________________
 class AliESDTagCreator : public AliTagCreator {
@@ -42,7 +43,7 @@ class AliESDTagCreator : public AliTagCreator {
   AliESDTagCreator();
   ~AliESDTagCreator(); 
 
-  void CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *grpData);
+  void CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, AliGRPObject *grpData);
 
   void SetInactiveBranches(const char* branches) {fBranches = branches;}
 
diff --git a/STEER/AliGRPObject.cxx b/STEER/AliGRPObject.cxx
new file mode 100644 (file)
index 0000000..d2e7a31
--- /dev/null
@@ -0,0 +1,439 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $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 "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 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] = {
+                  "L3_BSF17_H1",
+                  "L3_BSF17_H2",
+                  "L3_BSF17_H3",
+                  "L3_BSF17_Temperature",
+                  "L3_BSF4_H1",
+                  "L3_BSF4_H2",
+                  "L3_BSF4_H3",
+                  "L3_BSF4_Temperature",
+                  "L3_BKF17_H1",
+                  "L3_BKF17_H2",
+                  "L3_BKF17_H3",
+                  "L3_BKF17_Temperature",
+                  "L3_BKF4_H1",
+                  "L3_BKF4_H2",
+                  "L3_BKF4_H3",
+                  "L3_BKF4_Temperature",
+                  "L3_BSF13_H1",
+                  "L3_BSF13_H2",
+                  "L3_BSF13_H3",
+                  "L3_BSF13_Temperature",
+                  "L3_BSF8_H1",
+                  "L3_BSF8_H2",
+                  "L3_BSF8_H3",
+                  "L3_BSF8_Temperature",
+                  "L3_BKF13_H1",
+                  "L3_BKF13_H2",
+                  "L3_BKF13_H3",
+                  "L3_BKF13_Temperature",
+                  "L3_BKF8_H1",
+                  "L3_BKF8_H2",
+                  "L3_BKF8_H3",
+                  "L3_BKF8_Temperature",
+                  "Dipole_Inside_H1",
+                  "Dipole_Inside_H2",
+                  "Dipole_Inside_H3",
+                  "Dipole_Inside_Temperature",
+                  "Dipole_Outside_H1",
+                  "Dipole_Outside_H2",
+                  "Dipole_Outside_H3",
+                  "Dipole_Outside_Temperature",
+                 };
+
+//-----------------------------------------------------------------------------
+AliGRPObject::AliGRPObject():
+       TObject(),
+       fPoints(5),
+       fDimension(0),
+       fTimeStart((time_t)fgkInvalidFloat),
+       fTimeEnd((time_t)fgkInvalidFloat),
+       fBeamEnergy(fgkInvalidFloat),
+       fBeamType(fgkInvalidString),
+       fNumberOfDetectors(fgkInvalidChar),
+       fDetectorMask(fgkInvalidUInt),
+       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),
+       fSurfaceAtmosPressure(0x0),
+       fHallProbes(0x0)
+{
+
+       //
+       // AliGRPObject default ctor
+       //
+
+       fDimension = fgknDCSDP_HallProbes*fPoints;
+       fHallProbes = new Float_t[fDimension];
+
+       for (Int_t nhp=0; nhp< fDimension; nhp++){
+               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(),
+       fPoints(obj.fPoints),
+       fDimension(obj.fDimension),
+       fTimeStart(obj.fTimeStart),
+       fTimeEnd(obj.fTimeEnd),
+       fBeamEnergy(obj.fBeamEnergy),
+       fBeamType(obj.fBeamType),
+       fNumberOfDetectors(obj.fNumberOfDetectors),
+       fDetectorMask(obj.fDetectorMask),
+       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),
+       fSurfaceAtmosPressure(obj.fSurfaceAtmosPressure),
+       fHallProbes(0x0)
+
+{
+
+       //
+       // AliGRPObject copy ctor
+       //
+
+       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];
+       }
+}
+
+//-----------------------------------------------------------------------------
+
+AliGRPObject& AliGRPObject:: operator=(const AliGRPObject & obj) 
+{
+
+       //
+       // AliGRPObject assignment operator
+       //
+
+       this->fTimeStart = obj.GetTimeStart();
+       this->fTimeEnd = obj.GetTimeEnd();
+       this->fBeamEnergy = obj.GetBeamEnergy();
+       this->fBeamType = obj.GetBeamType();
+       this->fNumberOfDetectors = obj.GetNumberOfDetectors();
+       this->fDetectorMask = obj.GetDetectorMask();
+       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->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];
+       
+       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);
+       }
+
+       return *this;
+}
+
+//-----------------------------------------------------------------------------
+
+AliGRPObject::~AliGRPObject() {
+
+       //
+       // dtor
+       //
+
+       
+       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 (fSurfaceAtmosPressure){
+               delete fSurfaceAtmosPressure;
+               fSurfaceAtmosPressure = 0x0;
+       }
+}
+
+//-----------------------------------------------------------------------------
+
+Float_t* AliGRPObject::GetHallProbes(DP_HallProbes hp) {
+
+       //
+       // method to return array of statistical
+        // variables for Hall Probe hp
+       //
+
+       Float_t * array = new Float_t[fPoints];
+       Int_t shift = fPoints*(Int_t)hp; 
+       for (Int_t i=0;i<fPoints; i++){
+
+               array[i] = fHallProbes[shift+i];
+
+       }
+
+       return array;
+}
+
+//-------------------------------------------------------------------------------
+
+void AliGRPObject::SetHallProbes(DP_HallProbes hp, Float_t* hall_probe){
+
+       //
+       // method to set hall probe hp 
+       // from a given array
+       //
+
+       Int_t shift = fPoints*hp;
+       for (Int_t i = 0; i< fPoints; i++){
+
+               fHallProbes[i+shift] =  hall_probe[i];
+       }
+       return;
+}
+
+//-------------------------------------------------------------------------------
+
+void AliGRPObject::ReadValuesFromMap(TMap* mapGRP){
+
+       //
+       // method to set the values of the GRP parameters 
+       // reading them from the old format of the GRP 
+       // object, i.e. a TMap
+       //
+
+       if (mapGRP->GetValue("fAliceStartTime")){
+               SetTimeStart((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStartTime")))->GetString()).Atoi());
+       }
+       else {
+               AliError(Form("No fAliceStartTime value found in GRP map!"));
+       }
+       if (mapGRP->GetValue("fAliceStopTime")){
+               SetTimeEnd((time_t)(((TObjString*)(mapGRP->GetValue("fAliceStopTime")))->GetString()).Atoi());
+       }
+       
+       else { 
+               AliError(Form("No fAliceStopTime value found in GRP map!"));
+       }
+
+       if(mapGRP->GetValue("fAliceBeamEnergy")){
+               SetBeamEnergy((((TObjString*)(mapGRP->GetValue("fAliceBeamEnergy")))->GetString()).Atof());
+       }
+       else { 
+               AliError(Form("No fAliceBeamEnergy value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fAliceBeamType")){
+               SetBeamType(((TObjString*)(mapGRP->GetValue("fAliceBeamType")))->GetString());
+       }
+       else { 
+               AliError(Form("No fAliceBeamType value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fNumberOfDetectors")){
+               SetNumberOfDetectors((Char_t)(((TObjString*)(mapGRP->GetValue("fNumberOfDetectors")))->GetString()).Atoi()); 
+       }
+       else { 
+               AliError(Form("No fNumberOfDetectors value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fDetectorMask")){
+               SetDetectorMask((UInt_t)(((TObjString*)(mapGRP->GetValue("fDetectorMask")))->GetString()).Atoi());  
+       }
+       else { 
+               AliError(Form("No fDetectorMask value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fLHCPeriod")){
+               SetLHCPeriod(((TObjString*)(mapGRP->GetValue("fLHCPeriod")))->GetString());
+       }
+       else { 
+               AliError(Form("No fLHCPeriod value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fRunType")){
+               SetRunType(((TObjString*)(mapGRP->GetValue("fRunType")))->GetString());
+       }
+       else { 
+               AliError(Form("No fRunType value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fLHCState")){
+               SetLHCState(((TObjString*)(mapGRP->GetValue("fLHCState")))->GetString());
+       }
+       else { 
+               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);
+       }       
+       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);
+       }       
+       else { 
+               AliError(Form("No fBeamIntensity value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fL3Polarity")){
+               SetL3Polarity((Char_t)(((TObjString*)(mapGRP->GetValue("fL3Polarity")))->GetString()).Atoi());
+       }       
+       else { 
+               AliError(Form("No fL3Polarity value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fDipolePolarity")){
+               SetDipolePolarity((Char_t)(((TObjString*)(mapGRP->GetValue("fDipolePolarity")))->GetString()).Atoi());  
+       }       
+       else { 
+               AliError(Form("No fDipolePolarity value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fL3Current")){
+               AliInfo(Form("fL3Current found, but porting only average to the new object, since the other values are not available in the old object"));
+               SetL3Current((Float_t)(((TObjString*)(mapGRP->GetValue("fL3Current")))->GetString()).Atof(),(Stats)0);
+       }       
+       else { 
+               AliError(Form("No fL3Current value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fDipoleCurrent")){
+               AliInfo(Form("fDipoleCurrent found, but porting only average to the new object, since the other values are not available in the old object"));
+               SetDipoleCurrent((Float_t)(((TObjString*)(mapGRP->GetValue("fDipoleCurrent")))->GetString()).Atof(),(Stats)0);
+       }       
+       else { 
+               AliError(Form("No fDipoleCurrent value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fCavernTemperature")){
+               AliInfo(Form("fCaverntemperature found, but porting only average to the new object, since the other values are not available in the old object"));
+               SetCavernTemperature((Float_t)(((TObjString*)(mapGRP->GetValue("fCavernTemperature")))->GetString()).Atof(),(Stats)0);
+       }       
+       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"));
+       }       
+       else { 
+               AliError(Form("No fCavernAtmosPressure value found in GRP map!"));
+       }
+       if(mapGRP->GetValue("fP2Pressure")){
+               SetSurfaceAtmosPressure((AliDCSSensor*)((TObjString*)(mapGRP->GetValue("fP2Pressure"))));
+       }
+       else { 
+               AliError(Form("No fP2Pressure value found in GRP map!"));
+       }
+       
+       return;
+
+}
diff --git a/STEER/AliGRPObject.h b/STEER/AliGRPObject.h
new file mode 100644 (file)
index 0000000..fd2175d
--- /dev/null
@@ -0,0 +1,190 @@
+#ifndef AliGRPOBJECT_H
+#define AliGRPOBJECT_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include <TMap.h>
+
+#include "AliDCSSensor.h"
+#include "AliSplineFit.h"
+#include "AliLog.h"
+
+class AliGRPObject : public TObject {
+ public:
+
+       enum Stats {kMean = 0, kTruncMedian = 1, kMedian = 2, kSDMean = 3, kSDMedian = 4};
+
+       enum DP_HallProbes { 
+                k_HP_L3_BSF17_H1= 0 , k_HP_L3_BSF17_H2, k_HP_L3_BSF17_H3, k_HP_L3_BSF17_Temperature, 
+                k_HP_L3_BSF4_H1, k_HP_L3_BSF4_H2, k_HP_L3_BSF4_H3, k_HP_L3_BSF4_Temperature, 
+                k_HP_L3_BKF17_H1, k_HP_L3_BKF17_H2, k_HP_L3_BKF17_H3, k_HP_L3_BKF17_Temperature, 
+                k_HP_L3_BKF4_H1, k_HP_L3_BKF4_H2, k_HP_L3_BKF4_H3, k_HP_L3_BKF4_Temperature, 
+                k_HP_L3_BSF13_H1, k_HP_L3_BSF13_H2, k_HP_L3_BSF13_H3, k_HP_L3_BSF13_Temperature,
+                k_HP_L3_BSF8_H1, k_HP_L3_BSF8_H2, k_HP_L3_BSF8_H3, k_HP_L3_BSF8_Temperature,
+                k_HP_L3_BKF13_H1, k_HP_L3_BKF13_H2, k_HP_L3_BKF13_H3, k_HP_L3_BKF13_Temperature,
+                k_HP_L3_BKF8_H1, k_HP_L3_BKF8_H2, k_HP_L3_BKF8_H3, k_HP_L3_BKF8_Temperature,
+                k_HP_Dipole_Inside_H1, k_HP_Dipole_Inside_H2, k_HP_Dipole_Inside_H3, k_HP_Dipole_Inside_Temperature,
+                k_HP_Dipole_Outside_H1, k_HP_Dipole_Outside_H2, k_HP_Dipole_Outside_H3, k_HP_Dipole_Outside_Temperature};
+
+
+       AliGRPObject();
+       AliGRPObject(const AliGRPObject & obj);
+       AliGRPObject& operator=(const AliGRPObject & obj);
+       ~AliGRPObject();
+
+       // getters
+
+       time_t    GetTimeStart() const {return fTimeStart;}
+       time_t    GetTimeEnd() const {return fTimeEnd;}
+       Float_t   GetBeamEnergy() const {return fBeamEnergy;}
+       TString   GetBeamType() const {return fBeamType;}
+       Char_t    GetNumberOfDetectors() const {return fNumberOfDetectors;}
+       UInt_t     GetDetectorMask() const {return fDetectorMask;}
+       TString   GetLHCPeriod() const {return fLHCPeriod;}
+       TString   GetRunType() const {return fRunType;}
+       TString   GetLHCState() const {return fLHCState;}
+       Float_t*  GetLHCLuminosity() {return fLHCLuminosity;}
+       Float_t   GetLHCLuminosity(Stats stat) const {return fLHCLuminosity[stat];}
+       AliSplineFit*  GetLHCLuminositySplineFit() const {return fLHCLuminositySplineFit;}
+       Float_t*  GetBeamIntensity() {return fBeamIntensity;}
+       Float_t   GetBeamIntensity(Stats stat) const {return fBeamIntensity[stat];}
+       AliSplineFit*  GetBeamIntensitySplineFit() const {return fBeamIntensitySplineFit;}
+       Char_t    GetL3Polarity() const {return fL3Polarity;}
+       Char_t    GetDipolePolarity() const {return fDipolePolarity;}
+       Float_t*  GetL3Current() {return fL3Current;}
+       Float_t   GetL3Current(Stats stat) const {return fL3Current[stat];}
+       Float_t*  GetDipoleCurrent() {return fDipoleCurrent;}
+       Float_t   GetDipoleCurrent(Stats stat) const {return fDipoleCurrent[stat];}
+       Float_t*  GetCavernTemperature() {return fCavernTemperature;}
+       Float_t   GetCavernTemperature(Stats stat) const {return fCavernTemperature[stat];}
+       //      Float_t*  GetCavernAtmosPressure() {return fCavernAtmosPressure;}
+       //Float_t   GetCavernAtmosPressure(Stats stat) const {return fCavernAtmosPressure[stat];}
+       AliDCSSensor*   GetCavernAtmosPressure() const {return fCavernAtmosPressure;}
+       AliDCSSensor*   GetSurfaceAtmosPressure() const {return fSurfaceAtmosPressure;}
+
+       Float_t*  GetHallProbes(DP_HallProbes hp);
+       Float_t   GetHallProbes(Int_t hp) const {return fHallProbes[hp];}
+       Float_t   GetHallProbes(DP_HallProbes hp, Stats stat) const {return fHallProbes[hp*fPoints+stat];}
+
+       Int_t    GetPoints() const {return fPoints;}
+       Int_t    GetDimension() const {return fDimension;}
+
+       // setters
+
+       void SetTimeStart(time_t timeStart)  {fTimeStart = timeStart;}
+       void SetTimeEnd(time_t timeEnd)  {fTimeEnd = timeEnd;}
+       void SetBeamEnergy(Float_t beamEnergy)  {fBeamEnergy = beamEnergy;}
+       void SetBeamType(TString beamType)  {fBeamType = beamType;}
+       void SetNumberOfDetectors(Char_t numberOfDetectors)  {fNumberOfDetectors = numberOfDetectors;}
+       void SetDetectorMask(UInt_t detectorMask)  {fDetectorMask = detectorMask;}
+       void SetLHCPeriod(TString lhcPeriod)  {fLHCPeriod = lhcPeriod;}
+       void SetRunType(TString runType)  {fRunType = runType;}
+       void SetLHCState(TString lhcState)  {fLHCState = lhcState;}
+       void SetLHCLuminosity(Float_t* lhcLuminosity)  {
+               for (Int_t i = 0;i<fPoints;i++) fLHCLuminosity[i] = lhcLuminosity[i];
+       }
+       void SetLHCLuminosity(Float_t lhcLuminosity, Stats stat)  {fLHCLuminosity[stat] = lhcLuminosity;}
+       void SetLHCLuminositySplineFit(AliSplineFit* lhcLuminositySplineFit)  {fLHCLuminositySplineFit = lhcLuminositySplineFit;}
+       void SetBeamIntensity(Float_t* beamIntensity)  {
+               for (Int_t i = 0;i<fPoints;i++) fBeamIntensity[i] = beamIntensity[i];
+       }
+       void SetBeamIntensity(Float_t beamIntensity, Stats stat)  {fBeamIntensity[stat] = beamIntensity;}
+       void SetBeamIntensitySplineFit(AliSplineFit* beamIntensitySplineFit)  {fBeamIntensitySplineFit = beamIntensitySplineFit;}
+       void SetL3Polarity(Char_t l3Polarity)  {fL3Polarity = l3Polarity;}
+       void SetDipolePolarity(Char_t dipolePolarity)  {fDipolePolarity = dipolePolarity;}
+       void SetL3Current(Float_t* l3Current)  {
+               for (Int_t i = 0;i<fPoints;i++) fL3Current[i] = l3Current[i];
+       }
+       void SetL3Current(Float_t l3Current, Stats stat)  {fL3Current[stat] = l3Current;}
+       void SetDipoleCurrent(Float_t* dipoleCurrent) {
+               for (Int_t i = 0;i<fPoints;i++) fDipoleCurrent[i] = dipoleCurrent[i];
+       }
+       void SetDipoleCurrent(Float_t dipoleCurrent, Stats stat)  {fDipoleCurrent[stat] = dipoleCurrent;}
+       void SetCavernTemperature(Float_t* cavernTemperature)  {
+               for (Int_t i = 0;i<fPoints;i++) fCavernTemperature[i] = cavernTemperature[i];
+       }
+       void SetCavernTemperature(Float_t cavernTemperature, Stats stat)  {fCavernTemperature[stat] = cavernTemperature;}
+       //      void SetCavernAtmosPressure(Float_t* cavernAtmosPressure)  {
+       //              for (Int_t i = 0;i<fPoints;i++) fCavernAtmosPressure[i] = cavernAtmosPressure[i];
+       //}
+//     void SetCavernAtmosPressure(Float_t cavernAtmosPressure, Stats stat)  {fCavernAtmosPressure[stat] = cavernAtmosPressure;}
+       void SetCavernAtmosPressure(AliDCSSensor* cavernAtmosPressure)  {fCavernAtmosPressure = cavernAtmosPressure;}
+       void SetSurfaceAtmosPressure(AliDCSSensor* surfacePressure)  {fSurfaceAtmosPressure = surfacePressure;}
+
+       void SetHallProbes(DP_HallProbes hp, Float_t hall_probe, Stats stat)  {fHallProbes[hp*fPoints+stat] = hall_probe;}
+       void SetHallProbes(Float_t *hall_probe){
+               for (Int_t i = 0; i< fDimension; i++) fHallProbes[i] =  hall_probe[i];}
+
+       void SetHallProbes(DP_HallProbes hp, Float_t* hall_probe);  
+       void SetPoints(Int_t points) {fPoints = points;}
+       void SetDimension(Int_t dimension) {fDimension = dimension;}
+
+       // getters for "invalid" flags
+
+       static Float_t GetInvalidFloat() {return fgkInvalidFloat;}
+       static TString GetInvalidString() {return fgkInvalidString;}
+       static Int_t GetInvalidInt() {return fgkInvalidInt;}
+       static Int_t GetInvalidUInt() {return fgkInvalidUInt;}
+       static Char_t GetInvalidChar() {return fgkInvalidChar;}
+       static Int_t GetNumberOfHP() {return fgknDCSDP_HallProbes;}
+       static const char* GetHPDP(Int_t indexHP) {return fgkDCSDataPoints_HallProbes[indexHP];}
+
+       // to read old GRP object in TMap format
+
+       void ReadValuesFromMap(TMap* map);      
+
+ private:
+
+       static const Float_t fgkInvalidFloat;   // value to identify invalid data - float
+       static const TString fgkInvalidString;  // value to identify invalid data - string
+       static const Char_t fgkInvalidChar;     // value to identify invalid data - char
+       static const Int_t fgkInvalidInt;       // value to identify invalid data - int
+       static const Int_t fgkInvalidUInt;       // value to identify invalid data - uint
+       static const Int_t   fgknDCSDP_HallProbes;               //! number of dcs dps
+       static const char*   fgkDCSDataPoints_HallProbes[];      //! names of dcs dps
+
+       Int_t fPoints;                    // number of statistical quantities to be stored
+       Int_t fDimension;                 // dimension of Hall Probes array
+
+       time_t   fTimeStart;              // DAQ_time_start entry from DAQ logbook
+       time_t   fTimeEnd;                // DAQ_time_end entry from DAQ logbook
+       Float_t  fBeamEnergy;             // beamEnergy entry from DAQ logbook
+       TString  fBeamType;               // beamType entry from DAQ logbook
+       Char_t   fNumberOfDetectors;      // numberOfDetectors entry from DAQ logbook
+       UInt_t   fDetectorMask;           // detectorMask entry from DAQ logbook
+       TString  fLHCPeriod;              // LHCperiod entry from DAQ logbook 
+       TString  fRunType;                // RunType entry from DAQ logbook 
+       TString  fLHCState;               // LHCState entry from DCS DB
+       Float_t*  fLHCLuminosity;         // [fPoints]
+                                         // LHCLuminosity entry from DCS DB
+       AliSplineFit*  fLHCLuminositySplineFit;       // LHCLuminosity SplineFit from DCS DB
+       Float_t*  fBeamIntensity   ;      // [fPoints]
+                                         // BeamIntensity entry from DCS DB
+       AliSplineFit*  fBeamIntensitySplineFit;       // BeamIntensity SplineFit from DCS DB
+       Char_t    fL3Polarity;             // L3Polarity entry from DCS DB
+       Char_t    fDipolePolarity;         // [fPoints]
+                                         // DipolePolarity entry from DCS DB
+       Float_t*  fL3Current;             // [fPoints]
+                                         // L3Current entry from DCS DB
+       Float_t*  fDipoleCurrent;         // [fPoints]
+                                          // DipoleCurrent entry from DCS DB
+       Float_t*  fCavernTemperature;     // [fPoints]
+                                          // CavernTemperature entry from DCS DB
+       //      Float_t*  fCavernAtmosPressure;   // [fPoints]
+                                          // CavernAtmosPressure entry from DCS DB
+       AliDCSSensor*  fCavernAtmosPressure;    // CavernAtmosPressure entry from DCS DB
+       AliDCSSensor*  fSurfaceAtmosPressure;   // SurfaceAtmosPressure entry from DCS DB
+
+       // Hall Probes
+
+       Float_t* fHallProbes;       //[fDimension] 
+                                   // array containg the values for the Hall Probes
+
+       ClassDef(AliGRPObject,1)
+
+};
+
+#endif
index 545886a05e12e118419428d04be3e7c60e183f03..14b338141049f8f511bf3b45ba419cc3d4dec075 100644 (file)
 #include <TTimeStamp.h>
 #include <TSystem.h>
 #include <TFile.h>
+#include <TParameter.h>
+#include <TGraph.h>
 
 #include "AliGRPPreprocessor.h"
 #include "AliGRPDCS.h"
+#include "AliGRPObject.h"
+#include "AliDCSSensor.h"
+#include "AliSplineFit.h"
 #include "AliDCSSensorArray.h"
 
 #include "AliTriggerConfiguration.h"
@@ -59,8 +64,10 @@ const Double_t kFitFraction = 0.7;                 // Fraction of DCS sensor fit
 ClassImp(AliGRPPreprocessor)
 
 //_______________________________________________________________
+
   const Int_t AliGRPPreprocessor::fgknDAQLbPar = 8; // num parameters in the logbook
-  const Int_t AliGRPPreprocessor::fgknDCSDP = 10;   // number of dcs dps
+  const Int_t AliGRPPreprocessor::fgknDCSDP = 50;   // number of dcs dps
+  const Int_t AliGRPPreprocessor::fgknDCSDP_HallProbes = 40;   // number of dcs dps
   const char* AliGRPPreprocessor::fgkDCSDataPoints[AliGRPPreprocessor::fgknDCSDP] = {
                    "LHCState",              // missing in DCS
                    "L3Polarity",
@@ -69,13 +76,96 @@ ClassImp(AliGRPPreprocessor)
                    "BeamIntensity",         // missing in DCS
                    "L3Current",
                    "DipoleCurrent",
+                  "L3_BSF17_H1",
+                  "L3_BSF17_H2",
+                  "L3_BSF17_H3",
+                  "L3_BSF17_Temperature",
+                  "L3_BSF4_H1",
+                  "L3_BSF4_H2",
+                  "L3_BSF4_H3",
+                  "L3_BSF4_Temperature",
+                  "L3_BKF17_H1",
+                  "L3_BKF17_H2",
+                  "L3_BKF17_H3",
+                  "L3_BKF17_Temperature",
+                  "L3_BKF4_H1",
+                  "L3_BKF4_H2",
+                  "L3_BKF4_H3",
+                  "L3_BKF4_Temperature",
+                  "L3_BSF13_H1",
+                  "L3_BSF13_H2",
+                  "L3_BSF13_H3",
+                  "L3_BSF13_Temperature",
+                  "L3_BSF8_H1",
+                  "L3_BSF8_H2",
+                  "L3_BSF8_H3",
+                  "L3_BSF8_Temperature",
+                  "L3_BKF13_H1",
+                  "L3_BKF13_H2",
+                  "L3_BKF13_H3",
+                  "L3_BKF13_Temperature",
+                  "L3_BKF8_H1",
+                  "L3_BKF8_H2",
+                  "L3_BKF8_H3",
+                  "L3_BKF8_Temperature",
+                  "Dipole_Inside_H1",
+                  "Dipole_Inside_H2",
+                  "Dipole_Inside_H3",
+                  "Dipole_Inside_Temperature",
+                  "Dipole_Outside_H1",
+                  "Dipole_Outside_H2",
+                  "Dipole_Outside_H3",
+                  "Dipole_Outside_Temperature",
                    "CavernTemperature",
                    "CavernAtmosPressure",
                    "SurfaceAtmosPressure"
                  };
+
+  const char* AliGRPPreprocessor::fgkDCSDataPoints_HallProbes[AliGRPPreprocessor::fgknDCSDP_HallProbes] = {
+                  "L3_BSF17_H1",
+                  "L3_BSF17_H2",
+                  "L3_BSF17_H3",
+                  "L3_BSF17_Temperature",
+                  "L3_BSF4_H1",
+                  "L3_BSF4_H2",
+                  "L3_BSF4_H3",
+                  "L3_BSF4_Temperature",
+                  "L3_BKF17_H1",
+                  "L3_BKF17_H2",
+                  "L3_BKF17_H3",
+                  "L3_BKF17_Temperature",
+                  "L3_BKF4_H1",
+                  "L3_BKF4_H2",
+                  "L3_BKF4_H3",
+                  "L3_BKF4_Temperature",
+                  "L3_BSF13_H1",
+                  "L3_BSF13_H2",
+                  "L3_BSF13_H3",
+                  "L3_BSF13_Temperature",
+                  "L3_BSF8_H1",
+                  "L3_BSF8_H2",
+                  "L3_BSF8_H3",
+                  "L3_BSF8_Temperature",
+                  "L3_BKF13_H1",
+                  "L3_BKF13_H2",
+                  "L3_BKF13_H3",
+                  "L3_BKF13_Temperature",
+                  "L3_BKF8_H1",
+                  "L3_BKF8_H2",
+                  "L3_BKF8_H3",
+                  "L3_BKF8_Temperature",
+                  "Dipole_Inside_H1",
+                  "Dipole_Inside_H2",
+                  "Dipole_Inside_H3",
+                  "Dipole_Inside_Temperature",
+                  "Dipole_Outside_H1",
+                  "Dipole_Outside_H2",
+                  "Dipole_Outside_H3",
+                  "Dipole_Outside_Temperature",
+                 };
                  
-  const Short_t kSensors = 9; // start index position of sensor in DCS DPs
-  const Short_t kNumSensors = 1; // Number of sensors in DCS DPs
+  const Short_t kSensors = 48; // start index position of sensor in DCS DPs
+  const Short_t kNumSensors = 2; // Number of sensors in DCS DPs
 
   const char* AliGRPPreprocessor::fgkLHCState[20] = {
                    "P", "PREPARE",
@@ -100,23 +190,26 @@ ClassImp(AliGRPPreprocessor)
   };
 
 //_______________________________________________________________
+
 AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
        AliPreprocessor("GRP",shuttle),  fPressure(0)
 {
-  // constructor - shuttle must be instantiated!
+       // constructor - shuttle must be instantiated!
 
-  AddRunType("PHYSICS");
+       AddRunType("PHYSICS");
 }
 
 //_______________________________________________________________
+
 AliGRPPreprocessor::~AliGRPPreprocessor()
 {
-  //destructor
-
-  delete fPressure;
+       //destructor
+       
+       delete fPressure;
 }
 
 //_______________________________________________________________
+
 void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
 {
   // Initialize preprocessor
@@ -136,821 +229,1123 @@ void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
 }
 
 //_______________________________________________________________
+
 UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
 {
-  // process data retrieved by the Shuttle
-  
-  //=================//
-  // DAQ logbook     //
-  //=================//
-  UInt_t error = 0;
-  
-  TMap *grpmap = ProcessDaqLB();
-  if( grpmap->GetEntries() == fgknDAQLbPar ) {
-    Log(Form("DAQ logbook, successful!"));
-  } else {
-    Log(Form("DAQ logbook, missing parameters!!!"));
-    error |= 1;
-  }
-  //=================//
-  // DAQ FXS         //
-  //=================//
-  UInt_t iDaqFxs = ProcessDaqFxs();
-  if( iDaqFxs == 0 ) {
-    Log(Form("DAQ FXS, successful!"));
-  } else {
-    Log(Form("DAQ FXS, could not store run raw tag file!!!"));
-    error |= 2;
-  }
-  
-  //=================//
-  // DCS FXS         //
-  //=================//
-  UInt_t iDcsFxs = ProcessDcsFxs();
-  if( iDcsFxs == 0 ) {
-     Log(Form("DCS FXS, successful!"));
-  } else {
-     Log(Form("DCS FXS, Could not store CTP run configuration and scalers!!!"));
-    error |= 4;
-  }
-  
-  //=================//
-  // DCS data points //
-  //=================//
-  Int_t entries = ProcessDcsDPs( valueMap, grpmap );
-  if( entries < fgknDCSDP-3 ) { // FIXME (!= ) LHState and pressure map are not working yet...
-    Log(Form("Problem with the DCS data points!!!"));
-    error |= 8;
-  } else  Log(Form("DCS data points, successful!"));
-
-  //=======================//
-  // Trigger Configuration //
-  //=======================//
-  // either from DAQ logbook.....
-  const char * triggerConf = GetTriggerConfiguration();
-  if (triggerConf!= NULL) {
-    Log("Found trigger configuration in DAQ logbook");
-    AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConf);         
-    if (!runcfg) {
-      Log("Bad CTP run configuration file from DAQ logbook! The corresponding CDB entry will not be filled!");
-      error |= 16;
-    }
-    else {
-      TString titleCTPcfg = Form("CTP cfg for run %i from DAQ",fRun);
-      runcfg->SetTitle(titleCTPcfg);
-      AliCDBMetaData metaData;
-      metaData.SetBeamPeriod(0);
-      metaData.SetResponsible("Roman Lietava");
-      metaData.SetComment("CTP run configuration from DAQ logbook");
-      if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
-        Log("Unable to store the CTP run configuration object to OCDB!");
-       error |= 16;
-      }
-    }
-  }
-  // ...or from DCS FXS
-  else{
-     Log("No trigger configuration found in the DAQ logbook!! Trying reading from DCS FXS...");
-     TString runcfgfile = GetFile(kDCS, "CTP_runconfig", "");
-     if (runcfgfile.IsNull()) {
-       Log("No CTP runconfig files has been found in DCS FXS!");
-       error |= 16;
-     }
-     else {
-       Log(Form("File with Id CTP_runconfig found! Copied to %s",runcfgfile.Data()));
-       AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
-       if (!runcfg) {
-         Log("Bad CTP run configuration file from DCS FXS! The corresponding CDB entry will not be filled!");
-         error |= 16;;
-       }
-       else {
-        TString titleCTPcfg = Form("CTP cfg for run %i from DCS",fRun);
-         runcfg->SetTitle(titleCTPcfg);
-         AliCDBMetaData metaData;
-         metaData.SetBeamPeriod(0);
-         metaData.SetResponsible("Roman Lietava");
-         metaData.SetComment("CTP run configuration from DCS FXS");
-         if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
-           Log("Unable to store the CTP run configuration object to OCDB!");
-           error |= 16;
-         }
-       }
-     }
-  }
-
-  grpmap->SetOwner(1);
-  AliInfo(Form("Final list entries: %d",grpmap->GetEntries()));
-  
-  AliCDBMetaData md;
-  md.SetResponsible("Ernesto Lopez Torres");
-  md.SetComment("Output parameters from the GRP preprocessor.");
-  
-  Bool_t result = Store("GRP", "Data", grpmap, &md);
-  
-  delete grpmap;
-  
-  if (result && !error ) {
-    Log("GRP Preprocessor Success");
-    return 0;
-  } else {
-    Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s",
-                                 kppError[(error&1)?1:0],
-                                 kppError[(error&2)?2:0],
-                                 kppError[(error&4)?3:0],
-                                kppError[(error&8)?4:0],
-                                 kppError[(error&16)?5:0]
-                                  ));
-    return error;
-  }
+       // process data retrieved by the Shuttle
+       
+       AliGRPObject *grpobj = new AliGRPObject();  // object to store data
+
+       //=================//
+       // DAQ logbook     //
+       //=================//
+       UInt_t error = 0;
+       
+       grpobj = ProcessDaqLB();
+
+       //=================//
+       // DAQ FXS         //
+       //=================//
+       UInt_t iDaqFxs = ProcessDaqFxs();
+       if( iDaqFxs == 0 ) {
+               Log(Form("DAQ FXS, successful!"));
+       } else {
+               Log(Form("DAQ FXS, could not store run raw tag file!!!"));
+               error |= 2;
+       }
+       
+       //=================//
+       // DCS FXS         //
+       //=================//
+       UInt_t iDcsFxs = ProcessDcsFxs();
+       if( iDcsFxs == 0 ) {
+               Log(Form("DCS FXS, successful!"));
+       } else {
+               Log(Form("DCS FXS, Could not store CTP run configuration and scalers!!!"));
+               error |= 4;
+       }
+       
+       //=================//
+       // DCS data points //
+       //=================//
+       Int_t entries = ProcessDcsDPs( valueMap, grpobj );
+       if( entries < fgknDCSDP-3 ) { // FIXME (!= ) LHState and pressure map are not working yet...
+               Log(Form("Problem with the DCS data points!!!"));
+               error |= 8;
+       } else  Log(Form("DCS data points, successful!"));
+       
+       //=======================//
+       // Trigger Configuration //
+       //=======================//
+       // either from DAQ logbook.....
+       const char * triggerConf = GetTriggerConfiguration();
+       if (triggerConf!= NULL) {
+               Log("Found trigger configuration in DAQ logbook");
+               AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConf);      
+               if (!runcfg) {
+                       Log("Bad CTP run configuration file from DAQ logbook! The corresponding CDB entry will not be filled!");
+                       error |= 16;
+               }
+               else {
+                       TString titleCTPcfg = Form("CTP cfg for run %i from DAQ",fRun);
+                       runcfg->SetTitle(titleCTPcfg);
+                       AliCDBMetaData metaData;
+                       metaData.SetBeamPeriod(0);
+                       metaData.SetResponsible("Roman Lietava");
+                       metaData.SetComment("CTP run configuration from DAQ logbook");
+                       if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
+                               Log("Unable to store the CTP run configuration object to OCDB!");
+                               error |= 16;
+                       }
+               }
+       }
+       /*  the DCS should not been used any more to access this stuff!!!
+       // ...or from DCS FXS
+       else{
+               Log("No trigger configuration found in the DAQ logbook!! Trying reading from DCS FXS...");
+               TString runcfgfile = GetFile(kDCS, "CTP_runconfig", "");
+               if (runcfgfile.IsNull()) {
+                       Log("No CTP runconfig files has been found in DCS FXS!");
+                       error |= 16;
+               }
+               else {
+                       Log(Form("File with Id CTP_runconfig found! Copied to %s",runcfgfile.Data()));
+                       AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
+                       if (!runcfg) {
+                               Log("Bad CTP run configuration file from DCS FXS! The corresponding CDB entry will not be filled!");
+                               error |= 16;;
+                       }
+                       else {
+                               TString titleCTPcfg = Form("CTP cfg for run %i from DCS",fRun);
+                               runcfg->SetTitle(titleCTPcfg);
+                               AliCDBMetaData metaData;
+                               metaData.SetBeamPeriod(0);
+                               metaData.SetResponsible("Roman Lietava");
+                               metaData.SetComment("CTP run configuration from DCS FXS");
+                               if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
+                                       Log("Unable to store the CTP run configuration object to OCDB!");
+                                       error |= 16;
+                               }
+                       }
+               }
+       }
+       */
+       AliCDBMetaData md;
+       md.SetResponsible("Ernesto Lopez Torres");
+       md.SetComment("Output parameters from the GRP preprocessor.");
+       
+       Bool_t result = kTRUE;
+       Log("Before storing");
+       result = Store("GRP", "Data", grpobj, &md); 
+       delete grpobj;
+       
+       if (result && !error ) {
+               Log("GRP Preprocessor Success");
+               return 0;
+       } else {
+               Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s",
+                         kppError[(error&1)?1:0],
+                         kppError[(error&2)?2:0],
+                         kppError[(error&4)?3:0],
+                         kppError[(error&8)?4:0],
+                         kppError[(error&16)?5:0]
+                         ));
+               return error;
+       }
 }
 
 //_______________________________________________________________
-TMap *AliGRPPreprocessor::ProcessDaqLB()
-{
-  //Getting the DAQ lb information
-  
-  const char* timeStart         = GetRunParameter("DAQ_time_start");
-  const char* timeEnd           = GetRunParameter("DAQ_time_end");
-  const char* beamEnergy        = GetRunParameter("beamEnergy");
-  const char* beamType          = GetRunParameter("beamType");
-  const char* numberOfDetectors = GetRunParameter("numberOfDetectors");
-  const char* detectorMask      = GetRunParameter("detectorMask");
-  const char* lhcPeriod         = GetRunParameter("LHCperiod");
-  
-  TMap *mapDAQ = new TMap();
-  
-  if (timeStart) {
-    Log(Form("Start time for run %d: %s",fRun, timeStart));
-  } else {
-    Log(Form("Start time not put in logbook!"));
-  }
-  mapDAQ->Add(new TObjString("fAliceStartTime"), new TObjString(timeStart));
 
-  if (timeEnd) {
-    Log(Form("End time for run %d: %s",fRun, timeEnd));
-  } else {
-    Log(Form("End time not put in logbook!"));
-  }
-  mapDAQ->Add(new TObjString("fAliceStopTime"), new TObjString(timeEnd));
+AliGRPObject* AliGRPPreprocessor::ProcessDaqLB()
+{
+       //Getting the DAQ lb information
+       
+       time_t timeStart         = (time_t)(((TString)GetRunParameter("DAQ_time_start")).Atoi());
+       time_t timeEnd         = (time_t)(((TString)GetRunParameter("DAQ_time_end")).Atoi());
+       Float_t beamEnergy         = (Float_t)(((TString)GetRunParameter("beamEnergy")).Atof());
+       TString beamType = (TString)GetRunParameter("beamType");
+       Char_t numberOfDetectors = (Char_t)(((TString)GetRunParameter("numberOfDetectors")).Atoi());
+       UInt_t  detectorMask= (UInt_t)(((TString)GetRunParameter("detectorMask")).Atoi());
+       TString lhcPeriod = (TString)GetRunParameter("LHCperiod");
+       TString runType = (TString)GetRunType();
+
+       AliGRPObject* grpObj = new AliGRPObject();
+
+       if (timeStart != 0){
+               grpObj->SetTimeStart(timeStart);
+               Log(Form("Start time for run %d: %d",fRun, (Int_t)timeStart));
+       } 
+       else {
+               Log(Form("Start time not put in logbook, setting to invalid in GRP entry!"));
+       }
+
+       if (timeEnd != 0){
+               grpObj->SetTimeEnd(timeEnd);
+               Log(Form("End time for run %d: %i",fRun, (Int_t)timeEnd));
+       } 
+       else {
+               Log(Form("End time not put in logbook, setting to invalid in GRP entry!"));
+       }
+
+       if (beamEnergy != 0){
+               grpObj->SetBeamEnergy(beamEnergy);
+               Log(Form("Beam Energy for run %d: %f",fRun, beamEnergy));
+       } 
+       else {
+               Log(Form("Beam Energy not put in logbook, setting to invalid in GRP entry!"));
+       }
+
+               Log(Form("Beam Type for run %d: %s",fRun, beamType.Data()));
+               
+       if (beamType.Length() != 0){
+               grpObj->SetBeamType(beamType);
+               Log(Form("Beam Type for run %d: %s",fRun, beamType.Data()));
+       } 
+       else {
+               Log(Form("Beam Type not put in logbook, setting to invalid in GRP entry!"));
+       }
+               
+       if (numberOfDetectors != 0){
+               grpObj->SetNumberOfDetectors(numberOfDetectors);
+               Log(Form("Number Of Detectors for run %d: %d",fRun, (Int_t)numberOfDetectors));
+       } 
+       else {
+               Log(Form("Number Of Detectors not put in logbook, setting to invalid in GRP entry!"));
+       }
+
+       if (detectorMask != 0){
+               grpObj->SetDetectorMask(detectorMask);
+               Log(Form("Detector Mask for run %d: %d",fRun, detectorMask));
+       } 
+       else {
+               Log(Form("Detector Mask not put in logbook, setting to invalid in GRP entry!"));
+       }
+
+       if (lhcPeriod.Length() != 0) {
+               grpObj->SetLHCPeriod(lhcPeriod);
+               Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod.Data()));
+       } else {
+               Log(Form("LHCperiod not put in logbook, setting to invalid in GRP entry!"));
+       }
+       if (runType.Length() != 0) {
+               grpObj->SetRunType(runType);
+               Log(Form("Run Type (DAQ) for run %d: %s",fRun, runType.Data()));
+       } else {
+               Log(Form("Run Type not put in logbook, setting to invalid in GRP entry!"));
+       }
+
+       return grpObj;
+}
 
-  if (beamEnergy) {
-    Log(Form("Beam energy for run %d: %s",fRun, beamEnergy));
-  } else {
-    Log(Form("Beam energy not put in logbook!"));
-  }
-  mapDAQ->Add(new TObjString("fAliceBeamEnergy"), new TObjString(beamEnergy));
+//_______________________________________________________________
 
-  if (beamType) {
-    Log(Form("Beam type for run %d: %s",fRun, beamType));
-  } else {
-    Log(Form("Beam type not put in logbook!"));
-  }
-  mapDAQ->Add(new TObjString("fAliceBeamType"), new TObjString(beamType));
+UInt_t AliGRPPreprocessor::ProcessDaqFxs()
+{
+       //======DAQ FXS======//
+       
+       TList* list = GetFileSources(kDAQ);  
+       if (!list) {
+               Log("No raw data tag list: connection problems with DAQ FXS logbook!");
+               return 1;
+       }
+       
+       if (list->GetEntries() == 0) {
+               Log("no raw data tags in this run: nothing to merge!");
+               delete  list; list=0;
+               return 0;
+       }
+       
+       TChain *fRawTagChain = new TChain("T");
+       Int_t nFiles=0;
+       TIterator* iter = list->MakeIterator();
+       TObject* obj = 0;
+       while ((obj = iter->Next())) {
+               TObjString* objStr = dynamic_cast<TObjString*> (obj);
+               if (objStr) {
+                       Log(Form("Found source %s", objStr->String().Data()));
+                       TList* list2 = GetFileIDs(kDAQ, objStr->String());
+                       if (!list2) {
+                               Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
+                               delete fRawTagChain; fRawTagChain=0;
+                               return 1;
+                       }
+                       Log(Form("Number of ids: %d",list2->GetEntries()));
+                       for(Int_t i = 0; i < list2->GetEntries(); i++) {
+                               TObjString *idStr = (TObjString *)list2->At(i);
+                               TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
+                               if (fileName.Length() > 0) {
+                                       Log(Form("Adding file in the chain: %s",fileName.Data()));
+                                       fRawTagChain->Add(fileName.Data());
+                                       nFiles++;
+                               } else {
+                                       Log(Form("Could not retrieve file with id %s from source %s: "
+                                                "connection problems with DAQ FXS!",
+                                                idStr->String().Data(), objStr->String().Data()));
+                                       delete list; list=0;
+                                       delete list2; list2=0;
+                                       delete fRawTagChain; fRawTagChain=0;
+                                       return 2;
+                               }
+                       }
+                       delete list2;
+               }
+       }
+       
+       TString fRawDataFileName = "GRP_Merged.tag.root";
+       Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
+       /* temporary, to speed up
+       if( fRawTagChain->Merge(fRawDataFileName) < 1 ) {
+               Log("Error merging raw data files!!!");
+               return 3;
+       }
+       */
+       TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
+       Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
+       
+       if (!result) {
+               Log("Problem storing raw data tags in local file!!!");
+       } else {
+               Log("Raw data tags merged successfully!!");
+       }
+       
+       delete iter;
+       delete list;
+       delete fRawTagChain; fRawTagChain=0;
+       
+       if (result == kFALSE) {
+               return 4;
+       }
+       
+       return 0;
+       
+}
 
-  if (numberOfDetectors) {
-    Log(Form("Number of active detectors for run %d: %s",fRun, numberOfDetectors));
-  } else {
-    Log(Form("Number of active detectors not put in logbook!"));
-  }
-  mapDAQ->Add(new TObjString("fNumberOfDetectors"), new TObjString(numberOfDetectors));
+//_______________________________________________________________
+UInt_t AliGRPPreprocessor::ProcessDcsFxs()
+{
+       {
+               // Get the CTP counters information
+               TList* list = GetFileSources(kDCS,"CTP_xcounters");  
+               if (!list) {
+                       Log("No CTP counters file: connection problems with DAQ FXS logbook!");
+                       return 1;
+               }
+               
+               if (list->GetEntries() == 0) {
+                       Log("No CTP counters file to be processed!");
+                       return 1;
+               }
+               else {
+                       TIter iter(list);
+                       TObjString *source;
+                       while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
+                               TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
+                               if (countersfile.IsNull()) {
+                                       Log("No CTP counters files has been found: empty source!");
+                               }
+                               else {
+                                       Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
+                                       AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
+                                       if (!scalers) {
+                                               Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
+                                               return 1;
+                                       }
+                                       else {
+                                               AliCDBMetaData metaData;
+                                               metaData.SetBeamPeriod(0);
+                                               metaData.SetResponsible("Roman Lietava");
+                                               metaData.SetComment("CTP scalers");
+                                               if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
+                                                       Log("Unable to store the CTP scalers object to OCDB!");
+                                               }
+                                       }
+                               }
+                       }
+               }
+               delete list;
+       }
+       
+       return 0;
+}
+//_______________________________________________________________
 
-  if (detectorMask) {
-    Log(Form("Detector mask for run %d: %s",fRun, detectorMask));
-  } else {
-    Log(Form("Detector mask not put in logbook!"));
-  }
-  mapDAQ->Add(new TObjString("fDetectorMask"), new TObjString(detectorMask));
+Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, AliGRPObject* grpObj)
+{
 
-  if (lhcPeriod) {
-    Log(Form("LHC period (DAQ) for run %d: %s",fRun, lhcPeriod));
-  } else {
-    Log(Form("LHCperiod not put in logbook!"));
-  }
-  mapDAQ->Add(new TObjString("fLHCPeriod"), new TObjString(lhcPeriod));
-  
-  mapDAQ->Add(new TObjString("fRunType"), new TObjString(GetRunType()));
-  Log( Form("Retrived %d parameters from logbook", mapDAQ->GetEntries() ) );
+       //
+       // processing DCS DPs
+       //
+
+       Int_t entries = 0;
+       Int_t nLHCEntries = 0;
+       Int_t nL3Entries = 0;
+       Int_t nDipoleEntries = 0;
+       Int_t nEnvEntries = 0;
+       Int_t nHallProbesEntries = 0;
+       nLHCEntries = ProcessLHCDPs(valueMap, grpObj);
+       nL3Entries = ProcessL3DPs(valueMap, grpObj);
+       nDipoleEntries = ProcessDipoleDPs(valueMap, grpObj);
+       nEnvEntries = ProcessEnvDPs(valueMap, grpObj);
+       nHallProbesEntries = ProcessHPDPs(valueMap, grpObj);
+
+       entries = nLHCEntries + nL3Entries + nDipoleEntries + nEnvEntries + nHallProbesEntries;
+       return entries;
 
-  return mapDAQ;
 }
 
 //_______________________________________________________________
-UInt_t AliGRPPreprocessor::ProcessDaqFxs()
-{
-  //======DAQ FXS======//
 
-  TList* list = GetFileSources(kDAQ);  
-  if (!list) {
-    Log("No raw data tag list: connection problems with DAQ FXS logbook!");
-    return 1;
-  }
+Int_t AliGRPPreprocessor::ProcessL3DPs(TMap* valueMap, AliGRPObject* grpObj)
+{
+       Int_t nL3Entries = 0;
+       TObjArray *array = 0x0;
+       Int_t indexDP = -1;
+
+       AliInfo(Form("==========L3Polarity==========="));
+       indexDP = kL3Polarity;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Char_t charDCS = ProcessBool(array);
+               grpObj->SetL3Polarity(charDCS);
+               nL3Entries++;
+       }
+
+       if (array) array = 0x0;
+
+       AliInfo(Form("==========L3Current==========="));
+       indexDP = kL3Current;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Float_t *floatDCS = ProcessFloatAll(array);
+               grpObj->SetL3Current(floatDCS);
+               delete floatDCS;
+               nL3Entries++;
+       }
+
+       return nL3Entries;
 
-  if (list->GetEntries() == 0) {
-    Log("no raw data tags in this run: nothing to merge!");
-    delete  list; list=0;
-    return 0;
-  }
+}
+//_______________________________________________________________
 
-  TChain *fRawTagChain = new TChain("T");
-  Int_t nFiles=0;
-  TIterator* iter = list->MakeIterator();
-  TObject* obj = 0;
-  while ((obj = iter->Next())) {
-    TObjString* objStr = dynamic_cast<TObjString*> (obj);
-    if (objStr) {
-      Log(Form("Found source %s", objStr->String().Data()));
-      TList* list2 = GetFileIDs(kDAQ, objStr->String());
-      if (!list2) {
-        Log("No list with ids from DAQ was found: connection problems with DAQ FXS logbook!");
-        delete fRawTagChain; fRawTagChain=0;
-        return 1;
-      }
-      Log(Form("Number of ids: %d",list2->GetEntries()));
-      for(Int_t i = 0; i < list2->GetEntries(); i++) {
-        TObjString *idStr = (TObjString *)list2->At(i);
-        TString fileName = GetFile(kDAQ,idStr->String().Data(),objStr->String().Data());
-        if (fileName.Length() > 0) {
-           Log(Form("Adding file in the chain: %s",fileName.Data()));
-           fRawTagChain->Add(fileName.Data());
-           nFiles++;
-        } else {
-           Log(Form("Could not retrieve file with id %s from source %s: "
-                    "connection problems with DAQ FXS!",
-                     idStr->String().Data(), objStr->String().Data()));
-           delete list; list=0;
-           delete list2; list2=0;
-           delete fRawTagChain; fRawTagChain=0;
-           return 2;
-        }
-      }
-      delete list2;
-    }
-  }
-  
-  TString fRawDataFileName = "GRP_Merged.tag.root";
-  Log(Form("Merging %d raw data tags into file: %s", nFiles, fRawDataFileName.Data()));
-  if( fRawTagChain->Merge(fRawDataFileName) < 1 ) {
-    Log("Error merging raw data files!!!");
-    return 3;
-  }
-  
-  TString outputfile = Form("Run%d.Merged.RAW.tag.root", fRun);
-  Bool_t result = StoreRunMetadataFile(fRawDataFileName.Data(),outputfile.Data());
-  
-  if (!result) {
-    Log("Problem storing raw data tags in local file!!!");
-  } else {
-    Log("Raw data tags merged successfully!!");
-  }
-  
-  delete iter;
-  delete list;
-  delete fRawTagChain; fRawTagChain=0;
+Int_t AliGRPPreprocessor::ProcessDipoleDPs(TMap* valueMap, AliGRPObject* grpObj)
+{
+       Int_t nDipoleEntries = 0;
+       TObjArray *array = 0x0;
+       Int_t indexDP = -1;
+
+       AliInfo(Form("==========DipolePolarity==========="));
+       indexDP = kDipolePolarity;
+       AliInfo(Form("indexDP = %d",indexDP));
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       AliInfo(Form("array entries = %d",array->GetEntries()));
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Bool_t charDCS = ProcessBool(array);
+               grpObj->SetDipolePolarity(charDCS);
+               nDipoleEntries++;
+       }
+
+       if (array) array = 0x0;
+
+       AliInfo(Form("==========DipoleCurrent==========="));
+       indexDP = kDipoleCurrent;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Float_t *floatDCS = ProcessFloatAll(array);
+               grpObj->SetDipoleCurrent(floatDCS);
+               delete floatDCS;
+               nDipoleEntries++;
+       }
+
+       return nDipoleEntries;
 
-  if (result == kFALSE) {
-    return 4;
-  }
+}
+//_______________________________________________________________
 
-  return 0;
+Int_t AliGRPPreprocessor::ProcessEnvDPs(TMap* valueMap, AliGRPObject* grpObj)
+{
+       Int_t nEnvEntries = 0;
+       TObjArray *array = 0x0;
+       Int_t indexDP = -1;
+
+       AliInfo(Form("==========CavernTemperature==========="));
+       indexDP = kCavernTemperature;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Float_t *floatDCS = ProcessFloatAll(array);
+               grpObj->SetCavernTemperature(floatDCS);
+               nEnvEntries++;
+       }
+
+       if (array) array = 0x0;
+
+       AliInfo(Form("==========AtmosPressures (Cavern + Surface)==========="));
+       AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap);
+       dcsSensorArray->Print();
+       AliInfo(Form("fPressure = %p",fPressure));
+       AliInfo(Form("dcsSensorArray = %p",dcsSensorArray));
+       if( fPressure->NumFits()==0 ) {
+               Log("Problem with the pressure sensor values!!!");
+       } 
+       else {
+               AliInfo(Form("==========CavernAtmosPressure==========="));
+               indexDP = kCavernAtmosPressure;
+               AliDCSSensor* sensorCavernP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]);
+               AliDebug(2,Form("sensorCavernP2 = %p", sensorCavernP2));
+               if( sensorCavernP2->GetFit() ) {
+                       Log(Form("<%s> for run %d: Sensor Fit found",fgkDCSDataPoints[indexDP], fRun));
+                       grpObj->SetCavernAtmosPressure(sensorCavernP2);
+                       nEnvEntries++;
+               } 
+               //if (sensorP2) delete sensorP2;
+               else {
+                       Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[indexDP] ));
+               }
+               AliInfo(Form("==========SurfaceAtmosPressure==========="));
+               indexDP = kSurfaceAtmosPressure;
+               AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]);
+               AliDebug(2,Form("sensorP2 = %p", sensorP2));
+               if( sensorP2->GetFit() ) {
+                       Log(Form("<%s> for run %d: Sensor Fit found",fgkDCSDataPoints[indexDP], fRun));
+                       grpObj->SetSurfaceAtmosPressure(sensorP2);
+                       nEnvEntries++;
+               } 
+               //if (sensorP2) delete sensorP2;
+               else {
+                       Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[indexDP] ));
+               }
+               
+       }
+
+       /*      indexDP = kCavernAtmosPressure;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Float_t *floatDCS = ProcessFloatAll(array);
+               grpObj->SetCavernAtmosPressure(floatDCS);
+               delete floatDCS;
+               nEnvEntries++;
+       }
+       
+
+       if (array) array = 0x0;
+
+       AliInfo(Form("==========SurfaceAtmosPressure==========="));
+       indexDP = kSurfaceAtmosPressure;
+       AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap);
+       dcsSensorArray->Print();
+       AliInfo(Form("fPressure = %p",fPressure));
+       AliInfo(Form("dcsSensorArray = %p",dcsSensorArray));
+       if( fPressure->NumFits()==0 ) {
+               Log("Problem with the pressure sensor values!!!");
+       } 
+       else {
+               AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[indexDP]);
+               AliDebug(2,Form("sensorP2 = %p", sensorP2));
+               if( sensorP2->GetFit() ) {
+                       Log(Form("<%s> for run %d: Sensor Fit found",fgkDCSDataPoints[indexDP], fRun));
+                       grpObj->SetSurfaceAtmosPressure(sensorP2);
+                       nEnvEntries++;
+               } 
+               //if (sensorP2) delete sensorP2;
+               else {
+                       Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[indexDP] ));
+               }
+               
+       }
+       */
+
+       return nEnvEntries;
+}
+//_______________________________________________________________
 
+Int_t AliGRPPreprocessor::ProcessHPDPs(TMap* valueMap, AliGRPObject* grpObj)
+{
+       Int_t nHPEntries = 0;
+       TObjArray *array = 0x0;
+       Int_t indexDP = -1;
+
+       if (fgknDCSDP_HallProbes != AliGRPObject::GetNumberOfHP()){
+               AliError(Form("Number of Hall probes expected in GRP Preprocessor (i.e. %d) different from number of Hall Probes foreseen in GRP object (i.e. %d). Looping on entries from GRP object anyway.", fgknDCSDP_HallProbes, AliGRPObject::GetNumberOfHP()));
+       }
+       for (indexDP = 0; indexDP < AliGRPObject::GetNumberOfHP(); indexDP++){
+               AliInfo(Form("==========%s===========",AliGRPObject::GetHPDP(indexDP)));
+               array = (TObjArray *)valueMap->GetValue(AliGRPObject::GetHPDP(indexDP));
+               if(!array) {
+                       Log(Form("%s not found in the map!!!",AliGRPObject::GetHPDP(indexDP)));
+               } 
+               else {
+                       Float_t *floatDCS = ProcessFloatAll(array);
+                       AliDebug(2,Form("value[0] = %f, value[1] = %f, value[2] = %f, value[3] = %f, value[4] = %f",floatDCS[0],floatDCS[1],floatDCS[2],floatDCS[3],floatDCS[4])); 
+                       grpObj->SetHallProbes((AliGRPObject::DP_HallProbes)indexDP,floatDCS);
+                       for (Int_t kk = 0 ; kk< 5; kk++){
+                               AliDebug(2,Form("HallProbe[%d][%d]=%f",indexDP,kk,grpObj->GetHallProbes((AliGRPObject::DP_HallProbes)indexDP,(AliGRPObject::Stats)kk)));
+                       }
+                       delete floatDCS;
+                       nHPEntries++;
+               }
+       }
+               
+       return 0;
 }
 
 //_______________________________________________________________
-UInt_t AliGRPPreprocessor::ProcessDcsFxs()
+
+Int_t AliGRPPreprocessor::ProcessLHCDPs(TMap* valueMap, AliGRPObject* grpObj)
 {
-  //======DCS FXS======//
-  // Get the CTP run configuration
-  // and scalers from DCS FXS
-
-/*
-  {
-
-    // Get the CTP run configuration
-    TList* list = GetFileSources(kDCS,"CTP_runconfig");  
-    if (!list) {
-      Log("No CTP runconfig file: connection problems with DCS FXS logbook!");
-      return 1;
-    }
-  
-    if (list->GetEntries() == 0) {
-      Log("No CTP runconfig file to be processed!");
-      return 1;
-    }
-    else {
-      TIter iter(list);
-      TObjString *source;
-      while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
-        TString runcfgfile = GetFile(kDCS, "CTP_runconfig", source->GetName());
-        if (runcfgfile.IsNull()) {
-          Log("No CTP runconfig files has been found: empty source!");
-        }
-        else {
-          Log(Form("File with Id CTP_runconfig found in source %s! Copied to %s",source->GetName(),runcfgfile.Data()));
-          AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfiguration(runcfgfile);
-          if (!runcfg) {
-            Log("Bad CTP run configuration file! The corresponding CDB entry will not be filled!");
-            return 1;
-          }
-          else {
-            AliCDBMetaData metaData;
-            metaData.SetBeamPeriod(0);
-            metaData.SetResponsible("Roman Lietava");
-            metaData.SetComment("CTP run configuration");
-            if (!Store("CTP","Config", runcfg, &metaData, 0, 0)) {
-              Log("Unable to store the CTP run configuration object to OCDB!");
-            }
-          }
-        }
-      }
-    }
-    delete list;
-  }
-*/
-  {
-    // Get the CTP counters information
-    TList* list = GetFileSources(kDCS,"CTP_xcounters");  
-    if (!list) {
-      Log("No CTP counters file: connection problems with DAQ FXS logbook!");
-      return 1;
-    }
-  
-    if (list->GetEntries() == 0) {
-      Log("No CTP counters file to be processed!");
-      return 1;
-    }
-    else {
-      TIter iter(list);
-      TObjString *source;
-      while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
-        TString countersfile = GetFile(kDCS, "CTP_xcounters", source->GetName());
-        if (countersfile.IsNull()) {
-          Log("No CTP counters files has been found: empty source!");
-        }
-        else {
-          Log(Form("File with Id CTP_xcounters found in source %s! Copied to %s",source->GetName(),countersfile.Data()));
-          AliTriggerRunScalers *scalers = AliTriggerRunScalers::ReadScalers(countersfile);
-          if (!scalers) {
-            Log("Bad CTP counters file! The corresponding CDB entry will not be filled!");
-            return 1;
-          }
-          else {
-            AliCDBMetaData metaData;
-            metaData.SetBeamPeriod(0);
-            metaData.SetResponsible("Roman Lietava");
-            metaData.SetComment("CTP scalers");
-            if (!Store("CTP","Scalers", scalers, &metaData, 0, 0)) {
-              Log("Unable to store the CTP scalers object to OCDB!");
-            }
-          }
-        }
-      }
-    }
-    delete list;
-  }
 
-  return 0;
+       //
+       // processing of LHC related DCS DPs, i.e.:
+       // LHCState
+       // LHCLuminosity
+       // BeamIntensity
+       //
+
+       Int_t nLHCEntries = 0;
+       TObjArray *array = 0x0;
+       Int_t indexDP = -1;
+
+       AliInfo(Form("==========LHCState==========="));
+       indexDP = kLHCState;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               TString stringDCS = ProcessChar(array);
+               if (stringDCS.Length()!=0) {
+                       Bool_t found = kFALSE;
+                       for( Int_t i=0; i<20; i+=2 ) {
+                               if( stringDCS.CompareTo(fgkLHCState[i]) == 0 ) {
+                                       stringDCS = fgkLHCState[i+1];
+                                       found = kTRUE;
+                                       break;
+                               }
+                       }
+                       if (found){
+                               Log(Form("<%s> for run %d: %s",fgkDCSDataPoints[indexDP],fRun, stringDCS.Data()));
+                               grpObj->SetLHCState(stringDCS);
+                       }
+                       else{
+                               Log(Form("%s values found not valid!",fgkDCSDataPoints[indexDP]));
+                               grpObj->SetLHCState(AliGRPObject::GetInvalidString());
+                       } 
+               }
+               else {
+                       Log(Form("%s not valid (null length), string set as invalid!",fgkDCSDataPoints[indexDP]));
+                       grpObj->SetLHCState(AliGRPObject::GetInvalidString());
+               }         
+               nLHCEntries++;
+       }
+       
+       if (array) array = 0x0;
+
+       AliInfo(Form("==========LHCLuminosity==========="));
+       indexDP = kLHCLuminosity;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Float_t *floatDCS = ProcessFloatAll(array);
+               grpObj->SetLHCLuminosity(floatDCS);
+               delete floatDCS;
+               nLHCEntries++;
+               AliSplineFit* splfit = GetSplineFit(array,fgkDCSDataPoints[indexDP]);
+               grpObj->SetLHCLuminositySplineFit(splfit);
+               //              delete splfit;
+               nLHCEntries++;
+       }
+
+       if (array) array = 0x0;
+
+       AliInfo(Form("==========BeamIntensity==========="));
+       indexDP = kBeamIntensity;
+       array = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[indexDP]);
+       if(!array) {
+               Log(Form("%s not found in the map!!!",fgkDCSDataPoints[indexDP]));
+       } 
+       else {
+               Float_t *floatDCS = ProcessFloatAll(array);
+               grpObj->SetBeamIntensity(floatDCS);
+               delete floatDCS;
+               nLHCEntries++;
+               AliSplineFit* splfit1 = GetSplineFit(array,fgkDCSDataPoints[indexDP]);
+               grpObj->SetBeamIntensitySplineFit(splfit1);
+               //delete splfit;
+               nLHCEntries++;
+       }
+
+       return nLHCEntries;
+}
+//_________________________________________________________________________
+
+AliSplineFit* AliGRPPreprocessor::GetSplineFit(TObjArray *array, const TString& stringID){
+
+       Int_t entriesarray = array->GetEntries();
+       Float_t* value = new Float_t[entriesarray];
+       Float_t* time = new Float_t[entriesarray];
+       AliDCSValue* v = 0x0;
+       for (Int_t iarray = 0; iarray < entriesarray; iarray++){
+               v = (AliDCSValue*)array->At(iarray);
+               value[iarray] = v->GetFloat();
+               time[iarray] = v->GetTimeStamp();
+               AliInfo(Form("iarray = %d, value = %f, time = %f",iarray,value[iarray],time[iarray]));
+       }
+       TGraph* gr = new TGraph(entriesarray,value,time);
+       if (!gr ) {
+               AliWarning(Form("%s: no input graph to compute SplineFit",stringID.Data()));
+               return NULL;
+       }
+       AliSplineFit *fit = new AliSplineFit();
+       fit->SetMinPoints(10);
+       fit->InitKnots(gr,10,10,0.0);
+       fit->SplineFit(2);
+       fit->Cleanup();
+       if (!fit) {
+               AliWarning(Form("%s: no fit performed",stringID.Data()));
+               return NULL;
+       } 
+       return fit;
 }
 
-//_______________________________________________________________
-Int_t AliGRPPreprocessor::ProcessDcsDPs(TMap* valueMap, TMap* mapDCS)
+//_________________________________________________________________________
+
+TString AliGRPPreprocessor::ProcessChar(TObjArray *array)
 {
-  //Getting the DCS dps
-  //===========//
 
-  //DCS data points
-  //===========//
-  
-  Int_t entries = 0;
-
-  AliInfo(Form("==========LHCState==========="));
-  TObjArray *aliasLHCState = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[0]);
-  if(!aliasLHCState) {
-    Log(Form("LHCState not found!!!"));
-  } else {
-    AliGRPDCS *dcs1 = new AliGRPDCS(aliasLHCState,fStartTime,fEndTime);
-    TString sLHCState = dcs1->ProcessDCS(2);
-    if (sLHCState) {
-      for( Int_t i=0; i<20; i+=2 ) {
-         if( sLHCState.CompareTo(fgkLHCState[i]) == 0 ) {
-            sLHCState = fgkLHCState[i+1];
-            break;
-         }
-      }
-      Log(Form("<LHCState> for run %d: %s",fRun, sLHCState.Data()));
-    } else {
-      Log("LHCState not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fLHCState"),new TObjString(sLHCState));
-    ++entries;
-  }
+       // 
+       // processing char
+       //
+
+       TString aDCSString="";
+       
+       AliDCSValue *v = 0x0;
+       for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) {
+               v = (AliDCSValue *)array->At(iCount);
+               if ((v->GetTimeStamp() < fStartTime) || (v->GetTimeStamp() > fEndTime)) {
+                       AliError(Form("DCS values for the parameter outside the queried interval"));
+                       continue;
+               }
+               if (iCount > 0) {
+                       if (aDCSString != v->GetChar());
+                       AliError(Form("DCS values for the parameter changed from %s to %c within the queried interval", aDCSString.Data(), (Char_t)v->GetChar()));
+               }
+               aDCSString = (TString)v->GetChar();  // keeping always last value in the array
+       }
+       return aDCSString;
+}
 
-  AliInfo(Form("==========L3Polarity==========="));
-  TObjArray *aliasL3Polarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[1]);
-  if(!aliasL3Polarity) {
-    Log(Form("L3Polarity not found!!!"));
-  } else {
-    AliGRPDCS *dcs6 = new AliGRPDCS(aliasL3Polarity,fStartTime,fEndTime);
-    TString sL3Polarity = dcs6->ProcessDCS(1);  
-    if (sL3Polarity) {
-      Log(Form("<L3Polarity> for run %d: %s",fRun, sL3Polarity.Data()));
-    } else {
-      Log("L3Polarity not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fL3Polarity"),new TObjString(sL3Polarity));
-    ++entries;
-  }
+//__________________________________________________________________________________________________________________
 
-  AliInfo(Form("==========DipolePolarity==========="));
-  TObjArray *aliasDipolePolarity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[2]);
-  if(!aliasDipolePolarity) {
-    Log(Form("DipolePolarity not found!!!"));
-  } else {
-    AliGRPDCS *dcs8 = new AliGRPDCS(aliasDipolePolarity,fStartTime,fEndTime);
-    TString sDipolePolarity = dcs8->ProcessDCS(1);  
-    if (sDipolePolarity) {
-      Log(Form("<DipolePolarity> for run %d: %s",fRun, sDipolePolarity.Data()));
-    } else {
-      Log("DipolePolarity not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fDipolePolarity"),new TObjString(sDipolePolarity));
-    ++entries;
-  }
+Float_t* AliGRPPreprocessor::ProcessFloatAll(TObjArray* array)
+{
+       // 
+       // processing Float values using Mean, Median, Standard Deviation wrt Mean, Standar Deviation wrt Median 
+       //
+       // parameters[0] = mean
+       // parameters[1] = truncated mean (calculated excluding points outside +/- 3RMS from mean
+       // parameters[2] = median
+       // parameters[3] = standard deviation wrt mean
+       // parameters[4] = standard deviation wrt median
+       //
+
+       Float_t* parameters = new Float_t[4];
+       Double_t aDCSArrayMean = 0;     // Mean
+       Double_t aDCSArrayTruncMean = 0;// Truncated Mean
+       Double_t aDCSArrayMedian = 0;   // Median
+       Double_t aDCSArraySDMean = 0;   // Standard Deviation wrt Mean
+       Double_t aDCSArraySDMedian = 0; // Standard Deviation wrt Median
+       Float_t aDCSArraySum = 0.0;
+       Int_t iCounts = 0;
+       Int_t iCounts1 = 0;
+       Float_t temp = 0;
+       Float_t temp1 = 0;
+       Int_t nCounts = array->GetEntries();
+       Float_t *tempArray = new Float_t[nCounts];
+       for(Int_t i = 0; i < nCounts; i++) {
+               AliDCSValue *v = (AliDCSValue *)array->At(i);
+               if((v->GetTimeStamp() >= fStartTime) &&(v->GetTimeStamp() <= fEndTime)) {
+                       aDCSArraySum += v->GetFloat();
+                       tempArray[i] = v->GetFloat();
+                       AliDebug(2,Form("%d-th entry = %f",i,tempArray[i]));
+                       iCounts += 1;
+               }
+       }
+
+       if(iCounts != 0) {
+               aDCSArrayMean = TMath::Mean(nCounts,tempArray);
+               aDCSArrayMedian = TMath::Median(nCounts,tempArray);
+               aDCSArraySDMean = TMath::RMS(nCounts,tempArray);
+               // computing standard deviation wrt median
+               AliDebug(2,Form("maximum = %f, minimum = %f", aDCSArrayMean+3*aDCSArraySDMean, aDCSArrayMean-3*aDCSArraySDMean));
+               for (Int_t i = 0; i < iCounts; i++){
+                       AliDCSValue *v = (AliDCSValue *)array->At(i);
+                       AliDebug(2,Form("maximum = %f, minimum = %f", aDCSArrayMean+3*aDCSArraySDMean, aDCSArrayMean-3*aDCSArraySDMean));
+                       AliDebug(2,Form("%i-th entry = %f",i, v->GetFloat())); 
+                       if ((v->GetFloat()<aDCSArrayMean+3*aDCSArraySDMean) && (v->GetFloat()>aDCSArrayMean-3*aDCSArraySDMean)){
+                               temp1+=v->GetFloat();
+                               iCounts1++;
+                               AliDebug(2,Form("temp1 = %f, iCounts = %i",temp1,iCounts1));
+                       }
+                       temp += (v->GetFloat()-aDCSArrayMedian)*(v->GetFloat()-aDCSArrayMedian);
+               }
+               temp/=iCounts;
+               if (temp>0) {
+                       aDCSArraySDMedian = TMath::Sqrt(temp);
+               }
+               else{
+                       AliError(Form("Radical <= 0 in computing standard deviation! Setting it to -99999...."));
+                       aDCSArraySDMedian = AliGRPObject::GetInvalidFloat();
+               }
+       }
+       else {
+               aDCSArrayMean = AliGRPObject::GetInvalidFloat();
+               aDCSArrayMedian = AliGRPObject::GetInvalidFloat();
+               aDCSArraySDMean = AliGRPObject::GetInvalidFloat();
+       }
+       if (iCounts1 > 0) {
+               aDCSArrayTruncMean = temp1/iCounts1;
+       }
+       else{
+               aDCSArrayTruncMean = AliGRPObject::GetInvalidFloat();
+       }
+       
+       
+       
+       AliDebug(2,Form("mean within %d counts = %f ",nCounts,aDCSArrayMean));
+       AliDebug(2,Form("truncated mean within %d counts = %f (%i values used)",nCounts,aDCSArrayTruncMean,iCounts1));
+       AliDebug(2,Form("median within %d counts = %f ",nCounts,aDCSArrayMedian));
+       AliDebug(2,Form("standard deviation with mean within %d counts = %f ",nCounts,aDCSArraySDMean));
+       AliDebug(2,Form("standard deviation with median within %d counts = %f ",nCounts,aDCSArraySDMedian));
+       
+       parameters[0] = aDCSArrayMean;
+       parameters[1] = aDCSArrayTruncMean;
+       parameters[2] = aDCSArrayMedian;
+       parameters[3] = aDCSArraySDMean;
+       parameters[4] = aDCSArraySDMedian;
+
+       AliDebug(2,Form("parameters[0] = %f, parameters[1] = %f, parameters[2] = %f, parameters[3] = %f, parameters[4] = %f ",parameters[0],parameters[1],parameters[2],parameters[3],parameters[4]));
+
+       return parameters;
+}
 
-  AliInfo(Form("==========LHCLuminosity==========="));
-  TObjArray *aliasLHCLuminosity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[3]);
-  if(!aliasLHCLuminosity) {
-    Log(Form("LHCLuminosity not found!!!"));
-  } else {
-    AliGRPDCS *dcs3 = new AliGRPDCS(aliasLHCLuminosity,fStartTime,fEndTime);
-    TString sMeanLHCLuminosity = dcs3->ProcessDCS(5);  
-    if (sMeanLHCLuminosity) {
-      Log(Form("<LHCLuminosity> for run %d: %s",fRun, sMeanLHCLuminosity.Data()));
-    } else {
-      Log("LHCLuminosity not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fLHCLuminosity"), new TObjString(sMeanLHCLuminosity));
-    ++entries;
-  }
 
-  AliInfo(Form("==========BeamIntensity==========="));
-  TObjArray *aliasBeamIntensity = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[4]);
-  if(!aliasBeamIntensity) {
-    Log(Form("BeamIntensity not found!!!"));
-  } else {
-    AliGRPDCS *dcs4 = new AliGRPDCS(aliasBeamIntensity,fStartTime,fEndTime);
-    TString sMeanBeamIntensity = dcs4->ProcessDCS(5);  
-    if (sMeanBeamIntensity) {
-      Log(Form("<BeamIntensity> for run %d: %s",fRun, sMeanBeamIntensity.Data()));
-    } else {
-      Log("BeamIntensity not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fBeamIntensity"),new TObjString(sMeanBeamIntensity));
-    ++entries;
-  }
-
-  AliInfo(Form("==========L3Current==========="));
-  TObjArray *aliasL3Current = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[5]);
-  if(!aliasL3Current) {
-    Log(Form("L3Current not found!!!"));
-  } else {
-    AliGRPDCS *dcs5 = new AliGRPDCS(aliasL3Current,fStartTime,fEndTime);
-    TString sMeanL3Current = dcs5->ProcessDCS(5);  
-    if (sMeanL3Current) {
-      Log(Form("<L3Current> for run %d: %s",fRun, sMeanL3Current.Data()));
-    } else {
-      Log("L3Current not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fL3Current"),new TObjString(sMeanL3Current));
-    ++entries;
-  }
+//_______________________________________________________________
 
+Char_t AliGRPPreprocessor::ProcessBool(TObjArray* array)
+{
+       // 
+       // processing Boolean values
+       //
+
+       Bool_t aDCSBool = kTRUE;
+
+       AliDCSValue *v = 0x0;
+       
+       for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) {
+               v = (AliDCSValue *)array->At(iCount);
+               if ((v->GetTimeStamp() < fStartTime) || (v->GetTimeStamp() > fEndTime)) {
+                       AliError(Form("DCS values for the parameter outside the queried interval"));
+                       continue;
+               }
+               if (iCount > 0) {
+                       if (aDCSBool != v->GetBool());
+                       AliError(Form("DCS values for the parameter changed from %d to %d within the queried interval", (UInt_t)aDCSBool, (UInt_t)v->GetBool()));
+               }
+               aDCSBool = v->GetBool(); // always keeping last value
+       }
+       
+       Char_t caDCSBool = (Char_t)aDCSBool;
+       return caDCSBool;
+       
+}
 
-  AliInfo(Form("==========DipoleCurrent==========="));
-  TObjArray *aliasDipoleCurrent = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[6]);
-  if(!aliasDipoleCurrent) {
-    Log(Form("DipoleCurrent not found!!!"));
-  }  else {
-    AliGRPDCS *dcs7 = new AliGRPDCS(aliasDipoleCurrent,fStartTime,fEndTime);
-    TString sMeanDipoleCurrent = dcs7->ProcessDCS(5);  
-    if (sMeanDipoleCurrent) {
-      Log(Form("<DipoleCurrent> for run %d: %s",fRun, sMeanDipoleCurrent.Data()));
-    } else {
-      Log("DipoleCurrent not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fDipoleCurrent"),new TObjString(sMeanDipoleCurrent));
-    ++entries;
-  }
+//_______________________________________________________________
 
-  AliInfo(Form("==========CavernTemperature==========="));
-  TObjArray *aliasCavernTemperature = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[7]);
-  if(!aliasCavernTemperature) {
-    Log(Form("CavernTemperature not found!!!"));
-  }  else {
-    AliGRPDCS *dcs9 = new AliGRPDCS(aliasCavernTemperature,fStartTime,fEndTime);
-    TString sMeanCavernTemperature = dcs9->ProcessDCS(5);  
-    if (sMeanCavernTemperature) {
-      Log(Form("<CavernTemperature> for run %d: %s",fRun, sMeanCavernTemperature.Data()));
-    } else {
-      Log("CavernTemperature not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fCavernTemperature"),new TObjString(sMeanCavernTemperature));
-    ++entries;
-  }
+Float_t AliGRPPreprocessor::ProcessInt(TObjArray* array)
+{
+       // 
+       // processing Int values, returning mean
+       //
+
+       Float_t aDCSArraySum = 0.0;
+       Float_t aDCSArrayMean = 0.0;
+       Int_t iCounts = 0;
+       AliDCSValue* v = 0x0;
+
+       for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) {
+               v = (AliDCSValue *)array->At(iCount);
+               if((v->GetTimeStamp() >= fStartTime) &&(v->GetTimeStamp() <= fEndTime)) {
+                       aDCSArraySum += v->GetInt();
+                       iCounts += 1;
+               }
+       }
+
+       if(iCounts != 0) aDCSArrayMean = aDCSArraySum/iCounts;
+       else aDCSArrayMean = AliGRPObject::GetInvalidFloat();
+       
+       return aDCSArrayMean;
 
-  AliInfo(Form("==========CavernPressure==========="));
-  TObjArray *aliasCavernPressure = (TObjArray *)valueMap->GetValue(fgkDCSDataPoints[8]);
-  if(!aliasCavernPressure) {
-    Log("CavernPressure not found!!!");
-  } else {
-    AliGRPDCS *dcs10 = new AliGRPDCS(aliasCavernPressure,fStartTime,fEndTime);
-    TString sMeanCavernPressure = dcs10->ProcessDCS(5);  
-    if (sMeanCavernPressure) {
-      Log(Form("<CavernPressure> for run %d: %s",fRun, sMeanCavernPressure.Data()));
-    } else {
-      Log("CavernPressure not put in TMap!");
-    }
-    mapDCS->Add(new TObjString("fCavernPressure"),new TObjString(sMeanCavernPressure));
-    ++entries;
-  }
+}
+//_______________________________________________________________
 
+Float_t AliGRPPreprocessor::ProcessUInt(TObjArray* array)
+{
+       // 
+       // processing Int values, returning mean
+       //
+
+       Float_t aDCSArraySum = 0.0;
+       Float_t aDCSArrayMean = 0.0;
+       Int_t iCounts = 0;
+       AliDCSValue* v = 0x0;
+
+       for(Int_t iCount = 0; iCount < array->GetEntries(); iCount++) {
+               v = (AliDCSValue *)array->At(iCount);
+               if((v->GetTimeStamp() >= fStartTime) &&(v->GetTimeStamp() <= fEndTime)) {
+                       aDCSArraySum += v->GetUInt();
+                       iCounts += 1;
+               }
+       }
+
+       if(iCounts != 0) aDCSArrayMean = aDCSArraySum/iCounts;
+       else aDCSArrayMean = AliGRPObject::GetInvalidFloat();
+       
+       return aDCSArrayMean;
 
-   // NEEDS TO BE REVISED, CONFIRMED
-   AliInfo(Form("==========P2PressureMap==========="));
-   AliDCSSensorArray *dcsSensorArray = GetPressureMap(valueMap);
-   if( fPressure->NumFits()==0 ) {
-     Log("Problem with the pressure sensor values!!!");
-   } 
-   else {
-      AliDCSSensor* sensorP2 = dcsSensorArray->GetSensor(fgkDCSDataPoints[9]);
-      if( sensorP2->GetFit() ) {
-        Log(Form("<P2Pressure> for run %d: Sensor Fit found",fRun));
-        mapDCS->Add( new TObjString("fP2Pressure"), sensorP2 );
-        ++entries;
-      } 
-      else {
-        Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[9] ));
-      }
-      
-      /*
-      AliDCSSensor* sensorMeyrin = dcsSensorArray->GetSensor(fgkDCSDataPoints[10]);
-      if( sensorMeyrin->GetFit() ) {
-        Log(Form("<MeyrinPressure> for run %d: Sensor Fit found",fRun));
-        mapDCS->Add( new TObjString("fMeyrinPressure"), sensorMeyrin );
-        ++entries;
-      } else {
-        Log(Form("ERROR Sensor Fit for %s not found: ", fgkDCSDataPoints[10] ));
-      }
-      */
-   }
-
-  return entries;
 }
 
+
 //_______________________________________________________________
+
 AliDCSSensorArray *AliGRPPreprocessor::GetPressureMap(TMap* dcsAliasMap)
 {
-  // extract DCS pressure maps. Perform fits to save space
-  
-  TMap *map = fPressure->ExtractDCS(dcsAliasMap);
-  if (map) {
-    fPressure->MakeSplineFit(map);
-    Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors(); 
-    if (fitFraction > kFitFraction ) {
-      AliInfo(Form("Pressure values extracted, %d fits performed.", fPressure->NumFits()));
-    } else { 
-      AliInfo("Too few pressure maps fitted!!!");
-    }
-  } else {
-    AliInfo("no atmospheric pressure map extracted!!!");
-  }
-  delete map;
-  return fPressure;
+       // extract DCS pressure maps. Perform fits to save space
+       
+       AliInfo ("here ok");
+       TMap *map = fPressure->ExtractDCS(dcsAliasMap);
+       if (map) {
+               fPressure->MakeSplineFit(map);
+               Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors(); 
+               if (fitFraction > kFitFraction ) {
+                       AliInfo(Form("Pressure values extracted, %d fits performed.", fPressure->NumFits()));
+               } else { 
+                       AliInfo("Too few pressure maps fitted!!!");
+               }
+       } else {
+               AliInfo("no atmospheric pressure map extracted!!!");
+       }
+       delete map;
+       
+       return fPressure;
 }
 
-//_______________________________________________________________
-/*UInt_t AliGRPPreprocessor::MapPressure(TMap* dcsAliasMap) {
-  // extract DCS pressure maps. Perform fits to save space
-  
-  UInt_t result=0;
-  TMap *map = fPressure->ExtractDCS(dcsAliasMap);
-  if (map) {
-    fPressure->MakeSplineFit(map);
-    Double_t fitFraction = fPressure->NumFits()/fPressure->NumSensors(); 
-    if (fitFraction > kFitFraction ) {
-      AliInfo(Form("Pressure values extracted, fits performed.\n"));
-    } else { 
-      Log ("Too few pressure maps fitted. \n");
-      result = 9;
-    }
-  } else {
-    Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
-    result=9;
-  }
-  delete map;
-  // Now store the final CDB file
-  
-  if ( result == 0 ) {
-    AliCDBMetaData metaData;
-    metaData.SetBeamPeriod(0);
-    metaData.SetResponsible("Panos Christakoglou");
-    metaData.SetComment("Preprocessor AliGRP data base pressure entries.");
-    
-    Bool_t storeOK = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
-    if ( !storeOK ) result=1; 
-  }
-  
-  return result; 
-  }*/
 
   
 //_______________________________________________________________
 Int_t AliGRPPreprocessor::ReceivePromptRecoParameters(UInt_t run, const char* dbHost, Int_t dbPort, const char* dbName, const char* user, const char* password, const char *cdbRoot)
 {
-   //
-   // Retrieves logbook and trigger information from the online logbook
-   // This information is needed for prompt reconstruction
-   //
-   // Parameters are:
-   // Run number
-   // DAQ params: dbHost, dbPort, dbName, user, password, logbookTable, triggerTable
-   // cdbRoot
-   //
-   // returns:
-   //         positive on success: the return code is the run number of last run processed of the same run type already processed by the SHUTTLE
-   //         0 on success and no run was found
-   //         negative on error
-   //
-   // This function is NOT called during the preprocessor run in the Shuttle!
-   //
-
-   // defaults
-   if (dbPort == 0)
-     dbPort = 3306;
-
-   // CDB connection
-   AliCDBManager* cdb = AliCDBManager::Instance();
-   cdb->SetDefaultStorage(cdbRoot);
-
-   // SQL connection
-   TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
-
-   if (!server)
-   {
-     Printf("ERROR: Could not connect to DAQ LB");
-     return -1;
-   }
-
-   // main logbook
-   TString sqlQuery;
-   sqlQuery.Form("SELECT DAQ_time_start, run_type, detectorMask FROM logbook WHERE run = %d", run);
-   TSQLResult* result = server->Query(sqlQuery);
-   if (!result)
-   {
-     Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
-     return -2;
-   }
-
-   if (result->GetRowCount() == 0)
-   {
-     Printf("ERROR: Run %d not found", run);
-     delete result;
-     return -3;
-   }
-
-   TSQLRow* row = result->Next();
-   if (!row)
-   {
-     Printf("ERROR: Could not receive data from run %d", run);
-     delete result;
-     return -4;
-   }
-
-   TString runType(row->GetField(1));
-
-   TMap grpData;
-   grpData.Add(new TObjString("DAQ_time_start"), new TObjString(row->GetField(0)));
-   grpData.Add(new TObjString("run_type"), new TObjString(runType));
-   grpData.Add(new TObjString("detectorMask"), new TObjString(row->GetField(2)));
-
-   delete row;
-   row = 0;
-
-   delete result;
-   result = 0;
-
-   Printf("Storing GRP/GRP/Data object with the following content");
-   grpData.Print();
-
-   AliCDBMetaData metadata;
-   metadata.SetResponsible("Jan Fiete Grosse-Oetringhaus");
-   metadata.SetComment("GRP Output parameters received during online running");
-
-   AliCDBId id("GRP/GRP/Data", run, run);
-   Bool_t success = cdb->Put(&grpData, id, &metadata);
-
-   grpData.DeleteAll();
-
-   if (!success)
-   {
-     Printf("ERROR: Could not store GRP/GRP/Data into OCDB");
-     return -5;
-   }
-
-   // Receive trigger information
-   sqlQuery.Form("SELECT configFile FROM logbook_trigger_config WHERE run = %d", run);
-   result = server->Query(sqlQuery);
-   if (!result)
-   {
-     Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
-     return -11;
-   }
-
-   if (result->GetRowCount() == 0)
-   {
-     Printf("ERROR: Run %d not found in logbook_trigger_config", run);
-     delete result;
-     return -12;
-   }
-
-   row = result->Next();
-   if (!row)
-   {
-     Printf("ERROR: Could not receive logbook_trigger_config data from run %d", run);
-     delete result;
-     return -13;
-   }
-
-   TString triggerConfig(row->GetField(0));
-
-   delete row;
-   row = 0;
-
-   delete result;
-   result = 0;
-
-   Printf("Found trigger configuration: %s", triggerConfig.Data());
-
-   AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConfig);
-   if (!runcfg)
-   {
-     Printf("ERROR: Could not create CTP configuration object");
-     return -14;
-   }
-
-   metadata.SetComment("CTP run configuration received during online running");
-
-   AliCDBId id2("GRP/CTP/Config", run, run);
-   success = cdb->Put(runcfg, id2, &metadata);
-
-   delete runcfg;
-   runcfg = 0;
-
-   if (!success)
-   {
-     Printf("ERROR: Could not store GRP/CTP/Config into OCDB");
-     return -15;
-   }
-
-   // get last run with same run type that was already processed by the SHUTTLE
-
-   sqlQuery.Form("SELECT max(logbook.run) FROM logbook LEFT JOIN logbook_shuttle ON logbook_shuttle.run = logbook.run WHERE run_type = '%s' AND shuttle_done = 1", runType.Data());
-   result = server->Query(sqlQuery);
-   if (!result)
-   {
-     Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
-     return -21;
-   }
-
-   if (result->GetRowCount() == 0)
-   {
-     Printf("ERROR: No result with query <%s>", sqlQuery.Data());
-     delete result;
-     return -22;
-   }
-
-   row = result->Next();
-   if (!row)
-   {
-     Printf("ERROR: Could not receive data for query <%s>", sqlQuery.Data());
-     delete result;
-     return -23;
-   }
-
-   TString lastRunStr(row->GetField(0));
-   Int_t lastRun = lastRunStr.Atoi();
-
-   Printf("Last run with same run type %s is %d", runType.Data(), lastRun);
-
-   delete row;
-   row = 0;
-
-   delete result;
-   result = 0;
-
-   server->Close();
-   delete server;
-   server = 0;
-
-   return lastRun;
+       //
+       // Retrieves logbook and trigger information from the online logbook
+       // This information is needed for prompt reconstruction
+       //
+       // Parameters are:
+       // Run number
+       // DAQ params: dbHost, dbPort, dbName, user, password, logbookTable, triggerTable
+       // cdbRoot
+       //
+       // returns:
+       //         positive on success: the return code is the run number of last run processed of the same run type already processed by the SHUTTLE
+       //         0 on success and no run was found
+       //         negative on error
+       //
+       // This function is NOT called during the preprocessor run in the Shuttle!
+       //
+       
+       // defaults
+       if (dbPort == 0)
+               dbPort = 3306;
+       
+       // CDB connection
+       AliCDBManager* cdb = AliCDBManager::Instance();
+       cdb->SetDefaultStorage(cdbRoot);
+       
+       // SQL connection
+       TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
+       
+       if (!server)
+               {
+                       Printf("ERROR: Could not connect to DAQ LB");
+                       return -1;
+               }
+       
+       // main logbook
+       TString sqlQuery;
+       sqlQuery.Form("SELECT DAQ_time_start, run_type, detectorMask FROM logbook WHERE run = %d", run);
+       TSQLResult* result = server->Query(sqlQuery);
+       if (!result)
+               {
+                       Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
+                       return -2;
+               }
+       
+       if (result->GetRowCount() == 0)
+               {
+                       Printf("ERROR: Run %d not found", run);
+                       delete result;
+                       return -3;
+               }
+       
+       TSQLRow* row = result->Next();
+       if (!row)
+               {
+                       Printf("ERROR: Could not receive data from run %d", run);
+                       delete result;
+                       return -4;
+               }
+       
+       TString runType(row->GetField(1));
+       
+       TMap grpData;
+       grpData.Add(new TObjString("DAQ_time_start"), new TObjString(row->GetField(0)));
+       grpData.Add(new TObjString("run_type"), new TObjString(runType));
+       grpData.Add(new TObjString("detectorMask"), new TObjString(row->GetField(2)));
+       
+       delete row;
+       row = 0;
+       
+       delete result;
+       result = 0;
+       
+       Printf("Storing GRP/GRP/Data object with the following content");
+       grpData.Print();
+       
+       AliCDBMetaData metadata;
+       metadata.SetResponsible("Jan Fiete Grosse-Oetringhaus");
+       metadata.SetComment("GRP Output parameters received during online running");
+       
+       AliCDBId id("GRP/GRP/Data", run, run);
+       Bool_t success = cdb->Put(&grpData, id, &metadata);
+       
+       grpData.DeleteAll();
+       
+       if (!success)
+               {
+                       Printf("ERROR: Could not store GRP/GRP/Data into OCDB");
+                       return -5;
+               }
+       
+       // Receive trigger information
+       sqlQuery.Form("SELECT configFile FROM logbook_trigger_config WHERE run = %d", run);
+       result = server->Query(sqlQuery);
+       if (!result)
+               {
+                       Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
+                       return -11;
+               }
+       
+       if (result->GetRowCount() == 0)
+               {
+                       Printf("ERROR: Run %d not found in logbook_trigger_config", run);
+                       delete result;
+                       return -12;
+               }
+       
+       row = result->Next();
+       if (!row)
+               {
+                       Printf("ERROR: Could not receive logbook_trigger_config data from run %d", run);
+                       delete result;
+                       return -13;
+               }
+       
+       TString triggerConfig(row->GetField(0));
+       
+       delete row;
+       row = 0;
+       
+       delete result;
+       result = 0;
+       
+       Printf("Found trigger configuration: %s", triggerConfig.Data());
+       
+       AliTriggerConfiguration *runcfg = AliTriggerConfiguration::LoadConfigurationFromString(triggerConfig);
+       if (!runcfg)
+               {
+                       Printf("ERROR: Could not create CTP configuration object");
+                       return -14;
+               }
+       
+       metadata.SetComment("CTP run configuration received during online running");
+       
+       AliCDBId id2("GRP/CTP/Config", run, run);
+       success = cdb->Put(runcfg, id2, &metadata);
+       
+       delete runcfg;
+       runcfg = 0;
+       
+       if (!success)
+               {
+                       Printf("ERROR: Could not store GRP/CTP/Config into OCDB");
+                       return -15;
+               }
+       
+       // get last run with same run type that was already processed by the SHUTTLE
+       
+       sqlQuery.Form("SELECT max(logbook.run) FROM logbook LEFT JOIN logbook_shuttle ON logbook_shuttle.run = logbook.run WHERE run_type = '%s' AND shuttle_done = 1", runType.Data());
+       result = server->Query(sqlQuery);
+       if (!result)
+               {
+                       Printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
+                       return -21;
+               }
+       
+       if (result->GetRowCount() == 0)
+               {
+                       Printf("ERROR: No result with query <%s>", sqlQuery.Data());
+                       delete result;
+                       return -22;
+               }
+       
+       row = result->Next();
+       if (!row)
+               {
+                       Printf("ERROR: Could not receive data for query <%s>", sqlQuery.Data());
+                       delete result;
+                       return -23;
+               }
+       
+       TString lastRunStr(row->GetField(0));
+       Int_t lastRun = lastRunStr.Atoi();
+       
+       Printf("Last run with same run type %s is %d", runType.Data(), lastRun);
+       
+       delete row;
+       row = 0;
+       
+       delete result;
+       result = 0;
+       
+       server->Close();
+       delete server;
+       server = 0;
+       
+       return lastRun;
 }
index 03d56818107a7d3f14e02ea4929f98c8068266a9..7c53840b1c88886e2df29675198210b1557d7cfd 100644 (file)
 class TList;
 class TString;
 class AliDCSSensorArray;
+class AliGRPObject;
+class AliSplineFit;
 
 class AliGRPPreprocessor: public AliPreprocessor {
  public:
+
+       enum DP {kLHCState = 0, kL3Polarity, kDipolePolarity, kLHCLuminosity, kBeamIntensity, 
+                kL3Current, kDipoleCurrent, 
+                kL3_BSF17_H1, kL3_BSF17_H2, kL3_BSF17_H3, kL3_BSF17_Temperature, 
+                kL3_BSF4_H1, kL3_BSF4_H2, kL3_BSF4_H3, kL3_BSF4_Temperature, 
+                kL3_BKF17_H1, kL3_BKF17_H2, kL3_BKF17_H3, kL3_BKF17_Temperature, 
+                kL3_BKF4_H1, kL3_BKF4_H2, kL3_BKF4_H3, kL3_BKF4_Temperature, 
+                kL3_BSF13_H1, kL3_BSF13_H2, kL3_BSF13_H3, kL3_BSF13_Temperature,
+                kL3_BSF8_H1, kL3_BSF8_H2, kL3_BSF8_H3, kL3_BSF8_Temperature,
+                kL3_BKF13_H1, kL3_BKF13_H2, kL3_BKF13_H3, kL3_BKF13_Temperature,
+                kL3_BKF8_H1, kL3_BKF8_H2, kL3_BKF8_H3, kL3_BKF8_Temperature,
+                kDipole_Inside_H1, kDipole_Inside_H2, kDipole_Inside_H3, kDipole_Inside_Temperature,
+                kDipole_Outside_H1, kDipole_Outside_H2, kDipole_Outside_H3, kDipole_Outside_Temperature,
+                 kCavernTemperature, kCavernAtmosPressure, kSurfaceAtmosPressure};
+
+       enum DP_HallProbes { 
+                k_HP_L3_BSF17_H1= 0 , k_HP_L3_BSF17_H2, k_HP_L3_BSF17_H3, k_HP_L3_BSF17_Temperature, 
+                k_HP_L3_BSF4_H1, k_HP_L3_BSF4_H2, k_HP_L3_BSF4_H3, k_HP_L3_BSF4_Temperature, 
+                k_HP_L3_BKF17_H1, k_HP_L3_BKF17_H2, k_HP_L3_BKF17_H3, k_HP_L3_BKF17_Temperature, 
+                k_HP_L3_BKF4_H1, k_HP_L3_BKF4_H2, k_HP_L3_BKF4_H3, k_HP_L3_BKF4_Temperature, 
+                k_HP_L3_BSF13_H1, k_HP_L3_BSF13_H2, k_HP_L3_BSF13_H3, k_HP_L3_BSF13_Temperature,
+                k_HP_L3_BSF8_H1, k_HP_L3_BSF8_H2, k_HP_L3_BSF8_H3, k_HP_L3_BSF8_Temperature,
+                k_HP_L3_BKF13_H1, k_HP_L3_BKF13_H2, k_HP_L3_BKF13_H3, k_HP_L3_BKF13_Temperature,
+                k_HP_L3_BKF8_H1, k_HP_L3_BKF8_H2, k_HP_L3_BKF8_H3, k_HP_L3_BKF8_Temperature,
+                k_HP_Dipole_Inside_H1, k_HP_Dipole_Inside_H2, k_HP_Dipole_Inside_H3, k_HP_Dipole_Inside_Temperature,
+                k_HP_Dipole_Outside_H1, k_HP_Dipole_Outside_H2, k_HP_Dipole_Outside_H3, k_HP_Dipole_Outside_Temperature};
+
                       AliGRPPreprocessor(AliShuttleInterface* shuttle);
   virtual            ~AliGRPPreprocessor();
   
@@ -48,18 +77,33 @@ class AliGRPPreprocessor: public AliPreprocessor {
   
   virtual     UInt_t   Process(TMap* valueSet);
 
-                TMap*  ProcessDaqLB();
+                AliGRPObject*  ProcessDaqLB();
               UInt_t   ProcessDaqFxs();
               UInt_t   ProcessDcsFxs();
-               Int_t   ProcessDcsDPs(TMap* valueSet, TMap* grpmap);
+               Int_t   ProcessDcsDPs(TMap* valueSet, AliGRPObject* grpobj);
+               Int_t   ProcessLHCDPs(TMap* valueSet, AliGRPObject* grpobj);
+               Int_t   ProcessL3DPs(TMap* valueSet, AliGRPObject* grpobj);
+               Int_t   ProcessDipoleDPs(TMap* valueSet, AliGRPObject* grpobj);
+               Int_t   ProcessEnvDPs(TMap* valueSet, AliGRPObject* grpobj);
+               Int_t   ProcessHPDPs(TMap* valueSet, AliGRPObject* grpobj);
+              //               Int_t   ProcessDcsDPs(TMap* valueSet, TMap* grpmap);
    AliDCSSensorArray*  GetPressureMap(TMap *dcsAliasMap);
-  
+   AliSplineFit* GetSplineFit(TObjArray *array, const TString& stringID);
+   //AliSplineFit* GetSplineFit(TMap* mapDCS, const TString& stringID);
+   TString ProcessChar(TObjArray *array);
+   Char_t ProcessBool(TObjArray *array);
+   Float_t ProcessInt(TObjArray *array);
+   Float_t ProcessUInt(TObjArray *array);
+   Float_t* ProcessFloatAll(TObjArray* array);
+
  private:
  
   static const Int_t   fgknDAQLbPar;            //! number of DAQ lb parameters
   static const Int_t   fgknDCSDP;               //! number of dcs dps
   static const char*   fgkDCSDataPoints[];      //! names of dcs dps
   static const char*   fgkLHCState[];           //! names of LHC States
+  static const char*   fgkDCSDataPoints_HallProbes[];      //! names of dcs dps for Hall Probes
+  static const Int_t   fgknDCSDP_HallProbes;           //! names of LHC States for Hall Probes
 
   AliDCSSensorArray*   fPressure; //pressure array
 
index 33b8e338bb05a6c83d55497f30945fb6cc71281f..d681b74e5c78ae85f0cb84334ca73eeb244f6e75 100644 (file)
@@ -32,6 +32,7 @@
 #include "AliQACheckerBase.h"
 #include "AliCorrQAChecker.h"
 #include "AliGlobalQAChecker.h"
+#include "AliGRPObject.h"
 
 #include <TKey.h>
 #include <TObjArray.h>
@@ -206,41 +207,63 @@ void AliQAChecker::LoadRunInfoFromGRP()
 {
   AliCDBManager* man = AliCDBManager::Instance() ;
   AliCDBEntry* entry = man->Get(AliQA::GetGRPPath().Data());
-  TMap * data = 0x0 ; 
-  if (entry) 
-    data = dynamic_cast<TMap*>(entry->GetObject());  
-  if (!data) {
-    AliFatal("No GRP entry found in OCDB!");      
+  AliGRPObject* grpObject = 0x0;
+  if (entry) {
+
+         TMap* m = dynamic_cast<TMap*>(entry->GetObject());  // old GRP entry
+
+         if (m) {
+           AliInfo("It is a map");
+           //m->Print();
+           grpObject = new AliGRPObject();
+                grpObject->ReadValuesFromMap(m);
+    }
+
+    else {
+           AliInfo("It is a new GRP object");
+        grpObject = dynamic_cast<AliGRPObject*>(entry->GetObject());  // new GRP entry
+    }
+
+    entry->SetOwner(0);
+    AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
+  }
+
+  if (!grpObject) {
+     AliFatal("No GRP entry found in OCDB!");
   }
-  TObjString *lhcState=  
-    dynamic_cast<TObjString*>(data->GetValue("fLHCState"));
-  if (!lhcState) {
-    AliWarning(Form("%s entry:  missing value for the LHC state ! Using UNKNOWN", AliQA::GetGRPPath().Data()));
+
+  TString lhcState = grpObject->GetLHCState();
+  if (lhcState==AliGRPObject::GetInvalidString()) {
+    AliError("GRP/GRP/Data entry:  missing value for the LHC state ! Using UNKNOWN");
+    lhcState = "UNKNOWN";
+  }
+
+  TString beamType = grpObject->GetBeamType();
+  if (beamType==AliGRPObject::GetInvalidString()) {
+    AliError("GRP/GRP/Data entry:  missing value for the beam type ! Using UNKNOWN");
+    beamType = "UNKNOWN";
   }
-  TObjString *beamType=
-    dynamic_cast<TObjString*>(data->GetValue("fAliceBeamType"));
-  if (!beamType) {
-    AliWarning(Form("%s entry:  missing value for the LHC state ! Using UNKNOWN", AliQA::GetGRPPath().Data()));
+
+  Float_t beamEnergy = grpObject->GetBeamEnergy();
+  if (beamEnergy==AliGRPObject::GetInvalidFloat()) {
+    AliError("GRP/GRP/Data entry:  missing value for the beam energy ! Using 0");
+    beamEnergy = 0;
   }
-  TObjString *beamEnergyStr=
-    dynamic_cast<TObjString*>(data->GetValue("fAliceBeamEnergy"));
-  if (!beamEnergyStr) {
-    AliWarning(Form("%s entry:  missing value for the beam energy ! Using 0", AliQA::GetGRPPath().Data()));
+
+  TString runType = grpObject->GetRunType();
+  if (runType==AliGRPObject::GetInvalidString()) {
+    AliError("GRP/GRP/Data entry:  missing value for the run type ! Using UNKNOWN");
+    runType = "UNKNOWN";
   }
-  TObjString *runType=
-    dynamic_cast<TObjString*>(data->GetValue("fRunType"));
-  if (!runType) {
-    AliWarning(Form("%s entry:  missing value for the run type ! Using UNKNOWN", AliQA::GetGRPPath().Data()));  }
-  TObjString *activeDetectors=
-    dynamic_cast<TObjString*>(data->GetValue("fDetectorMask"));
-  if (!activeDetectors) {
-    AliWarning(Form("%s entry:  missing value for the detector mask ! Using 1074790399", AliQA::GetGRPPath().Data()));  
+
+  Int_t activeDetectors = grpObject->GetDetectorMask();
+  if (activeDetectors==AliGRPObject::GetInvalidInt()) {
+    AliError("GRP/GRP/Data entry:  missing value for the detector mask ! Using 1074790399");
+    activeDetectors = 1074790399;
   }
-  fRunInfo = new AliRunInfo(lhcState ? lhcState->GetString().Data() : "UNKNOWN",
-                           beamType ? beamType->GetString().Data() : "UNKNOWN",
-                           beamEnergyStr ? beamEnergyStr->GetString().Atof() : 0,
-                           runType  ? runType->GetString().Data()  : "UNKNOWN",
-                           activeDetectors ? activeDetectors->GetString().Atoi() : 1074790399);
+
+  fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors);
+
   fRunInfoOwner = kTRUE ; 
 }
 
index bfa5817fb5cd6dedf16de78fd55e480e3c2bd635..85e8319889ed961d7f275d3302488d8651277a09 100644 (file)
 
 #include "AliDAQ.h"
 
+#include "AliGRPObject.h"
+
 ClassImp(AliReconstruction)
 
 //_____________________________________________________________________________
@@ -473,7 +475,8 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
   fMeanVertexConstraint = rec.fMeanVertexConstraint;
 
   delete fGRPData; fGRPData = NULL;
-  if (rec.fGRPData) fGRPData = (TMap*)((rec.fGRPData)->Clone());
+  //  if (rec.fGRPData) fGRPData = (TMap*)((rec.fGRPData)->Clone());
+  if (rec.fGRPData) fGRPData = (AliGRPObject*)((rec.fGRPData)->Clone());
 
   delete fAlignObjArray; fAlignObjArray = NULL;
 
@@ -870,8 +873,22 @@ Bool_t AliReconstruction::InitGRP() {
   AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data");
 
   if (entry) {
-    fGRPData = dynamic_cast<TMap*>(entry->GetObject());
-    entry->SetOwner(0);
+
+    TMap* m = dynamic_cast<TMap*>(entry->GetObject());  // old GRP entry
+
+    if (m) {
+       AliInfo("Found a TMap in GRP/GRP/Data, converting it into an AliGRPObject");
+       m->Print();
+       fGRPData = new AliGRPObject();
+       fGRPData->ReadValuesFromMap(m);
+    }
+
+    else {
+       AliInfo("Found an AliGRPObject in GRP/GRP/Data, reading it");
+       fGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject());  // new GRP entry
+       entry->SetOwner(0);
+    }
+
     AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
   }
 
@@ -880,45 +897,44 @@ Bool_t AliReconstruction::InitGRP() {
      return kFALSE;
   }
 
-  TObjString *lhcState=
-    dynamic_cast<TObjString*>(fGRPData->GetValue("fLHCState"));
-  if (!lhcState) {
+  TString lhcState = fGRPData->GetLHCState();
+  if (lhcState==AliGRPObject::GetInvalidString()) {
     AliError("GRP/GRP/Data entry:  missing value for the LHC state ! Using UNKNOWN");
+    lhcState = "UNKNOWN";
   }
 
-  TObjString *beamType=
-    dynamic_cast<TObjString*>(fGRPData->GetValue("fAliceBeamType"));
-  if (!beamType) {
+  TString beamType = fGRPData->GetBeamType();
+  if (beamType==AliGRPObject::GetInvalidString()) {
     AliError("GRP/GRP/Data entry:  missing value for the beam type ! Using UNKNOWN");
+    beamType = "UNKNOWN";
   }
 
-  TObjString *beamEnergyStr=
-    dynamic_cast<TObjString*>(fGRPData->GetValue("fAliceBeamEnergy"));
-  if (!beamEnergyStr) {
+  Float_t beamEnergy = fGRPData->GetBeamEnergy();
+  if (beamEnergy==AliGRPObject::GetInvalidFloat()) {
     AliError("GRP/GRP/Data entry:  missing value for the beam energy ! Using 0");
+    beamEnergy = 0;
   }
 
-  TObjString *runType=
-    dynamic_cast<TObjString*>(fGRPData->GetValue("fRunType"));
-  if (!runType) {
+  TString runType = fGRPData->GetRunType();
+  if (runType==AliGRPObject::GetInvalidString()) {
     AliError("GRP/GRP/Data entry:  missing value for the run type ! Using UNKNOWN");
+    runType = "UNKNOWN";
   }
 
-  TObjString *activeDetectors=
-    dynamic_cast<TObjString*>(fGRPData->GetValue("fDetectorMask"));
-  if (!activeDetectors) {
+  Int_t activeDetectors = fGRPData->GetDetectorMask();
+  if (activeDetectors==AliGRPObject::GetInvalidInt()) {
     AliError("GRP/GRP/Data entry:  missing value for the detector mask ! Using 1074790399");
+    activeDetectors = 1074790399;
   }
 
-  fRunInfo = new AliRunInfo(lhcState ? lhcState->GetString().Data() : "UNKNOWN",
-                           beamType ? beamType->GetString().Data() : "UNKNOWN",
-                           beamEnergyStr ? beamEnergyStr->GetString().Atof() : 0,
-                           runType  ? runType->GetString().Data()  : "UNKNOWN",
-                           activeDetectors ? activeDetectors->GetString().Atoi() : 1074790399);
+  fRunInfo = new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors);
+
+  fRunInfo->Dump();
+
 
   // Process the list of active detectors
-  if (activeDetectors && activeDetectors->GetString().IsDigit()) {
-    UInt_t detMask = activeDetectors->GetString().Atoi();
+  if (activeDetectors) {
+    UInt_t detMask = activeDetectors;
     fLoadCDB.Form("%s %s %s %s",
                  fRunLocalReconstruction.Data(),
                  fRunTracking.Data(),
@@ -948,6 +964,32 @@ Bool_t AliReconstruction::InitGRP() {
     Bool_t ok = kTRUE;
 
     // L3
+    Float_t l3Current = fGRPData->GetL3Current((AliGRPObject::Stats)0);
+    if (l3Current == AliGRPObject::GetInvalidFloat()) {
+      AliError("GRP/GRP/Data entry:  missing value for the L3 current !");
+      ok = kFALSE;
+    }
+
+    Char_t l3Polarity = fGRPData->GetL3Polarity();
+    if (l3Polarity == AliGRPObject::GetInvalidChar()) {
+      AliError("GRP/GRP/Data entry:  missing value for the L3 polarity !");
+      ok = kFALSE;
+    }
+
+    // Dipole
+    Float_t diCurrent = fGRPData->GetDipoleCurrent((AliGRPObject::Stats)0);
+    if (diCurrent == AliGRPObject::GetInvalidFloat()) {
+      AliError("GRP/GRP/Data entry:  missing value for the dipole current !");
+      ok = kFALSE;
+    }
+
+    Char_t diPolarity = fGRPData->GetDipolePolarity();
+    if (diPolarity == AliGRPObject::GetInvalidChar()) {
+      AliError("GRP/GRP/Data entry:  missing value for the dipole polarity !");
+      ok = kFALSE;
+    }
+
+    /*
     TObjString *l3Current=
        dynamic_cast<TObjString*>(fGRPData->GetValue("fL3Current"));
     if (!l3Current) {
@@ -960,7 +1002,7 @@ Bool_t AliReconstruction::InitGRP() {
       AliError("GRP/GRP/Data entry:  missing value for the L3 polarity !");
       ok = kFALSE;
     }
-
+    
     // Dipole
     TObjString *diCurrent=
        dynamic_cast<TObjString*>(fGRPData->GetValue("fDipoleCurrent"));
@@ -974,11 +1016,15 @@ Bool_t AliReconstruction::InitGRP() {
       AliError("GRP/GRP/Data entry:  missing value for the dipole polarity !");
       ok = kFALSE;
     }
+    */
 
     if (ok) { 
-       Float_t l3Cur=TMath::Abs(atof(l3Current->GetName()));
-       Float_t diCur=TMath::Abs(atof(diCurrent->GetName()));
-       Float_t l3Pol=atof(l3Polarity->GetName());
+       Float_t l3Cur=TMath::Abs(l3Current);
+       Float_t diCur=TMath::Abs(diCurrent);
+       Float_t l3Pol=l3Polarity;
+       //       Float_t l3Cur=TMath::Abs(atof(l3Current->GetName()));
+       //Float_t diCur=TMath::Abs(atof(diCurrent->GetName()));
+       //Float_t l3Pol=atof(l3Polarity->GetName());
        Float_t factor=1.;
        if (l3Pol != 0.) factor=-1.;
     
@@ -1062,6 +1108,7 @@ Bool_t AliReconstruction::Run(const char* input)
     SlaveBegin(NULL);
     if (GetAbort() != TSelector::kContinue) return kFALSE;
     //******* The loop over events
+    AliInfo("Starting looping over events");
     Int_t iEvent = 0;
     while ((iEvent < fRunLoader->GetNumberOfEvents()) ||
           (fRawReader && fRawReader->NextEvent())) {
@@ -2528,6 +2575,7 @@ Bool_t AliReconstruction::CreateVertexer()
 Bool_t AliReconstruction::CreateTrackers(const TString& detectors)
 {
 // create the trackers
+       AliInfo("Creating trackers");
 
   TString detStr = detectors;
   for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
index 44f1017291a0ed2c6725fbac9cc455825224e462..8d235e18151dd7ab41f6dbf9d5329c1beae7c560 100644 (file)
@@ -40,6 +40,7 @@ class TMap;
 class AliRecoParam;
 class AliDetectorRecoParam;
 class AliRunInfo;
+class AliGRPObject;
 #include "AliQA.h"
 #include "AliEventInfo.h"
 #include "AliRecoParam.h"
@@ -256,7 +257,7 @@ private:
   AliESDVertex*  fDiamondProfileTPC;       // (x,y) diamond profile from TPC for AliVertexerTracks
   Bool_t         fMeanVertexConstraint; // use fDiamondProfile in AliVertexerTracks
 
-  TMap*          fGRPData;              // Data from the GRP/GRP/Data CDB folder
+  AliGRPObject*  fGRPData;              // Data from the GRP/GRP/Data CDB folder
 
   TObjArray*    fAlignObjArray;      //! array with the alignment objects to be applied to the geometry
 
index d8f2b72c6dfd2ab8c21fd111132a940e852a6304..0a737e12ed55bc81f374a8f493a4b08f63ee1745 100644 (file)
 #include "AliHLTSimulation.h"
 #include "AliSysInfo.h"
 #include "AliMagF.h"
+#include "AliGRPObject.h"
 
 ClassImp(AliSimulation)
 
@@ -1876,23 +1877,26 @@ void AliSimulation::ProcessEnvironmentVars()
     AliInfo(Form("Run number = %d", fRun)); 
 }
 
-//_____________________________________________________________________________
+//---------------------------------------------------------------------
+
 void AliSimulation::WriteGRPEntry()
 {
   // Get the necessary information from galice (generator, trigger etc) and
   // write a GRP entry corresponding to the settings in the Config.C used
+  // note that Hall probes and Cavern and Surface Atmos pressures are not simulated.
+
+
   AliInfo("Writing global run parameters entry into the OCDB");
 
-  TMap *grpMap = new TMap();
-  grpMap->SetName("MONTECARLO");
+  AliGRPObject* grpObj = new AliGRPObject();
 
-  grpMap->Add(new TObjString("fRunType"),new TObjString("PHYSICS"));
-  grpMap->Add(new TObjString("fAliceStartTime"),new TObjString("0"));
-  grpMap->Add(new TObjString("fAliceStopTime"),new TObjString("9999"));
+  grpObj->SetRunType("PHYSICS");
+  grpObj->SetTimeStart(0);
+  grpObj->SetTimeEnd(9999);
 
   const AliGenerator *gen = gAlice->Generator();
   if (gen) {
-    grpMap->Add(new TObjString("fAliceBeamEnergy"),new TObjString(Form("%f",gen->GetEnergyCMS())));
+    grpObj->SetBeamEnergy(gen->GetEnergyCMS());
     TString projectile;
     Int_t a,z;
     gen->GetProjectile(projectile,a,z);
@@ -1900,16 +1904,17 @@ void AliSimulation::WriteGRPEntry()
     gen->GetTarget(target,a,z);
     TString beamType = projectile + "-" + target;
     if (!beamType.CompareTo("-")) {
-      grpMap->Add(new TObjString("fAliceBeamType"),new TObjString("UNKNOWN"));
+
+       grpObj->SetBeamType("UNKNOWN");
     }
     else {
-      grpMap->Add(new TObjString("fAliceBeamType"),new TObjString(beamType.Data()));
+       grpObj->SetBeamType(beamType);
     }
   }
   else {
-    AliWarning("Unknown beam type and energy!");
-    grpMap->Add(new TObjString("fAliceBeamEnergy"),new TObjString("UNKNOWN"));
-    grpMap->Add(new TObjString("fAliceBeamType"),new TObjString("0"));
+    AliWarning("Unknown beam type and energy! Setting energy to 0");
+    grpObj->SetBeamEnergy(0);
+    grpObj->SetBeamType("UNKNOWN");
   }
 
   UInt_t detectorPattern  = 0;
@@ -1925,37 +1930,36 @@ void AliSimulation::WriteGRPEntry()
   if (!fRunHLT.IsNull())
     detectorPattern |= (1 << AliDAQ::kHLTId);
 
-  grpMap->Add(new TObjString("fNumberOfDetectors"),new TObjString(Form("%d",nDets)));
-  grpMap->Add(new TObjString("fDetectorMask"),new TObjString(Form("%u",detectorPattern)));
-  grpMap->Add(new TObjString("fLHCPeriod"),new TObjString("LHC08c"));
-
-  grpMap->Add(new TObjString("fLHCState"),new TObjString("STABLE BEAMS"));
-  grpMap->Add(new TObjString("fLHCLuminosity"),new TObjString("0"));
-  grpMap->Add(new TObjString("fBeamIntensity"),new TObjString("0"));
+  grpObj->SetNumberOfDetectors((Char_t)nDets);
+  grpObj->SetDetectorMask((Int_t)detectorPattern);
+  grpObj->SetLHCPeriod("LHC08c");
+  grpObj->SetLHCState("STABLE_BEAMS");
+  grpObj->SetLHCLuminosity(0,(AliGRPObject::Stats)0);
+  grpObj->SetBeamIntensity(0,(AliGRPObject::Stats)0);
 
   AliMagF *field = gAlice->Field();
   Float_t solenoidField = TMath::Abs(field->SolenoidField());
   Float_t factor = field->Factor();
   Float_t l3current = TMath::Abs(factor)*solenoidField*30000./5.;
-  grpMap->Add(new TObjString("fL3Current"),new TObjString(Form("%f",l3current)));
+  grpObj->SetL3Current(l3current,(AliGRPObject::Stats)0);
   
   if (factor > 0) {
-    grpMap->Add(new TObjString("fL3Polarity"),new TObjString("0"));
-    grpMap->Add(new TObjString("fDipolePolarity"),new TObjString("0"));
+    grpObj->SetL3Polarity(0);
+    grpObj->SetDipolePolarity(0);
   }
   else {
-    grpMap->Add(new TObjString("fL3Polarity"),new TObjString("1"));
-    grpMap->Add(new TObjString("fDipolePolarity"),new TObjString("1"));
+    grpObj->SetL3Polarity(1);
+    grpObj->SetDipolePolarity(1);
   }
 
   if (TMath::Abs(factor) != 0)
-    grpMap->Add(new TObjString("fDipoleCurrent"),new TObjString("6000"));
+    grpObj->SetDipoleCurrent(6000,(AliGRPObject::Stats)0);
   else 
-    grpMap->Add(new TObjString("fDipoleCurrent"),new TObjString("0"));
+    grpObj->SetDipoleCurrent(0,(AliGRPObject::Stats)0);
 
-  grpMap->Add(new TObjString("fCavernTemperature"),new TObjString("0"));
-  grpMap->Add(new TObjString("fCavernPressure"),new TObjString("0"));
+  grpObj->SetCavernTemperature(0,(AliGRPObject::Stats)0);
+  
+  //grpMap->Add(new TObjString("fCavernPressure"),new TObjString("0")); ---> not inserted in simulation with the new object, since it is now an AliDCSSensor
 
   // Now store the entry in OCDB
   AliCDBManager* man = AliCDBManager::Instance();
@@ -1966,5 +1970,7 @@ void AliSimulation::WriteGRPEntry()
   metadata->SetResponsible("alice-off@cern.ch");
   metadata->SetComment("Automatically produced GRP entry for Monte Carlo");
  
-  man->Put(grpMap,id,metadata);
+  man->Put(grpObj,id,metadata);
 }
+
+
index 6e0fc9af4a9266d4de86460f2e5d4bcc98a1da99..19cce3f0070ff8368f84d38ef97b5efb35ca4cac 100644 (file)
 #pragma link C++ class AliEventInfo+;
 
 #pragma link C++ class AliRelAlignerKalman+;
+#pragma link C++ class AliGRPObject+;
 
 #endif
index f9965e2ad6b4b7c5f6e038383c0451d3caba9817..64f0a6d848128a1e2529d8a35255e03a16bd884b 100644 (file)
@@ -67,7 +67,8 @@ AliPlaneEff.cxx \
 AliTriggerRunScalers.cxx AliGRPPreprocessor.cxx \
 AliGRPRecoParam.cxx \
 AliRunInfo.cxx AliEventInfo.cxx \
-AliRelAlignerKalman.cxx
+AliRelAlignerKalman.cxx \
+AliGRPObject.cxx
 
 
 HDRS:= $(SRCS:.cxx=.h)