--- /dev/null
+#-*- Mode: Makefile -*-
+# $Id$
+
+CLASS_HDRS:= AliHLTPredictionProcessorInterface.h \
+ AliHLTPendolino.h \
+ AliHLTPendolinoLoggerOStream.h \
+ AliHLTPredictionProcessorDummy.h \
+ AliHLTPendolinoLoggerDump.h \
+ HLT/AliHLTPredicProcTempMonitor.h \
+ HLT/AliHLTPredictionProcessorHLT.h \
+ MUON/AliHLTPredictionProcessorMCH.h \
+ MUON/AliHLTPredictionProcessorMTR.h \
+ TPC/AliHLTDCSArray.h \
+ TPC/AliHLTPredictionProcessorTPC.h
+
+MODULE_SRCS:= $(CLASS_HDRS:.h=.cxx)
+
+MODULE_HDRS:= $(CLASS_HDRS)
+
+MODULE_DHDR:=
+
+EINCLUDE := HLT/pendolino HLT/BASE STEER
+
+LIBRARY_DEP := -lHLTbase
+
+include $(MODDIR)/hlt.conf
+
+SRCS:=$(patsubst %,pendolino/%,$(MODULE_SRCS))
+CINTHDRS:=$(patsubst %,pendolino/%,$(CLASS_HDRS))
+HDRS:=$(patsubst %,pendolino/%,$(MODULE_HDRS))
+DHDR:=$(patsubst %,pendolino/%,$(MODULE_DHDR))
+CINTAUTOLINK:= $(shell test "x$(MODULE_DHDR)" = "x" && echo 1)
+
+EDEFINE := ${HLTDEFS}
+PACKCXXFLAGS := ${HLTCXXFLAGS} -DLIBHLTREC_VERSION=$(LIBHLTPENDOLINO_VERSION)
+PACKCFLAGS := ${HLTCLFAGS}
+PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
+PACKSOFLAGS := $(HLTSOFLAGS)
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Sebastian Bablok <Sebastian.Bablok@ift.uib.no> *
+//* for The ALICE HLT Project. *
+//* *
+//* 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. *
+//**************************************************************************
+
+/** @file AliHLTPredicProcTempMonitor.cxx
+ @author Sebastian Bablok
+ @date
+ @brief
+*/
+
+#include "AliHLTPredicProcTempMonitor.h"
+
+#include <AliCDBMetaData.h>
+#include <AliCDBEntry.h>
+#include <AliDCSValue.h>
+
+#include <TMap.h>
+#include <TObjString.h>
+#include <TObjArray.h>
+
+#include <TTimeStamp.h>
+
+
+ClassImp(AliHLTPredicProcTempMonitor)
+
+
+const TString AliHLTPredicProcTempMonitor::kPath2("CalibMonitor");
+
+const TString AliHLTPredicProcTempMonitor::kPath3("DCSTempMon");
+
+const TString AliHLTPredicProcTempMonitor::kCreator("S. Bablok (HLT)");
+
+const TString AliHLTPredicProcTempMonitor::kComment("Calib Object for monitoring DCS temperature values in HLT.");
+
+const TString AliHLTPredicProcTempMonitor::kAliRootVersion("");
+
+const UInt_t AliHLTPredicProcTempMonitor::kUnableToStoreObject = 7;
+
+//const TString AliHLTPredicProcTempMonitor::kAmandaTempSensor = "TPC_PT_%d_TEMPERATURE";
+
+
+AliHLTPredicProcTempMonitor::AliHLTPredicProcTempMonitor(
+ const char* detector, AliHLTPendolino* pendolino) :
+ AliHLTPredictionProcessorInterface(detector, pendolino) {
+ // C-tor for AliHLTPredicProcTempMonitor
+ mPredict = true;
+ mRun = 0;
+ mStartTime = 0;
+ mEndTime = 0;
+}
+
+
+AliHLTPredicProcTempMonitor::~AliHLTPredicProcTempMonitor() {
+ // D-tor for AliHLTPredicProcTempMonitor
+
+}
+
+
+UInt_t AliHLTPredicProcTempMonitor::makePrediction(Bool_t doPrediction) {
+ // switch for prediction making in AliHLTPredicProcTempMonitor
+ Log("AliHLTPredicProcTempMonitor + B-Field extractor: prediction switched on");
+ mPredict = doPrediction;
+ return 0;
+}
+
+
+void AliHLTPredicProcTempMonitor::Initialize(Int_t run, UInt_t startTime,
+ UInt_t endTime) {
+ // initializes AliHLTPredicProcTempMonitor
+ mRun = run;
+ mStartTime = startTime;
+ mEndTime = endTime;
+
+ TString msg("Initialized HLT PredictionProcessor; Run: ");
+ msg += mRun;
+ msg += ", start time: ";
+ msg += mStartTime;
+ msg += ", end time: ";
+ msg += mEndTime;
+ msg += ".";
+ Log(msg.Data());
+}
+
+
+UInt_t AliHLTPredicProcTempMonitor::Process(TMap* dcsAliasMap) {
+ // processes the DCS value map in AliHLTPredicProcTempMonitor
+ UInt_t beamPeriod = 0;
+
+ UInt_t retVal = 0;
+ UInt_t tempRet = 0;
+ Int_t start = 0;
+ TMap* tempMap = 0;
+ Bool_t infiniteValid = kFALSE;
+
+
+ //test GetFromOCDB() calls
+ AliCDBEntry* entry = GetFromOCDB(kPath2.Data(), kPath3.Data());
+ if (entry == 0) {
+ // No object in HCDB -> discarding old values
+ TString msg("No '" + kPath2 + "/" + kPath3 +
+ "' in HCDB, most likely first round, filling object now...");
+ Log(msg.Data());
+ tempMap = dcsAliasMap;
+
+ } else {
+ Log("Old data is already stored in HCDB, but now discarding that...");
+ tempMap = dcsAliasMap;
+
+// If old data shall be included use lines below and uncomment lines above
+/*
+ Log("Adding new DCS value to old Temperature map...");
+ // Adding new DCS values to old Temperature map
+ tempMap = (TMap*) entry->GetObject();
+
+ TMapIter iter(dcsAliasMap); // iterator for values in TMap
+ TObject* aKey;
+
+ while ((aKey = iter.Next())) {
+ tempMap->Add(aKey, dcsAliasMap->GetValue(aKey));
+ }
+*/
+ }
+
+ AliCDBMetaData meta(kCreator.Data(), beamPeriod, kAliRootVersion.Data(),
+ kComment.Data());
+
+ if (Store(kPath2.Data(), kPath3.Data(), (TObject*) tempMap, &meta, start,
+ infiniteValid)) {
+ TString msg(" +++ Successfully stored object '" + kPath2 + "/" + kPath3 +
+ "' in HCDB.");
+ Log(msg.Data());
+ } else {
+ TString msg(" *** Storing of object '" + kPath2 + "/" + kPath3 +
+ "' in HCDB failed.");
+ Log(msg.Data());
+ retVal = kUnableToStoreObject;
+ }
+
+ // extract B-Field
+ tempRet = ExtractBField(dcsAliasMap);
+ retVal = tempRet & retVal; // combine retvals
+
+ return retVal;
+}
+
+UInt_t AliHLTPredicProcTempMonitor::ExtractBField(TMap* dcsAliasMap) {
+ // extracts the B-field value from DCS value map
+
+ TString stringId = "dcs_magnet:Magnet/ALICESolenoid.Current";
+
+ Float_t BField = 0;
+ Bool_t bRet = GetSensorValue(dcsAliasMap,stringId.Data(),&BField);
+
+ if (bRet) {
+ BField = BField / 60000; // If we get field, take this away and change SensorValue
+ TString dummy("-bfield ");
+ dummy += BField;
+ TObjString dummy2(dummy.Data());
+ mBField = dummy2;
+ Log(Form("BField set to %s", mBField.String().Data()));
+ } else {
+ return 1;
+ }
+
+ TString path2("Config");
+ TString path3("BField");
+ Int_t start = 0;
+
+ TString comment("BField");
+ AliCDBMetaData meta(this->GetName(), 0, "unknownAliRoot", comment.Data());
+
+ if (Store(path2.Data(), path3.Data(), (TObject*) (&mBField), &meta, start,
+ kTRUE)) {
+ Log(" +++ Successfully stored object ;-)");
+ } else {
+ Log(" *** Storing of OBJECT failed!!");
+ return 7;
+ }
+
+ return 0;
+}
+
+Bool_t AliHLTPredicProcTempMonitor::GetSensorValue(TMap* dcsAliasMap,
+ const char* stringId, Float_t *value) {
+ // retreives the sensor value
+ // return last value read from sensor specified by stringId
+
+ TObjArray* valueSet;
+ TPair* pair = (TPair*) (dcsAliasMap->FindObject(stringId));
+ if (pair) {
+ valueSet = (TObjArray*) (pair->Value());
+ if (valueSet) {
+ Int_t nentriesDCS = (valueSet->GetEntriesFast()) - 1;
+ if (nentriesDCS >= 0) {
+ AliDCSValue* val = (AliDCSValue*) (valueSet->At(nentriesDCS));
+ if (val) {
+ *value = val->GetFloat();
+ return kTRUE;
+ }
+ }
+ }
+ }
+ return kFALSE;
+}
+
+TMap* AliHLTPredicProcTempMonitor::produceTestData(TString aliasName) {
+ // produces test data for AliHLTPredicProcTempMonitor
+ TMap* resultMap = 0;
+
+ // here has to come real dummy data :-)
+ resultMap = new TMap();
+ TTimeStamp tt;
+ Float_t fval = 33.3;
+ TObjString* name = new TObjString("DummyData");
+ AliDCSValue* val = new AliDCSValue(fval, tt.GetTime());
+ TObjArray* arr = new TObjArray();
+ arr->Add(val);
+ resultMap->Add(name, arr);
+
+ return resultMap;
+}
+
+
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALI_HLT_PREDICT_PROC_TEMP_MONITOR_H
+#define ALI_HLT_PREDICT_PROC_TEMP_MONITOR_H
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/** @file AliHLTPredicProcTempMonitor.h
+ @author Sebastian Bablok
+ @date
+ @brief
+*/
+
+#include "AliHLTPredictionProcessorInterface.h"
+
+#include <TObjString.h>
+
+
+/**
+ * Implementation of an AliHLTPredictionProcessor for monitoring DCS
+ * Temperatur values inside the HLT.
+ *
+ * @author Sebastian Bablok
+ * @author Gaute Oevrebekk (extention for B-Field)
+ *
+ * @date 2007-12-03
+ * @date 2008-03-04
+ */
+class AliHLTPredicProcTempMonitor : public AliHLTPredictionProcessorInterface {
+ public:
+
+ /** Static const defining path part 2 */
+ static const TString kPath2; // defining path part 2
+ /** Static const defining path part 3 */
+ static const TString kPath3; //defining path part 3
+ /** Static const defining creator of HCDB object */
+ static const TString kCreator; // defining creator of HCDB object
+ /** Static const defining comment for HCDB object */
+ static const TString kComment; // defining comment for HCDB object
+ /** Static const defining aliroot version */
+ static const TString kAliRootVersion; // defining aliroot version
+ /** Static const defining error ret val for storage error */
+ static const UInt_t kUnableToStoreObject; // defining error ret val for storage error
+// static const TString kAmandaTempSensor;
+
+ /**
+ * Constructor for AliHLTPredictionProcessorDummy
+ *
+ * @param detector string defining the detector to which the
+ * PredictionProcessor belongs to
+ * @param pendolino pointer to the hosting pendolino (derived from
+ * AliShuttleInterface)
+ */
+ AliHLTPredicProcTempMonitor(const char* detector,
+ AliHLTPendolino* pendolino);
+
+ /**
+ * Destructor for AliHLTPredictionProcessorDummy
+ */
+ virtual ~AliHLTPredicProcTempMonitor();
+
+ /**
+ * Pure virtual function to force the Prediction Processor to implement
+ * a function to flag that prediction making is required.
+ * This function is called by the Pendolino before the fetched DCS data
+ * is handed in for (prediction) processing.
+ *
+ * @param doPrediction if true, prediction making shall be switched on,
+ * if false, switched off.
+ *
+ * @return 0 on success; a value greater than 0 refers to an error
+ */
+ virtual UInt_t makePrediction(Bool_t doPrediction = true);
+
+ /**
+ * Pure Virtual function, implemented in the detector specific
+ * PredictionProcessors to initialize them.
+ *
+ * @param run run number
+ * @param startTime start time of data
+ * @param endTime end time of data
+ */
+ virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+
+ /**
+ * Function called by the Pendolino for each participating subdetector
+ * producing the required condition settings. This includes the
+ * encoding of a prediction to the values due to the fact, that only
+ * data up to now can be fetched from DCS (the latest data can also be
+ * up to 2 min old until it is received on HLT side). To write the data
+ * to the HCDB, the detector specific implementation of this class has
+ * to call the appropriated storing function provided by the interface.
+ *
+ * @param dcsAliasMap the map containing aliases and corresponding DCS
+ * values and timestamps
+ *
+ * @return 0 on success; a value greater than 0 refers to an error
+ */
+ virtual UInt_t Process(TMap* dcsAliasMap);
+
+ /**
+ * Indicates if DCS data shall be processed.
+ * NOTE: should always return true, since it is used as prediction
+ * processor, which will only process DCS data
+ *
+ * @return true if DCS data can be processed, else false. Note: if false
+ * the Pendolino would stop, so make sure that it is true.
+ */
+ virtual Bool_t ProcessDCS();
+
+ /**
+ * Function to let the PredictionProcessor produce dummy input data,
+ * that can be used in Pendolino tests, where no DCS Archieve DB is
+ * contacted. This function is called by the Pendolino, the result is
+ * given back to the PredictionProcessor via the Process(...) call.
+ * Since the DCSMaps requested from DCS are detector specific, the
+ * PredictionProcessor should know, how the maps look like, that it
+ * expects.
+ * NOTE: The clean - up (delete) of the TMap will be performed by the
+ * Pendolino after the usage. The PredictionProcessor has never to
+ * call delete on the returned TMap pointer.
+ *
+ * @param aliasName optional parameter, that can be given in order to
+ * create a DCSMap for dedicated aliases. For a general test
+ * this paramter should be empty. If more than one alias name
+ * shall be specified, they are separated by blanks " ".
+ *
+ * @return DCSMap containing dummy data for testing the Pendolino.
+ */
+ virtual TMap* produceTestData(TString aliasName = "");
+
+
+ protected:
+
+ /**
+ * Function to extract the B-Field from the DCS map.
+ *
+ * @param dcsAliasMap the DCS map, containing the AliDCSValues
+ *
+ * @return 0 in case of success, else an error code
+ */
+ UInt_t ExtractBField(TMap* dcsAliasMap);
+
+ /**
+ * Function to extract a float AliDCSValue by its name from the DCS map
+ *
+ * @param dcsAliasMap the DCS value map
+ * @param stringId the name of the desired AliDCSValue - float
+ * @param value pointer to a float, where the extratced value shall be stored
+ * (out parameter)
+ *
+ * @return true in case of success, else false
+ */
+ Bool_t GetSensorValue(TMap* dcsAliasMap, const char* stringId,
+ Float_t* value);
+
+ private:
+ /**
+ * Disabled Copy constructor
+ * (parent class is disabled so derived class does the same)
+ */
+ AliHLTPredicProcTempMonitor(
+ const AliHLTPredicProcTempMonitor& predictPro);
+
+ /**
+ * Disabled Assignment operator
+ * (parent class is disabled so derived class does the same)
+ */
+ AliHLTPredicProcTempMonitor& operator=(
+ const AliHLTPredicProcTempMonitor& rhs);
+
+
+ /**
+ * Function to extract the actual values from the DCSMap
+ *
+ * @param inputMap pointer to the DCSMap as input
+ * @param outputMap pointer to the Map where to store the extracted
+ * values
+ *
+ * @return true in case of success, else false
+ */
+// Bool_t extractTempvalues(TMap* inputMap, TMap* outputMap);
+
+ /**
+ * Stores if prediction shall be made
+ */
+ Bool_t mPredict; // flag for prediction making
+
+ /**
+ * Stores the run number
+ */
+ Int_t mRun; // Stores the run number
+
+ /**
+ * Stores the start time of the to process DCS data
+ */
+ UInt_t mStartTime; // Stores the start time of the to process DCS data
+
+ /**
+ * Stores the end time of the to process DCS data
+ */
+ UInt_t mEndTime; // Stores the end time of the to process DCS data
+
+ /**
+ * Stores the extracted B-Field in a TObjString
+ */
+ TObjString mBField; // Stores the extracted B-Field in a TObjString
+
+ /** ClassDef of AliHLTPredicProcTempMonitor for AliRoot */
+ ClassDef(AliHLTPredicProcTempMonitor, 2);
+
+};
+
+
+inline Bool_t AliHLTPredicProcTempMonitor::ProcessDCS() {
+ // indicates if DCS values are processed; always true
+ return true;
+}
+
+#endif
+
+
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Gaute Ovrebekk *
+//* for The ALICE HLT Project. *
+//* *
+//* 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. *
+//**************************************************************************
+
+/** @file AliHLTPredictionProcessorHLT.cxx
+ @author Gaute Ovrebekk
+ @date
+ @brief
+*/
+
+#include "AliHLTPredictionProcessorHLT.h"
+
+#include <AliCDBMetaData.h>
+#include <AliCDBEntry.h>
+
+// new
+#include <TObjArray.h>
+#include <AliDCSValue.h>
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+
+
+ClassImp(AliHLTPredictionProcessorHLT)
+
+AliHLTPredictionProcessorHLT::AliHLTPredictionProcessorHLT(
+ const char* detector, AliHLTPendolino* pendolino) :
+ AliHLTPredictionProcessorInterface(detector, pendolino) {
+ // C-tor for AliHLTPredictionProcessorHLT
+ mPredict = false;
+ mRun = 0;
+ mStartTime = 0;
+ mEndTime = 0;
+ mBField = 0;
+}
+
+
+AliHLTPredictionProcessorHLT::~AliHLTPredictionProcessorHLT() {
+ // D-tor for AliHLTPredictionProcessorHLT
+}
+
+
+UInt_t AliHLTPredictionProcessorHLT::makePrediction(Bool_t doPrediction) {
+ // switch for prediction making
+ Log("Prediction switched on");
+ mPredict = doPrediction;
+ return 0;
+}
+
+
+void AliHLTPredictionProcessorHLT::Initialize(Int_t run, UInt_t startTime,
+ UInt_t endTime) {
+ // initializes AliHLTPredictionProcessorHLT
+ mRun = run;
+ mStartTime = startTime;
+ mEndTime = endTime;
+
+ TString msg("Initialized HLT PredictProc. Run: ");
+ msg += mRun;
+ msg += ", start time: ";
+ msg += mStartTime;
+ msg += ", end time: ";
+ msg += mEndTime;
+ msg += ".";
+ Log(msg.Data());
+
+ if (mPredict) {
+ Log("HLT PredictProc has prediction switched ON.");
+ } else {
+ Log("Prediction is switched OFF.");
+ }
+}
+
+
+UInt_t AliHLTPredictionProcessorHLT::Process(TMap* dcsAliasMap) {
+ // processes the DCS value map
+
+ if (!dcsAliasMap) return 9;
+ if (dcsAliasMap->GetEntries() == 0 ) return 9;
+
+ UInt_t retVal = 0;
+ Int_t start = 0;
+ TString path2("ConfigHLT"); // "Config"
+ TString path3("SolenoidBz"); // "BField"
+
+ UInt_t BFieldResult = ExtractBField(dcsAliasMap);
+
+ if (BFieldResult != 0) {
+ Log(" *** Extraction of BField failed - no entry for HCDB!!");
+ return 8;
+ }
+
+
+ //transform dcsAliasMap to ROOT object
+ TString comment("BField");
+ AliCDBMetaData meta(this->GetName(), 0, "unknownAliRoot",comment.Data());
+
+ if (Store(path2.Data(),path3.Data(),(TObject*) &mBField,&meta,start,kTRUE)) {
+ Log(" +++ Successfully stored object ;-)");
+ } else {
+ Log(" *** Storing of OBJECT failed!!");
+ retVal = 7;
+ }
+
+ return retVal;
+}
+
+UInt_t AliHLTPredictionProcessorHLT::ExtractBField(TMap* dcsAliasMap){
+ // extracts the b-field from DCS value map
+// TString stringId = "dcs_magnet:Magnet/ALICESolenoid.Current"; // old name
+ TString stringId = "L3Current";
+
+ Float_t BField = 0;
+ Bool_t bRet = GetSensorValue(dcsAliasMap,stringId.Data(),&BField);
+
+ if(bRet){
+ // new
+ BField = BField/60000; // If we get field, take this away and change SensorValue
+ TString dummy("-solenoidBz");
+ dummy += BField;
+ TObjString dummy2(dummy.Data());
+ mBField = dummy2;
+
+ Log(Form("BField set to %s",mBField.String().Data()));
+ return 0;
+ }
+
+ return 1;
+
+}
+
+Bool_t AliHLTPredictionProcessorHLT::GetSensorValue(TMap* dcsAliasMap,
+ const char* stringId, Float_t *value)
+{
+ // extracts the sensor value
+ // return last value read from sensor specified by stringId
+
+ TObjArray* valueSet;
+ TPair* pair = (TPair*)dcsAliasMap->FindObject(stringId);
+ if (pair) {
+ valueSet = (TObjArray*)pair->Value();
+ Int_t nentriesDCS = valueSet->GetEntriesFast() - 1;
+ if(nentriesDCS>=0){
+ AliDCSValue *val = (AliDCSValue *)valueSet->At(nentriesDCS);
+ //new
+ *value=val->GetFloat();
+ return kTRUE;
+ }
+ }
+ return kFALSE;
+}
+
+TMap* AliHLTPredictionProcessorHLT::produceTestData(TString aliasName) {
+ // produces test data for AliHLTPredictionProcessorHLT
+ TMap* resultMap = 0;
+
+ // here has to come real dummy data :-)
+ resultMap = new TMap();
+ TTimeStamp tt;
+ Float_t fval = 33.3;
+ TObjString* name = new TObjString("DummyData");
+ AliDCSValue* val = new AliDCSValue(fval, tt.GetTime());
+ TObjArray* arr = new TObjArray();
+ arr->Add(val);
+ resultMap->Add(name, arr);
+
+ return resultMap;
+}
+
+
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALI_HLT_PREDICTION_PROCESSOR_HLT_H
+#define ALI_HLT_PREDICTION_PROCESSOR_HLT_H
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/** @file AliHLTPredictionProcessorHLT.h
+ @author Gaute Ovrebekk
+ @date
+ @brief
+*/
+
+#include "AliHLTPredictionProcessorInterface.h"
+
+//new
+#include <TObjString.h>
+
+
+/**
+ * Predition Processor for prepering b-field values for general HLT components.
+ *
+ * @author Sebastian Bablok, Gaute Ovrebekk
+ *
+ * @date 2007-10-24
+ */
+class AliHLTPredictionProcessorHLT : public AliHLTPredictionProcessorInterface {
+ public:
+
+ /**
+ * Constructor for AliHLTPredictionProcessorHLT
+ *
+ * @param detector string defining the detector to which the
+ * PredictionProcessor belongs to
+ * @param pendolino pointer to the hosting pendolino (derived from
+ * AliShuttleInterface)
+ */
+ AliHLTPredictionProcessorHLT(const char* detector,
+ AliHLTPendolino* pendolino);
+
+ /**
+ * Destructor for AliHLTPredictionProcessorHLT
+ */
+ virtual ~AliHLTPredictionProcessorHLT();
+
+ /**
+ * Virtual function to force the Prediction Processor to implement
+ * a function to flag that prediction making is required.
+ * This function is called by the Pendolino before the fetched DCS data
+ * is handed in for (prediction) processing.
+ *
+ * @param doPrediction if true, prediction making shall be switched on,
+ * if false, switched off.
+ *
+ * @return 0 on success; a value greater than 0 refers to an error
+ */
+ virtual UInt_t makePrediction(Bool_t doPrediction = true);
+
+ /**
+ * Virtual function, implemented in the detector specific
+ * PredictionProcessors to initialize them.
+ *
+ * @param run run number
+ * @param startTime start time of data
+ * @param endTime end time of data
+ */
+ virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+
+ /**
+ * Function called by the Pendolino for each participating subdetector
+ * producing the required condition settings. This includes the
+ * encoding of a prediction to the values due to the fact, that only
+ * data up to now can be fetched from DCS (the latest data can also be
+ * up to 2 min old until it is received on HLT side). To write the data
+ * to the HCDB, the detector specific implementation of this class has
+ * to call the appropriated storing function provided by the interface.
+ *
+ * @param dcsAliasMap the map containing aliases and corresponding DCS
+ * values and timestamps
+ *
+ * @return 0 on success; a value greater than 0 refers to an error
+ */
+ virtual UInt_t Process(TMap* dcsAliasMap);
+
+ /**
+ * Indicates if DCS data shall be processed.
+ * NOTE: should always return true, since it is used as prediction
+ * processor, which will only process DCS data
+ *
+ * @return true if DCS data can be processed, else false. Note: if false
+ * the Pendolino would stop, so make sure that it is true.
+ */
+ virtual Bool_t ProcessDCS();
+
+ /**
+ * Function to let the PredictionProcessor produce dummy input data,
+ * that can be used in Pendolino tests, where no DCS Archieve DB is
+ * contacted. This function is called by the Pendolino, the result is
+ * given back to the PredictionProcessor via the Process(...) call.
+ * Since the DCSMaps requested from DCS are detector specific, the
+ * PredictionProcessor should know, how the maps look like, that it
+ * expects.
+ * NOTE: The clean - up (delete) of the TMap will be performed by the
+ * Pendolino after the usage. The PredictionProcessor has never to
+ * call delete on the returned TMap pointer.
+ *
+ * @param aliasName optional parameter, that can be given in order to
+ * create a DCSMap for dedicated aliases. For a general test
+ * this paramter should be empty. If more than one alias name
+ * shall be specified, they are separated by blanks " ".
+ *
+ * @return DCSMap containing dummy data for testing the Pendolino.
+ */
+ virtual TMap* produceTestData(TString aliasName = "");
+
+
+ protected:
+
+ private:
+ /**
+ * Disabled Copy constructor
+ * (parent class is disabled so derived class does the same)
+ */
+ AliHLTPredictionProcessorHLT(
+ const AliHLTPredictionProcessorHLT& predictPro);
+
+ /**
+ * Disabled Assignment operator
+ * (parent class is disabled so derived class does the same)
+ */
+ AliHLTPredictionProcessorHLT& operator=(
+ const AliHLTPredictionProcessorHLT& rhs);
+
+
+ /**
+ * TObjstring which stores the B-field value
+ */
+ TObjString mBField; // TObjstring which stores the B-field value
+
+ /**
+ * Stores if prediction shall be made
+ */
+ Bool_t mPredict; // flag for prediction making
+
+ /**
+ * Stores the run number
+ */
+ Int_t mRun; // Stores the run number
+
+ /**
+ * Stores the start time of the to process DCS data
+ */
+ UInt_t mStartTime; // Stores the start time of the to process DCS data
+
+ /**
+ * Stores the end time of the to process DCS data
+ */
+ UInt_t mEndTime; // Stores the end time of the to process DCS data
+
+ /**
+ * Function to extract the B-field from the DCS value map
+ *
+ * @param dcsAliasMap the retrieved DCS value map
+ *
+ * @return 0 on sucess else an error code
+ */
+ UInt_t ExtractBField(TMap* dcsAliasMap);
+
+ /**
+ * Function to rertieve a sensor value from the DCS value map
+ *
+ * @param dcsAliasMap the retrieved DCS value map
+ * @param stringId the alias name of the desired sensor value
+ * @param value [return parameter] - the extracted sensor value
+ *
+ * @return true if sucessful, else false
+ */
+ Bool_t GetSensorValue(TMap* dcsAliasMap,const char* stringId, Float_t * value);
+
+ ClassDef(AliHLTPredictionProcessorHLT, 0);
+
+};
+
+
+inline Bool_t AliHLTPredictionProcessorHLT::ProcessDCS() {
+ // indicates if DCS values are processed; always true
+ return true;
+}
+
+#endif
+
+
--- /dev/null
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
+ * *
+ * Primary Authors: *
+ * Artur Szostak <artursz@iafrica.com> *
+ * *
+ * 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$ */
+
+///
+/// @file AliHLTPredictionProcessorMCH.cxx
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date
+/// @brief Implementation of the AliHLTPredictionProcessorMCH class.
+///
+
+#include "AliHLTPredictionProcessorMCH.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBEntry.h"
+#include <cstdlib>
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TObjArray.h>
+#include <AliDCSValue.h>
+
+ClassImp(AliHLTPredictionProcessorMCH);
+
+
+AliHLTPredictionProcessorMCH::AliHLTPredictionProcessorMCH(
+ const char* detector, AliHLTPendolino* pendolino
+ ) :
+ AliHLTPredictionProcessorInterface(detector, pendolino),
+ fPredict(kTRUE)
+{
+ /// The class constructor for the preprocessor.
+ /// @param detector The detector name, which must be "MCH".
+ /// @param pendolino A valid pointer to the pendolino instance.
+
+ if (strcmp(detector, "MCH") != 0)
+ {
+ Log(Form("Warning: Setting the detector name to an incorrect value = '%s'."
+ " It must be set to 'MCH'.", detector)
+ );
+ }
+}
+
+
+AliHLTPredictionProcessorMCH::~AliHLTPredictionProcessorMCH()
+{
+ /// Default destructor.
+}
+
+
+UInt_t AliHLTPredictionProcessorMCH::makePrediction(Bool_t doPrediction)
+{
+ /// This function is called by the Pendolino before the fetched DCS data
+ /// is handed in for (prediction) processing.
+ ///
+ /// @param doPrediction If true then preprocessed data will be extrapolated
+ /// to the current time. Otherwise no extrapolation will be
+ /// performed if false. The default is to perform extrapolations.
+ ///
+ /// @return Currently always returns 0 for success.
+
+ fPredict = doPrediction;
+ return 0;
+}
+
+
+void AliHLTPredictionProcessorMCH::Initialize(
+ Int_t run, UInt_t startTime, UInt_t endTime
+ )
+{
+ /// Performs initialisation of the preprocessor.
+ /// At the moment just basic sanity checks are performed.
+ ///
+ /// @param run The current run number.
+ /// @param startTime The start time (earliest timestamp) of the data.
+ /// @param endTime The end time (latest timestamp) of the data.
+
+ if (startTime > endTime)
+ Log("Error: start time is greater than end time.");
+
+ AliPreprocessor::Initialize(run, startTime, endTime);
+
+ if (fPredict)
+ Log("Prediction is switched ON.");
+ else
+ Log("Prediction is switched OFF.");
+}
+
+
+UInt_t AliHLTPredictionProcessorMCH::Process(TMap* dcsAliasMap)
+{
+ /// Process the DCS values.
+ /// At the moment nothing is done here.
+ ///
+ /// @param dcsAliasMap The map containing aliases and corresponding DCS
+ /// values and timestamps
+ ///
+ /// @return At the moment 0 is always returned for success.
+
+ Log("Processing MCH");
+ return 0;
+}
+
+TMap* AliHLTPredictionProcessorMCH::produceTestData(TString aliasName) {
+ TMap* resultMap = 0;
+
+ // here has to come real dummy data :-)
+ resultMap = new TMap();
+ TTimeStamp tt;
+ Float_t fval = 33.3;
+ TObjString* name = new TObjString("DummyData");
+ AliDCSValue* val = new AliDCSValue(fval, tt.GetTime());
+ TObjArray* arr = new TObjArray();
+ arr->Add(val);
+ resultMap->Add(name, arr);
+
+ return resultMap;
+}
+
+
--- /dev/null
+#ifndef ALIHLTPREDICTIONPROCESSORMCH_H
+#define ALIHLTPREDICTIONPROCESSORMCH_H
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+///
+/// @file AliHLTPredictionProcessorMCH.h
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date 2007-11-24
+/// @brief Declaration of the muon tracking chamber prediction processor.
+///
+
+#include "AliHLTPredictionProcessorInterface.h"
+
+/**
+ * This is the prediction processor for the muon tracking chambers.
+ * It is required as part of the Pendolino interface so that data fetched from
+ * DCS can be transformed and extrapolated into a format suitable for the HCDB.
+ *
+ * At the moment this class does not really do anything, but will fill the
+ * HCDB with data in the future.
+ *
+ * Refer to:
+ * http://wiki.kip.uni-heidelberg.de/ti/HLT/index.php/Pendolino-PredictionProcessor-Interface
+ * for more details about the Pendolino and preprocessor interfaces.
+ */
+class AliHLTPredictionProcessorMCH : public AliHLTPredictionProcessorInterface
+{
+public:
+
+ /**
+ * The class constructor for the preprocessor.
+ * @param detector The detector name, which must be "MCH".
+ * @param pendolino A valid pointer to the pendolino instance.
+ */
+ AliHLTPredictionProcessorMCH(const char* detector, AliHLTPendolino* pendolino);
+
+ virtual ~AliHLTPredictionProcessorMCH();
+
+ // The following methods are inherited from AliHLTPredictionProcessorInterface.
+
+ /**
+ * This function is called by the Pendolino before the fetched DCS data
+ * is handed in for (prediction) processing.
+ *
+ * @param doPrediction If true then preprocessed data will be extrapolated
+ * to the current time. Otherwise no extrapolation will be
+ * performed if false. The default is to perform extrapolations.
+ *
+ * @return Currently always returns 0 for success.
+ */
+ virtual UInt_t makePrediction(Bool_t doPrediction = true);
+
+ /**
+ * Performs initialisation of the preprocessor.
+ * At the moment just basic sanity checks are performed.
+ *
+ * @param run The current run number.
+ * @param startTime The start time (earliest timestamp) of the data.
+ * @param endTime The end time (latest timestamp) of the data.
+ */
+ virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+
+ /**
+ * Process the DCS values.
+ * At the moment nothing is done here.
+ *
+ * @param dcsAliasMap The map containing aliases and corresponding DCS
+ * values and timestamps
+ *
+ * @return At the moment 0 is always returned for success.
+ */
+ virtual UInt_t Process(TMap* dcsAliasMap);
+
+ /**
+ * Indicates that the DCS data shall be processed.
+ * NOTE: should always return true, since it is used as prediction
+ * processor, which will only process DCS data
+ *
+ * @return Always returns the value kTRUE.
+ */
+ virtual Bool_t ProcessDCS() { return kTRUE; };
+
+ /**
+ * Function to let the PredictionProcessor produce dummy input data,
+ * that can be used in Pendolino tests, where no DCS Archieve DB is
+ * contacted. This function is called by the Pendolino, the result is
+ * given back to the PredictionProcessor via the Process(...) call.
+ * Since the DCSMaps requested from DCS are detector specific, the
+ * PredictionProcessor should know, how the maps look like, that it
+ * expects.
+ * NOTE: The clean - up (delete) of the TMap will be performed by the
+ * Pendolino after the usage. The PredictionProcessor has never to
+ * call delete on the returned TMap pointer.
+ *
+ * @param aliasName optional parameter, that can be given in order to
+ * create a DCSMap for dedicated aliases. For a general test
+ * this paramter should be empty. If more than one alias name
+ * shall be specified, they are separated by blanks " ".
+ *
+ * @return DCSMap containing dummy data for testing the Pendolino.
+ */
+ virtual TMap* produceTestData(TString aliasName = "");
+
+
+private:
+
+ // Do not allow copying of this class.
+ AliHLTPredictionProcessorMCH(const AliHLTPredictionProcessorMCH& /*obj*/);
+ AliHLTPredictionProcessorMCH& operator = (const AliHLTPredictionProcessorMCH& /*obj*/);
+
+ Bool_t fPredict; //! Flag indicating if the processed values should be extrapolated to current time.
+
+ ClassDef(AliHLTPredictionProcessorMCH, 0); // The prediction processor for the muon tracking chambers.
+};
+
+#endif // ALIHLTPREDICTIONPROCESSORMCH_H
--- /dev/null
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
+ * *
+ * Primary Authors: *
+ * Artur Szostak <artursz@iafrica.com> *
+ * *
+ * 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$ */
+
+///
+/// @file AliHLTPredictionProcessorMTR.cxx
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date
+/// @brief Implementation of the AliHLTPredictionProcessorMTR class.
+///
+
+#include "AliHLTPredictionProcessorMTR.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBEntry.h"
+#include <cstdlib>
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TObjArray.h>
+#include <AliDCSValue.h>
+
+ClassImp(AliHLTPredictionProcessorMTR);
+
+
+AliHLTPredictionProcessorMTR::AliHLTPredictionProcessorMTR(
+ const char* detector, AliHLTPendolino* pendolino
+ ) :
+ AliHLTPredictionProcessorInterface(detector, pendolino),
+ fPredict(kTRUE)
+{
+ /// The class constructor for the preprocessor.
+ /// @param detector The detector name, which must be "MTR".
+ /// @param pendolino A valid pointer to the pendolino instance.
+
+ if (strcmp(detector, "MTR") != 0)
+ {
+ Log(Form("Warning: Setting the detector name to an incorrect value = '%s'."
+ " It must be set to 'MTR'.", detector)
+ );
+ }
+}
+
+
+AliHLTPredictionProcessorMTR::~AliHLTPredictionProcessorMTR()
+{
+ /// Default destructor.
+}
+
+
+UInt_t AliHLTPredictionProcessorMTR::makePrediction(Bool_t doPrediction)
+{
+ /// This function is called by the Pendolino before the fetched DCS data
+ /// is handed in for (prediction) processing.
+ ///
+ /// @param doPrediction If true then preprocessed data will be extrapolated
+ /// to the current time. Otherwise no extrapolation will be
+ /// performed if false. The default is to perform extrapolations.
+ ///
+ /// @return Currently always returns 0 for success.
+
+ fPredict = doPrediction;
+ return 0;
+}
+
+
+void AliHLTPredictionProcessorMTR::Initialize(
+ Int_t run, UInt_t startTime, UInt_t endTime
+ )
+{
+ /// Performs initialisation of the preprocessor.
+ /// At the moment just basic sanity checks are performed.
+ ///
+ /// @param run The current run number.
+ /// @param startTime The start time (earliest timestamp) of the data.
+ /// @param endTime The end time (latest timestamp) of the data.
+
+ if (startTime > endTime)
+ Log("Error: start time is greater than end time.");
+
+ AliPreprocessor::Initialize(run, startTime, endTime);
+
+ if (fPredict)
+ Log("Prediction is switched ON.");
+ else
+ Log("Prediction is switched OFF.");
+}
+
+
+UInt_t AliHLTPredictionProcessorMTR::Process(TMap* dcsAliasMap)
+{
+ /// Process the DCS values.
+ /// At the moment nothing is done here.
+ ///
+ /// @param dcsAliasMap The map containing aliases and corresponding DCS
+ /// values and timestamps
+ ///
+ /// @return At the moment 0 is always returned for success.
+
+ Log("Processing MTR");
+ return 0;
+}
+
+TMap* AliHLTPredictionProcessorMTR::produceTestData(TString aliasName) {
+ TMap* resultMap = 0;
+
+ // here has to come real dummy data :-)
+ resultMap = new TMap();
+ TTimeStamp tt;
+ Float_t fval = 33.3;
+ TObjString* name = new TObjString("DummyData");
+ AliDCSValue* val = new AliDCSValue(fval, tt.GetTime());
+ TObjArray* arr = new TObjArray();
+ arr->Add(val);
+ resultMap->Add(name, arr);
+
+ return resultMap;
+}
+
+
--- /dev/null
+#ifndef ALIHLTPREDICTIONPROCESSORMTR_H
+#define ALIHLTPREDICTIONPROCESSORMTR_H
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+///
+/// @file AliHLTPredictionProcessorMTR.h
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date 2007-11-24
+/// @brief Declaration of the muon trigger prediction processor.
+///
+
+#include "AliHLTPredictionProcessorInterface.h"
+
+/**
+ * This is the prediction processor for the muon trigger detector.
+ * It is required as part of the Pendolino interface so that data fetched from
+ * DCS can be transformed and extrapolated into a format suitable for the HCDB.
+ *
+ * At the moment this class does not really do anything, but will fill the
+ * HCDB with data in the future.
+ *
+ * Refer to:
+ * http://wiki.kip.uni-heidelberg.de/ti/HLT/index.php/Pendolino-PredictionProcessor-Interface
+ * for more details about the Pendolino and preprocessor interfaces.
+ */
+class AliHLTPredictionProcessorMTR : public AliHLTPredictionProcessorInterface
+{
+public:
+
+ /**
+ * The class constructor for the preprocessor.
+ * @param detector The detector name, which must be "MTR".
+ * @param pendolino A valid pointer to the pendolino instance.
+ */
+ AliHLTPredictionProcessorMTR(const char* detector, AliHLTPendolino* pendolino);
+
+ virtual ~AliHLTPredictionProcessorMTR();
+
+ // The following methods are inherited from AliHLTPredictionProcessorInterface.
+
+ /**
+ * This function is called by the Pendolino before the fetched DCS data
+ * is handed in for (prediction) processing.
+ *
+ * @param doPrediction If true then preprocessed data will be extrapolated
+ * to the current time. Otherwise no extrapolation will be
+ * performed if false. The default is to perform extrapolations.
+ *
+ * @return Currently always returns 0 for success.
+ */
+ virtual UInt_t makePrediction(Bool_t doPrediction = true);
+
+ /**
+ * Performs initialisation of the preprocessor.
+ * At the moment just basic sanity checks are performed.
+ *
+ * @param run The current run number.
+ * @param startTime The start time (earliest timestamp) of the data.
+ * @param endTime The end time (latest timestamp) of the data.
+ */
+ virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+
+ /**
+ * Process the DCS values.
+ * At the moment nothing is done here.
+ *
+ * @param dcsAliasMap The map containing aliases and corresponding DCS
+ * values and timestamps
+ *
+ * @return At the moment 0 is always returned for success.
+ */
+ virtual UInt_t Process(TMap* dcsAliasMap);
+
+ /**
+ * Indicates that the DCS data shall be processed.
+ * NOTE: should always return true, since it is used as prediction
+ * processor, which will only process DCS data
+ *
+ * @return Always returns the value kTRUE.
+ */
+ virtual Bool_t ProcessDCS() { return kTRUE; };
+
+ /**
+ * Function to let the PredictionProcessor produce dummy input data,
+ * that can be used in Pendolino tests, where no DCS Archieve DB is
+ * contacted. This function is called by the Pendolino, the result is
+ * given back to the PredictionProcessor via the Process(...) call.
+ * Since the DCSMaps requested from DCS are detector specific, the
+ * PredictionProcessor should know, how the maps look like, that it
+ * expects.
+ * NOTE: The clean - up (delete) of the TMap will be performed by the
+ * Pendolino after the usage. The PredictionProcessor has never to
+ * call delete on the returned TMap pointer.
+ *
+ * @param aliasName optional parameter, that can be given in order to
+ * create a DCSMap for dedicated aliases. For a general test
+ * this paramter should be empty. If more than one alias name
+ * shall be specified, they are separated by blanks " ".
+ *
+ * @return DCSMap containing dummy data for testing the Pendolino.
+ */
+ virtual TMap* produceTestData(TString aliasName = "");
+
+private:
+
+ // Do not allow copying of this class.
+ AliHLTPredictionProcessorMTR(const AliHLTPredictionProcessorMTR& /*obj*/);
+ AliHLTPredictionProcessorMTR& operator = (const AliHLTPredictionProcessorMTR& /*obj*/);
+
+ Bool_t fPredict; //! Flag indicating if the processed values should be extrapolated to current time.
+
+ ClassDef(AliHLTPredictionProcessorMTR, 0); // The prediction processor for the muon trigger detector.
+};
+
+#endif // ALIHLTPREDICTIONPROCESSORMTR_H
lib_LTLIBRARIES = libHLTpendolino.la
# version info for the library
-LIBRARY_VERSION = "$(LIBHLTPENDOLINO_VERSION):0:0"
+LIBRARY_VERSION = "4:0:0"
# MODDIR is set by the AliRoot build system and denotes the topdir
# of the module, we must set it since the package definition libHLTpendolino.pkg
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Haavard Helstrup *
+//* for The ALICE HLT Project. *
+//* *
+//* 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. *
+//**************************************************************************
+
+/** @file AliHLTDCSArray.cxx
+ @author Haavard Helstrup
+ @date
+ @brief
+*/
+
+#include "TROOT.h"
+#include "TArrayF.h"
+#include "AliHLTDCSArray.h"
+
+
+//______________________________________________________________________________________________
+
+AliHLTDCSArray::AliHLTDCSArray(Int_t entries): TObject(),
+ fTimeStamp(0),
+ fValues(0)
+{
+ // constructor
+
+ fValues.Set(entries);
+}
+
+//______________________________________________________________________________________________
+
+AliHLTDCSArray::~AliHLTDCSArray()
+{
+ // destructor
+}
+
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALIHLTDCSARRAY_H
+#define ALIHLTDCSARRAY_H
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/** @file AliHLTDCSArray.h
+ @author Haavard Helstrup
+ @date
+ @brief
+*/
+
+#include "TArrayF.h"
+
+class AliHLTDCSArray : public TObject {
+
+ public:
+ AliHLTDCSArray(Int_t entries=0);
+ virtual ~AliHLTDCSArray();
+ void SetTime(UInt_t time) {fTimeStamp=time;}
+ const UInt_t GetTime() const {return fTimeStamp;}
+ void SetValue(Int_t i, Float_t val) {fValues[i]=val;}
+ Float_t GetValue(Int_t i) const {return fValues[i];}
+
+ protected:
+ UInt_t fTimeStamp; // time of DCS reading
+ TArrayF fValues; // array holding DCS readings
+
+ ClassDef(AliHLTDCSArray,1)
+};
+
+#endif
+
+
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Haavard Helstrup *
+//* for The ALICE HLT Project. *
+//* *
+//* 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. *
+//**************************************************************************
+
+/** @file AliHLTPredictionProcessorTPC.cxx
+ @author Haavard Helstrup
+ @date
+ @brief
+*/
+
+#include "AliHLTPredictionProcessorTPC.h"
+
+#include "AliHLTDCSArray.h"
+#include "TROOT.h"
+#include "TArrayF.h"
+#include "TObjArray.h"
+#include "TTree.h"
+#include "TString.h"
+#include "AliCDBEntry.h"
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+
+
+ClassImp(AliHLTPredictionProcessorTPC)
+
+const TString kAmandaString = "TPC_PT_%d_TEMPERATURE";
+
+//______________________________________________________________________________________________
+
+AliHLTPredictionProcessorTPC::AliHLTPredictionProcessorTPC(
+ const char* detector, AliHLTPendolino* pendolino) :
+ AliHLTPredictionProcessorInterface(detector, pendolino),
+ fConfigOK(kTRUE),
+ fConfTreeTemp(0),
+ fTemp(0),
+ fPredict(kFALSE),
+ fRun(0),
+ fStartTime(0),
+ fEndTime(0)
+{
+ // constructor
+}
+
+//______________________________________________________________________________________________
+
+AliHLTPredictionProcessorTPC::~AliHLTPredictionProcessorTPC()
+{
+
+ // destructor
+ if (fConfTreeTemp) {
+ delete fConfTreeTemp;
+ }
+ if (fTemp) {
+ fTemp->Delete();
+ delete fTemp;
+ }
+
+}
+
+//______________________________________________________________________________________________
+
+UInt_t AliHLTPredictionProcessorTPC::makePrediction(Bool_t doPrediction) {
+//
+// Signal whether prediction making is required
+//
+ fPredict = doPrediction; // own member indicating that prediction making is required
+ return 0;
+}
+
+//______________________________________________________________________________________________
+
+void AliHLTPredictionProcessorTPC::Initialize(Int_t run, UInt_t startTime,
+ UInt_t endTime) {
+//
+// Initialise TPC prediction processor. Read config entry from HCDB
+//
+ fRun = run; // storing locally the run number
+ fStartTime = startTime; // storing locally the start time
+ fEndTime = endTime; // storing locally the end time
+
+
+ AliCDBEntry* entry = GetFromOCDB("Config", "HLTTemperature");
+ if (entry) fConfTreeTemp = (TTree*) entry->GetObject();
+ if ( fConfTreeTemp==0 ) {
+ Log("AliHLTPredictionProcessorTPC: Temperature Config HCDB entry missing.\n");
+ fConfigOK = kFALSE;
+ return;
+ }
+}
+
+//______________________________________________________________________________________________
+
+UInt_t AliHLTPredictionProcessorTPC::Process(TMap* dcsAliasMap) {
+//
+// Event-by-event processing of the PredictionProcessorTPC
+//
+
+// test if configuration available and DCS map valid
+
+ if (!dcsAliasMap) return 91;
+ if (dcsAliasMap->GetEntries() == 0 ) return 92;
+ if (!fConfigOK) return 93;
+
+//
+// Extract values from DCS maps. Store updated entry to HCDB
+//
+ UInt_t retVal = 0;
+ Int_t start = 0;
+ TString path2("Calib"); // for the storage path in HCDB
+ TString path3("Temperature"); // for the storage path in HCDB
+
+ //get data from the HCDB
+ AliCDBEntry* entry = GetFromOCDB(path2.Data(), path3.Data());
+ if (entry != 0) {
+ entry->PrintMetaData(); // use the AliCDBEntry
+ fTemp = (TObjArray*)entry->GetObject();
+ } else {
+ Log("Cannot retrieve HCDB entry. New TObjArray generated");
+ fTemp = new TObjArray();
+ }
+
+ // process temperatures
+
+ UInt_t tempResult = ExtractTemperature(dcsAliasMap);
+
+ //process dcsAliasMap to ROOT object
+ // and create AliCDBEntry
+
+ if (tempResult == 0) {
+ // create meta data entry for HCDB
+ TString comment("HLT temperatures");
+ AliCDBMetaData meta(this->GetName(), 0, "unknownAliRoot", comment.Data());
+
+ // store AliCDBEntry in HCDB
+ if (Store(path2.Data(), path3.Data(), fTemp, &meta, start, kTRUE)) {
+ Log(" +++ Successfully stored object ;-)");
+ } else {
+ Log(" *** Storing of OBJECT failed!!");
+ retVal = 7;
+ }
+ } else {
+ retVal = 94;
+ }
+
+ return retVal;
+}
+
+//______________________________________________________________________________________________
+
+UInt_t AliHLTPredictionProcessorTPC::ExtractTemperature(TMap* dcsAliasMap)
+{
+// Extract temperature values from DCS maps, according to infoamtion from configuration tree
+
+ const Int_t error = 9;
+ Int_t nentries = fConfTreeTemp->GetEntries();
+ if (nentries<1) return error;
+
+ TString stringId;
+ Int_t echa=0;
+ fConfTreeTemp->SetBranchAddress("ECha",&echa);
+ fConfTreeTemp->GetEntry(0);
+ stringId = Form(kAmandaString.Data(),echa);
+ UInt_t time = GetCurrentTime(dcsAliasMap,stringId.Data());
+ AliHLTDCSArray* temperatures = new AliHLTDCSArray(nentries);
+ temperatures->SetTime(time);
+
+ for (Int_t isensor=0; isensor<nentries; isensor++ ){
+ fConfTreeTemp->GetEntry(isensor);
+ stringId = Form(kAmandaString.Data(),echa);
+ Float_t temp = GetSensorValue(dcsAliasMap,stringId.Data());
+ temperatures->SetValue(isensor,temp);
+ }
+
+ fTemp->Add(temperatures);
+ return 0;
+}
+
+
+//______________________________________________________________________________________________
+
+Float_t AliHLTPredictionProcessorTPC::GetSensorValue(TMap* dcsAliasMap,
+ const char* stringId)
+{
+ // return last value read from sensor specified by stringId
+ Float_t sensorValue=0;
+ TObjArray* valueSet;
+ TPair* pair = (TPair*)dcsAliasMap->FindObject(stringId);
+ if (pair) {
+ valueSet = (TObjArray*)pair->Value();
+ if (valueSet) {
+ Int_t nentriesDCS = valueSet->GetEntriesFast();
+ AliDCSValue *val = (AliDCSValue *)valueSet->At(nentriesDCS - 1);
+ if (val) {
+ sensorValue=val->GetFloat();
+ }
+ }
+ }
+ return sensorValue;
+}
+
+//______________________________________________________________________________________________
+
+UInt_t AliHLTPredictionProcessorTPC::GetCurrentTime(TMap* dcsAliasMap,
+ const char* stringId)
+{
+ // return last time value read from sensor specified by stringId
+
+ UInt_t time=0;
+ TObjArray* valueSet;
+ TPair* pair = (TPair*) (dcsAliasMap->FindObject(stringId));
+ if (pair) {
+ valueSet = (TObjArray*) (pair->Value());
+ if (valueSet) {
+ Int_t nentriesDCS = valueSet->GetEntriesFast();
+ AliDCSValue *val = (AliDCSValue *) (valueSet->At(nentriesDCS - 1));
+ if (val) {
+ time = val->GetTimeStamp();
+ }
+ }
+ }
+ return time;
+}
+
+TMap* AliHLTPredictionProcessorTPC::produceTestData(TString aliasName) {
+ TMap* resultMap = 0;
+
+ // here has to come real dummy data :-)
+ resultMap = new TMap();
+ TTimeStamp tt;
+ TObjString* name = new TObjString("DummyData");
+ Float_t fval = 33.3;
+ AliDCSValue* val = new AliDCSValue(fval, tt.GetTime());
+ TObjArray* arr = new TObjArray();
+ arr->Add(val);
+ resultMap->Add(name, arr);
+
+ return resultMap;
+}
+
+
+
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALIHLTPREDICTIONPROCESSORTPC_H
+#define ALIHLTPREDICTIONPROCESSORTPC_H
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/** @file AliHLTPredictionProcessorTPC.h
+ @author Haavard Helstrup
+ @date
+ @brief
+*/
+
+#include "AliHLTPredictionProcessorInterface.h"
+#include "TTree.h"
+class TMap;
+class AliHLTDCSArray;
+
+class TObjArray;
+
+class AliHLTPredictionProcessorTPC : public AliHLTPredictionProcessorInterface
+{
+ public:
+ AliHLTPredictionProcessorTPC(const char* detector,
+ AliHLTPendolino* pendolino);
+ virtual ~AliHLTPredictionProcessorTPC();
+
+ UInt_t makePrediction (Bool_t doPrediction);
+ void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+ UInt_t Process (TMap* dcsAliasMap);
+ UInt_t ExtractTemperature(TMap* dcsAliasMap);
+ UInt_t GetCurrentTime(TMap* dcsAliasMap, const char* stringId);
+ Float_t GetSensorValue(TMap* dcsAliasMap, const char* stringId);
+ virtual Bool_t ProcessDCS();
+ virtual TMap* produceTestData(TString aliasName = "");
+
+ private:
+ Bool_t fConfigOK; // Identify succesful reading of OCDB Config
+ TTree* fConfTreeTemp; // TTree holding temperature configuration
+ TObjArray* fTemp; // Array holding temperature readings
+ Bool_t fPredict; // Indicates whether predictions should be made
+ Int_t fRun; // run number
+ UInt_t fStartTime; // start time
+ UInt_t fEndTime; // end time
+
+ AliHLTPredictionProcessorTPC
+ (const AliHLTPredictionProcessorTPC& predictPro); // Disabled Copy Constructor
+
+ AliHLTPredictionProcessorTPC&
+ operator=(const AliHLTPredictionProcessorTPC& rhs); // Disabled Assignment Operator
+
+
+ ClassDef(AliHLTPredictionProcessorTPC,2)
+};
+
+inline Bool_t AliHLTPredictionProcessorTPC::ProcessDCS() {
+ return true;
+}
+
+#endif
+