adding prediction processor for the GRP, moving some functions to the PredictionProce...
[u/mrichter/AliRoot.git] / HLT / pendolino / PredictionProcessor / AliHLTPredictionProcessorInterface.cxx
CommitLineData
e58fb035 1// $Id$
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Sebastian Bablok <Sebastian.Bablok@ift.uib.no> *
8//* for The ALICE HLT Project. *
9//* *
10//* Permission to use, copy, modify and distribute this software and its *
11//* documentation strictly for non-commercial purposes is hereby granted *
12//* without fee, provided that the above copyright notice appears in all *
13//* copies and that both the copyright notice and this permission notice *
14//* appear in the supporting documentation. The authors make no claims *
15//* about the suitability of this software for any purpose. It is *
16//* provided "as is" without express or implied warranty. *
17//**************************************************************************
18
19/** @file AliHLTPredictionProcessorInterface.cxx
20 @author Sebastian Bablok
21 @date
22 @brief
23*/
24
25#include "AliHLTPredictionProcessorInterface.h"
26#include "AliHLTPendolino.h"
d1662f64 27#include "TObjArray.h"
28#include "AliDCSValue.h"
e58fb035 29
30
31ClassImp(AliHLTPredictionProcessorInterface)
32
33AliHLTPredictionProcessorInterface::AliHLTPredictionProcessorInterface(
d1662f64 34 const char* detector, AliHLTPendolino* pendolino)
35 : AliPreprocessor(detector, reinterpret_cast<AliShuttleInterface*>(pendolino))
36 , fpPend(pendolino)
37 , fPredict(kFALSE)
38 , fStartTime(0)
39 , fEndTime(0)
40{
e58fb035 41}
42
43
44AliHLTPredictionProcessorInterface::~AliHLTPredictionProcessorInterface() {
45
46}
47
48Int_t AliHLTPredictionProcessorInterface::GetRunNumber() {
bf560255 49 return fpPend->GetRunNumber();
e58fb035 50}
51
d1662f64 52void AliHLTPredictionProcessorInterface::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
53{
54 // initializes AliHLTPredictionProcessorHLT
55 if (GetRunNumber()!=run) {
56 Log(Form("run number argument %d differs from pendolino run number %d", run, GetRunNumber()));
57 }
58 fStartTime = startTime;
59 fEndTime = endTime;
60}
e58fb035 61
62Bool_t AliHLTPredictionProcessorInterface::includeAliCDBEntryInList(
63 const TString& entryPath) {
64
425695db 65 return fpPend->IncludeAliCDBEntryInList(entryPath);
e58fb035 66}
67
d1662f64 68Bool_t AliHLTPredictionProcessorInterface::GetSensorValue(TMap* dcsAliasMap,
69 const char* stringId, Float_t *value) const
70{
71 // extracts the sensor value
72 // return last value read from sensor specified by stringId
73
74 TObjArray* valueSet;
75 TPair* pair = (TPair*)dcsAliasMap->FindObject(stringId);
76 if (pair) {
77 valueSet = (TObjArray*)pair->Value();
78 Int_t nentriesDCS = valueSet->GetEntriesFast() - 1;
79 if(nentriesDCS>=0){
80 AliDCSValue *val = (AliDCSValue *)valueSet->At(nentriesDCS);
81 *value=val->GetFloat();
82 return kTRUE;
83 }
84 }
85 return kFALSE;
86}