Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
SimpleInterval.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
3/*************************************************************************
4 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11/*****************************************************************************
12 * Project: RooStats
13 * Package: RooFit/RooStats
14 * @(#)root/roofit/roostats:$Id$
15 * Authors:
16 * Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
17 *
18 *****************************************************************************/
19
20/** \class RooStats::SimpleInterval
21 \ingroup Roostats
22
23SimpleInterval is a concrete implementation of the ConfInterval interface.
24It implements simple 1-dimensional intervals in a range [a,b].
25In addition, you can ask it for the upper- or lower-bound.
26*/
27
29#include "RooAbsReal.h"
30#include "RooRealVar.h"
31#include <string>
32
33
34
35using namespace RooStats;
36
37
38////////////////////////////////////////////////////////////////////////////////
39/// Default constructor
40
42 ConfInterval(name), fLowerLimit(0), fUpperLimit(0), fConfidenceLevel(0)
43{
44}
45
46
47////////////////////////////////////////////////////////////////////////////////
48///fParameters.add( other.fParameters );
49
52 , fParameters(other.fParameters)
53 , fLowerLimit(other.fLowerLimit)
54 , fUpperLimit(other.fUpperLimit)
55 , fConfidenceLevel(other.fConfidenceLevel)
56{
57}
58
59
60////////////////////////////////////////////////////////////////////////////////
61
64{
65 if (&other==this) {
66 return *this ;
67 }
68
70
71 //fParameters = other.fParameters;
73 fParameters.add(other.fParameters);
74 fLowerLimit = other.fLowerLimit;
75 fUpperLimit = other.fUpperLimit;
76 fConfidenceLevel = other.fConfidenceLevel;
77
78 return *this ;
79}
80
81////////////////////////////////////////////////////////////////////////////////
82/// Alternate constructor
83
84SimpleInterval::SimpleInterval(const char* name, const RooRealVar & var, double lower, double upper, double cl) :
85 ConfInterval(name), fParameters(var), fLowerLimit(lower), fUpperLimit(upper), fConfidenceLevel(cl)
86{
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Method to determine if a parameter point is in the interval
91
93{
94 if( !this->CheckParameters(parameterPoint) )
95 return false;
96
97 if(parameterPoint.size() != 1 )
98 return false;
99
100 RooAbsReal* point = dynamic_cast<RooAbsReal*> (parameterPoint.first());
101 if (point == nullptr)
102 return false;
103
104 if ( point->getVal() > fUpperLimit || point->getVal() < fLowerLimit)
105 return false;
106
107
108 return true;
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// return cloned list of parameters
113
118
119////////////////////////////////////////////////////////////////////////////////
120
122{
123 if (parameterPoint.size() != fParameters.size() ) {
124 std::cout << "size is wrong, parameters don't match" << std::endl;
125 return false;
126 }
127 if ( ! parameterPoint.equals( fParameters ) ) {
128 std::cout << "size is ok, but parameters don't match" << std::endl;
129 return false;
130 }
131 return true;
132}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char name[80]
Definition TGX11.cxx:110
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Variable that can be changed from the outside.
Definition RooRealVar.h:37
ConfInterval is an interface class for a generic interval in the RooStats framework.
ConfInterval & operator=(const ConfInterval &other)
operator=
SimpleInterval is a concrete implementation of the ConfInterval interface.
double fUpperLimit
upper interval limit
SimpleInterval(const char *name=nullptr)
default constructor
RooArgSet fParameters
set containing the parameter of interest
bool IsInInterval(const RooArgSet &) const override
check if parameter is in the interval
double fLowerLimit
lower interval limit
RooArgSet * GetParameters() const override
return a cloned list with the parameter of interest
bool CheckParameters(const RooArgSet &) const override
check if parameters are correct (i.e. they are the POI of this interval)
double fConfidenceLevel
confidence level
SimpleInterval & operator=(const SimpleInterval &other)
default constructor
Namespace for the RooStats classes.
Definition CodegenImpl.h:58