Adding the AliGRPPreprocessor and the AliGRPDCS classes in the repository - Global...
authorpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Dec 2006 16:13:39 +0000 (16:13 +0000)
committerpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Dec 2006 16:13:39 +0000 (16:13 +0000)
STEER/AliGRPDCS.cxx [new file with mode: 0644]
STEER/AliGRPDCS.h [new file with mode: 0644]
STEER/AliGRPPreprocessor.cxx [new file with mode: 0644]
STEER/AliGRPPreprocessor.h [new file with mode: 0644]
STEER/CDBLinkDef.h
STEER/libCDB.pkg

diff --git a/STEER/AliGRPDCS.cxx b/STEER/AliGRPDCS.cxx
new file mode 100644 (file)
index 0000000..7bdc0a1
--- /dev/null
@@ -0,0 +1,70 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------
+//                AliGRPDCS class
+//   This class deals with the DCS related info of the GRP
+//   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
+//-----------------------------------------------------------------
+
+#include "AliGRPDCS.h"
+
+#include "AliDCSValue.h"
+
+//#include <TObjString.h>
+class TObjString;
+
+#include <TH1.h>
+
+ClassImp(AliGRPDCS)
+
+//_______________________________________________________________
+AliGRPDCS::AliGRPDCS():
+  TObject(), fDCSArray(new TObjArray()) {
+  // default constructor
+  
+}
+
+//_______________________________________________________________
+AliGRPDCS::AliGRPDCS(TObjArray *dcsArray):
+  TObject() {
+  // constructor
+  fDCSArray = new TObjArray();
+  fDCSArray = dcsArray;
+}
+
+//___________________________________________________________________________
+AliGRPDCS::AliGRPDCS(const AliGRPDCS& grpDcs):
+  TObject(grpDcs) {
+  //copy constructor
+
+  if (grpDcs.fDCSArray) fDCSArray = new TObjArray();
+}
+
+//_______________________________________________________________
+const char* AliGRPDCS::ProcessDCS(TH1 *h) {
+  // process the dcs float values
+  Float_t fFDCSArraySum = 0.0, fFDCSArrayMean = 0.0;
+  for(Int_t i = 0; i < fDCSArray->GetEntries(); i++) {
+    AliDCSValue *v = (AliDCSValue *)fDCSArray->At(i);
+    h->Fill(v->GetFloat());
+    fFDCSArraySum += v->GetFloat();
+  }
+  fFDCSArrayMean = fFDCSArraySum/fDCSArray->GetEntries();
+  TString fDCSDataPointValue; fDCSDataPointValue += fFDCSArrayMean;
+
+  return fDCSDataPointValue.Data();
+}
+
diff --git a/STEER/AliGRPDCS.h b/STEER/AliGRPDCS.h
new file mode 100644 (file)
index 0000000..85f7512
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALI_GRP_DCS_H
+#define ALI_GRP_DCS_H
+
+//-------------------------------------------------------------------------
+//                          Class AliGRPDCS
+//   This class deals with the DCS related info of the GRP
+//
+//    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
+//-------------------------------------------------------------------------
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//                                                                      //
+//                        AliGRPDCS                                     //
+//                                                                      //
+//           Implementation of the class that processes                 //
+//           the DCS related fields of the GRP.                         //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+class TH1;
+
+class AliGRPDCS: public TObject {
+ public:
+  AliGRPDCS();
+  AliGRPDCS(TObjArray *dcsArray);
+  AliGRPDCS(const AliGRPDCS& grpDcs);
+
+  void SetObjArray(TObjArray *dcsSArray) {fDCSArray = dcsSArray;}
+  const char *ProcessDCS(TH1 *h);  
+  
+ private:
+  
+  TObjArray *fDCSArray; //TObjArray for a dcs data point
+  
+  AliGRPDCS & operator=(const AliGRPDCS & ) {return *this;}
+
+  ClassDef(AliGRPDCS, 0);
+};
+
+#endif
diff --git a/STEER/AliGRPPreprocessor.cxx b/STEER/AliGRPPreprocessor.cxx
new file mode 100644 (file)
index 0000000..f00c3e9
--- /dev/null
@@ -0,0 +1,126 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+//-------------------------------------------------------------------------
+//                          Class AliGRPPreprocessor
+//                  Global Run Parameters (GRP) preprocessor
+//    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
+//-------------------------------------------------------------------------
+
+#include "AliGRPPreprocessor.h"
+#include "AliGRPDCS.h"
+
+#include "AliCDBMetaData.h"
+#include "AliLog.h"
+
+#include <TTimeStamp.h>
+#include <TMap.h>
+#include <TObjString.h>
+
+class AliDCSValue;
+class AliShuttleInterface;
+
+#include <TH1.h>
+
+ClassImp(AliGRPPreprocessor)
+
+//_______________________________________________________________
+AliGRPPreprocessor::AliGRPPreprocessor():
+  AliPreprocessor("GRP",0) {
+  // default constructor - Don't use this!
+  
+}
+
+//_______________________________________________________________
+AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle):
+  AliPreprocessor("GRP",shuttle) {
+  // constructor - shuttle must be instantiated!
+  
+}
+
+//_______________________________________________________________
+AliGRPPreprocessor::~AliGRPPreprocessor() {
+  //destructor
+}
+
+//_______________________________________________________________
+void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) {
+  // Initialize preprocessor
+  
+  AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
+  
+  fRun = run;
+  fStartTime = startTime;
+  fEndTime = endTime;
+  AliInfo("This preprocessor is to test the GetRunParameter function.");
+}
+
+//_______________________________________________________________
+UInt_t AliGRPPreprocessor::Process(TMap* valueMap) {
+  // process data retrieved by the Shuttle
+  const char* timeStart = GetRunParameter("time_start");
+  const char* timeEnd = GetRunParameter("time_end");
+  TObjArray *alias1 = (TObjArray *)valueMap->GetValue("SFTTemp1.FloatValue");
+  AliGRPDCS *dcs = new AliGRPDCS(alias1);
+  TH1F *h1 = new TH1F("alias1","",100,15,25);
+  TString sAlias1Mean = dcs->ProcessDCS(h1);  
+  
+  Int_t result=0;
+  
+  if (sAlias1Mean) {
+    Log(Form("<alias1> for run %d: %s",fRun, sAlias1Mean.Data()));
+  } else {
+    Log(Form("DCSAlias1 not put in TMap!"));
+  }
+  if (timeStart) {
+    Log(Form("Start time for run %d: %s",fRun, timeStart));
+  } else {
+    Log(Form("Start time not put in logbook!"));
+  }
+  if (timeEnd) {
+    Log(Form("End time for run %d: %s",fRun, timeEnd));
+  } else {
+    Log(Form("End time not put in logbook!"));
+  }
+  
+  TList *values = new TList();
+  values->SetOwner(1);
+  
+  TMap *map1 = new TMap();
+  map1->Add(new TObjString("histoDCS1"),h1);
+  values->Add(map1);
+
+  TMap *map2 = new TMap();
+  map2->Add(new TObjString("DCS1"),new TObjString(sAlias1Mean));
+  values->Add(map2);
+
+  TMap *map3 = new TMap();
+  map3->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart));
+  values->Add(map3);
+
+  TMap *map4 = new TMap();
+  map4->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd));
+  values->Add(map4);
+
+  AliCDBMetaData md;
+  md.SetResponsible("Panos");
+  
+  result = Store("GRP", "Values", values, &md);
+  
+  delete values;
+  
+  return result;
+}
+
diff --git a/STEER/AliGRPPreprocessor.h b/STEER/AliGRPPreprocessor.h
new file mode 100644 (file)
index 0000000..d52dfa7
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALIGRPPREPROCESSOR_H
+#define ALIGRPPREPROCESSOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//-------------------------------------------------------------------------
+//                          Class AliGRPPreprocessor
+//                  Global Run Parameters (GRP) preprocessor
+//
+//    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
+//-------------------------------------------------------------------------
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//                                                                      //
+//                        AliGRPPreprocessor                            //
+//                                                                      //
+//           Implementation of the GRP preprocessor                     //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////
+
+#include "AliPreprocessor.h"
+
+class AliGRPPreprocessor: public AliPreprocessor {
+ public:
+  AliGRPPreprocessor();
+  AliGRPPreprocessor(AliShuttleInterface* shuttle);
+  virtual ~AliGRPPreprocessor();
+  
+ protected:
+
+  virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+  
+  virtual UInt_t Process(TMap* valueSet);
+  
+  ClassDef(AliGRPPreprocessor, 0);
+};
+
+#endif
index bfbf90a..2089793 100644 (file)
@@ -33,4 +33,7 @@
 
 #pragma link C++ class AliShuttleInterface;
 
+#pragma link C++ class AliGRPPreprocessor;
+#pragma link C++ class AliGRPDCS;
+
 #endif
index bf345c4..f27adf8 100644 (file)
@@ -1,7 +1,8 @@
 SRCS          = AliCDBEntry.cxx AliCDBId.cxx AliCDBMetaData.cxx \
 AliCDBPath.cxx AliCDBRunRange.cxx AliCDBManager.cxx \
 AliCDBStorage.cxx AliCDBLocal.cxx AliCDBDump.cxx AliCDBGrid.cxx \
-AliDCSValue.cxx AliPreprocessor.cxx AliShuttleInterface.cxx
+AliDCSValue.cxx AliPreprocessor.cxx AliShuttleInterface.cxx \
+AliGRPPreprocessor.cxx AliGRPDCS.cxx
 
 HDRS:= $(SRCS:.cxx=.h)
 
@@ -10,5 +11,6 @@ DHDR= CDBLinkDef.h
 EXPORT:= AliCDBEntry.h AliCDBId.h AliCDBMetaData.h \
 AliCDBPath.h AliCDBRunRange.h AliCDBManager.h \
 AliCDBStorage.h AliCDBLocal.h AliCDBDump.h AliCDBGrid.h \
-AliDCSValue.h AliPreprocessor.h  AliShuttleInterface.h
+AliDCSValue.h AliPreprocessor.h  AliShuttleInterface.h \
+AliGRPPreprocessor.h AliGRPDCS.h