ROOT
v6-30
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
22
RooConstVar represent a constant real-valued object
23
**/
24
25
#include "
RooConstVar.h
"
26
#include "
RooNumber.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
/// Write object contents to stream
56
57
void
RooConstVar::writeToStream
(ostream& os,
bool
/*compact*/
)
const
58
{
59
os <<
_value
;
60
}
61
62
////////////////////////////////////////////////////////////////////////////////
63
64
void
RooConstVar::translate
(
RooFit::Detail::CodeSquashContext
&ctx)
const
65
{
66
// Just return a stringy-field version of the const value.
67
// Formats to the maximum precision.
68
constexpr
auto
max_precision{std::numeric_limits<double>::digits10 + 1};
69
std::stringstream ss;
70
ss.precision(max_precision);
71
// Just use toString to make sure we do not output 'inf'.
72
// This is really ugly for large numbers...
73
ss << std::fixed <<
RooNumber::toString
(
_value
);
74
ctx.
addResult
(
this
, ss.str());
75
}
RooConstVar.h
RooNumber.h
ClassImp
#define ClassImp(name)
Definition
Rtypes.h:377
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:717
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:224
RooAbsReal
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition
RooAbsReal.h:59
RooAbsReal::_value
double _value
Cache for current value of object.
Definition
RooAbsReal.h:543
RooConstVar
RooConstVar represent a constant real-valued object.
Definition
RooConstVar.h:23
RooConstVar::writeToStream
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to stream.
Definition
RooConstVar.cxx:57
RooConstVar::translate
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
Definition
RooConstVar.cxx:64
RooConstVar::RooConstVar
RooConstVar()
Definition
RooConstVar.h:26
RooFit::Detail::CodeSquashContext
A class to maintain the context for squashing of RooFit models into code.
Definition
CodeSquashContext.h:36
RooFit::Detail::CodeSquashContext::addResult
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
Definition
CodeSquashContext.cxx:190
RooNumber::toString
static std::string toString(double x)
Returns an std::to_string compatible number (i.e.
Definition
RooNumber.cxx:31
roofit
roofitcore
src
RooConstVar.cxx
ROOT v6-30 - Reference Guide Generated on Fri Aug 9 2024 10:45:11 (GVA Time) using Doxygen 1.9.8