Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooConstVar.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooConstVar.cxx
19\class RooConstVar
20\ingroup Roofitcore
21
22RooConstVar represent a constant real-valued object
23**/
24
25#include "RooConstVar.h"
26#include "RunContext.h"
27
28using namespace std;
29
31
32
33
34////////////////////////////////////////////////////////////////////////////////
35/// Constructor with value
36RooConstVar::RooConstVar(const char *name, const char *title, double value) :
37 RooAbsReal(name,title)
38{
39 _fast = true;
40 _value = value;
41 setAttribute("Constant",true) ;
42}
43
44
45
46////////////////////////////////////////////////////////////////////////////////
47/// Copy constructor
48RooConstVar::RooConstVar(const RooConstVar& other, const char* name) :
49 RooAbsReal(other, name)
50{
51 _fast = true;
52}
53
54
55////////////////////////////////////////////////////////////////////////////////
56/// Return batch with 1 constant element.
58 auto item = evalData.spans.find(this);
59 if (item == evalData.spans.end()) {
60 return evalData.spans[this] = {&_value, 1};
61 }
62
63 return evalData.spans[this];
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Write object contents to stream
68
69void RooConstVar::writeToStream(ostream& os, bool /*compact*/) const
70{
71 os << _value ;
72}
73
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
bool _fast
Definition RooAbsArg.h:712
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:62
double _value
Cache for current value of object.
Definition RooAbsReal.h:509
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooConstVar represent a constant real-valued object.
Definition RooConstVar.h:26
RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *) const override
Return batch with 1 constant element.
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to stream.
A simple container to hold a batch of data values.
Definition RooSpan.h:34
This struct enables passing computation data around between elements of a computation graph.
Definition RunContext.h:32
std::map< RooFit::Detail::DataKey, RooSpan< const double > > spans
Once an object has computed its value(s), the span pointing to the results is registered here.
Definition RunContext.h:53