if ( fFit ) {
return fFit->Eval(timeHour);
} else {
- return -99;
+ if ( fGraph ) {
+ return EvalGraph(timeHour);
+ } else {
+ return -99;
+ }
}
}
+//_____________________________________________________________________________
+Double_t AliDCSSensor::EvalGraph(const Double_t& timeHour) const
+{
+ //
+ // Extract last value in graph observed before time given by timeHour
+ //
+
+ // return -99 if point specified is before beginning of graph
+ Double_t x=0; Double_t y=0;
+ fGraph->GetPoint(0,x,y);
+ if ( timeHour < x ) return -99;
+
+ // return previous point when first time > timeHour is observed
+
+ Int_t npoints = fGraph->GetN();
+ for (Int_t i=1; i<npoints; i++) {
+ fGraph->GetPoint(i,x,y);
+ if ( timeHour < x ) {
+ fGraph->GetPoint(i-1,x,y);
+ return y;
+ }
+ }
+
+ // return last point if all times are < timeHour
+ return y;
+}
+
+//_____________________________________________________________________________
TGraph* AliDCSSensor::MakeGraph(Int_t nPoints) const
{
//
Double_t GetValue(UInt_t timeSec);
Double_t GetValue(TTimeStamp time);
Double_t Eval(const TTimeStamp& time, Bool_t inside=true) const;
+ Double_t EvalGraph(const Double_t& timeHour) const;
TGraph *MakeGraph (Int_t nPoints=100) const;
static TClonesArray * ReadTree(TTree *tree);
if (keepMap) entry->SetGraph(gr);
}
}
+//_____________________________________________________________________________
+void AliDCSSensorArray::StoreGraph(TMap *map)
+{
+ //
+ // Store graphs extracted from DCS
+ //
+ Int_t nsensors = fSensors->GetEntries();
+ for ( Int_t isensor=0; isensor<nsensors; isensor++) {
+ AliDCSSensor *entry = (AliDCSSensor*)fSensors->At(isensor);
+ TString stringID = entry->GetStringID();
+ TGraph *gr = (TGraph*)map->GetValue(stringID.Data());
+ if (!gr ) {
+ entry->SetFit(0);
+ entry->SetGraph(0);
+ AliWarning(Form("sensor %s: no input graph",stringID.Data()));
+ continue;
+ }
+ entry->SetFit(0);
+ entry->SetGraph(gr);
+ }
+}
//_____________________________________________________________________________
Int_t AliDCSSensorArray::NumFits() const
sensor->SetFit(0);
}
}
+//_____________________________________________________________________________
+void AliDCSSensorArray::AddSensors(AliDCSSensorArray *newSensors)
+{
+ //
+ // add sensors from two sensor arrays
+ //
+
+ Int_t numNew = newSensors->NumSensors();
+ Int_t numOld = fSensors->GetEntries();
+ fSensors->Expand(numOld+numNew);
+ for (Int_t i=0;i<numNew;i++) {
+ AliDCSSensor *sens = newSensors->GetSensorNum(i);
+ new ((*fSensors)[numOld+i]) AliDCSSensor(*sens);
+ }
+}
+
void SetGraph (TMap *map);
void MakeSplineFit(TMap *map, Bool_t keepMap=kFALSE);
+ void StoreGraph (TMap *map);
TMap* ExtractDCS (TMap *dcsMap);
TGraph* MakeGraph (TObjArray *valueSet);
void ClearGraph();
AliDCSSensor* GetSensorNum (Int_t ind);
void RemoveSensorNum(Int_t ind);
void RemoveSensor(Int_t IdDCS);
+ void AddSensors(AliDCSSensorArray *sensors);
TArrayI OutsideThreshold(Double_t threshold, UInt_t timeSec=0, Bool_t below=kTRUE) const;
Int_t NumSensors() const { return fSensors->GetEntries(); }
Int_t NumFits() const;