ROOT
master
Reference Guide
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
22
RooConstVar represent a constant real-valued object
23
**/
24
25
#include "
RooConstVar.h
"
26
#include "
RunContext.h
"
27
28
using namespace
std;
29
30
ClassImp
(
RooConstVar
);
31
32
33
34
////////////////////////////////////////////////////////////////////////////////
35
/// Constructor with value
36
RooConstVar::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
48
RooConstVar::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.
57
RooSpan<const double>
RooConstVar::getValues
(
RooBatchCompute::RunContext
& evalData,
const
RooArgSet
*)
const
{
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
69
void
RooConstVar::writeToStream
(ostream& os,
bool
/*compact*/
)
const
70
{
71
os <<
_value
;
72
}
73
RooConstVar.h
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:375
RunContext.h
value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Definition:
TGWin32VirtualXProxy.cxx:142
name
char name[80]
Definition:
TGX11.cxx:110
RooAbsArg::_fast
bool _fast
Definition:
RooAbsArg.h:736
RooAbsArg::setAttribute
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
Definition:
RooAbsArg.cxx:282
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition:
RooAbsReal.h:64
RooAbsReal::_value
double _value
Cache for current value of object.
Definition:
RooAbsReal.h:484
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition:
RooArgSet.h:57
RooConstVar
RooConstVar represent a constant real-valued object.
Definition:
RooConstVar.h:26
RooConstVar::getValues
RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *) const override
Return batch with 1 constant element.
Definition:
RooConstVar.cxx:57
RooConstVar::writeToStream
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to stream.
Definition:
RooConstVar.cxx:69
RooConstVar::RooConstVar
RooConstVar()
Definition:
RooConstVar.h:29
RooSpan
A simple container to hold a batch of data values.
Definition:
RooSpan.h:34
RooBatchCompute::RunContext
This struct enables passing computation data around between elements of a computation graph.
Definition:
RunContext.h:31
RooBatchCompute::RunContext::spans
std::map< const RooAbsArg *, RooSpan< const double > > spans
Once an object has computed its value(s), the span pointing to the results is registered here.
Definition:
RunContext.h:52
roofit
roofitcore
src
RooConstVar.cxx
ROOT master - Reference Guide Generated on Tue May 24 2022 18:24:57 (GVA Time) using Doxygen 1.9.5