Logo ROOT  
Reference Guide
 
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
35
36using namespace RooStats;
37
38
39////////////////////////////////////////////////////////////////////////////////
40/// Default constructor
41
43 ConfInterval(name), fLowerLimit(0), fUpperLimit(0), fConfidenceLevel(0)
44{
45}
46
47
48////////////////////////////////////////////////////////////////////////////////
49///fParameters.add( other.fParameters );
50
53 , fParameters(other.fParameters)
54 , fLowerLimit(other.fLowerLimit)
55 , fUpperLimit(other.fUpperLimit)
56 , fConfidenceLevel(other.fConfidenceLevel)
57{
58}
59
60
61////////////////////////////////////////////////////////////////////////////////
62
65{
66 if (&other==this) {
67 return *this ;
68 }
69
71
72 //fParameters = other.fParameters;
78
79 return *this ;
80}
81
82////////////////////////////////////////////////////////////////////////////////
83/// Alternate constructor
84
85SimpleInterval::SimpleInterval(const char* name, const RooRealVar & var, double lower, double upper, double cl) :
86 ConfInterval(name), fParameters(var), fLowerLimit(lower), fUpperLimit(upper), fConfidenceLevel(cl)
87{
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Method to determine if a parameter point is in the interval
92
93bool SimpleInterval::IsInInterval(const RooArgSet &parameterPoint) const
94{
95 if( !this->CheckParameters(parameterPoint) )
96 return false;
97
98 if(parameterPoint.size() != 1 )
99 return false;
100
101 RooAbsReal* point = dynamic_cast<RooAbsReal*> (parameterPoint.first());
102 if (point == nullptr)
103 return false;
104
105 if ( point->getVal() > fUpperLimit || point->getVal() < fLowerLimit)
106 return false;
107
108
109 return true;
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// return cloned list of parameters
114
116{
117 return new RooArgSet(fParameters);
118}
119
120////////////////////////////////////////////////////////////////////////////////
121
122bool SimpleInterval::CheckParameters(const RooArgSet &parameterPoint) const
123{
124 if (parameterPoint.size() != fParameters.size() ) {
125 std::cout << "size is wrong, parameters don't match" << std::endl;
126 return false;
127 }
128 if ( ! parameterPoint.equals( fParameters ) ) {
129 std::cout << "size is ok, but parameters don't match" << std::endl;
130 return false;
131 }
132 return true;
133}
#define ClassImp(name)
Definition Rtypes.h:382
char name[80]
Definition TGX11.cxx:110
bool equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically-named contents.
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
RooAbsArg * first() 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