Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooRangeBoolean.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 RooRangeBoolean.cxx
19\class RooRangeBoolean
20\ingroup Roofitcore
21
22RooRangeBoolean
23**/
24
25#include "Riostream.h"
26#include <math.h>
27
28#include "RooRangeBoolean.h"
29#include "RooAbsReal.h"
30#include "RooRealVar.h"
31#include "RooArgList.h"
32#include "RooMsgService.h"
33
34using namespace std;
35
37
38
39////////////////////////////////////////////////////////////////////////////////
40/// Default constructor
41
43{
44}
45
46
47////////////////////////////////////////////////////////////////////////////////
48
49RooRangeBoolean::RooRangeBoolean(const char* name, const char* title, RooAbsRealLValue& x, const char* rangeName) :
50 RooAbsReal(name, title),
51 _x("x", "Dependent", this, x),
52 _rangeName(rangeName)
53{
54}
55
56
57
58////////////////////////////////////////////////////////////////////////////////
59/// Copy constructor
60
62 RooAbsReal(other, name),
63 _x("x", this, other._x),
64 _rangeName(other._rangeName)
65{
66}
67
68
69
70
71////////////////////////////////////////////////////////////////////////////////
72/// Destructor
73
75{
76}
77
78
79
80
81////////////////////////////////////////////////////////////////////////////////
82/// Return 1 if x is in range, zero otherwis
83
85{
86 double xmin = ((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data()) ;
87 double xmax = ((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data()) ;
88
89 double ret = (_x >= xmin && _x < xmax) ? 1.0 : 0.0 ;
90 return ret ;
91}
92
93
94
95////////////////////////////////////////////////////////////////////////////////
96
97std::list<double>* RooRangeBoolean::plotSamplingHint(RooAbsRealLValue& obs, double /*xlo*/, double /*xhi*/) const
98{
99 if (string(obs.GetName())!=_x.arg().GetName()) {
100 return 0 ;
101 }
102
103 list<double>* hint = new list<double> ;
104 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())-1e-6) ;
105 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())+1e-6) ;
106 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())-1e-6) ;
107 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())+1e-6) ;
108 return hint ;
109}
110
#define e(i)
Definition RSha256.hxx:103
#define ClassImp(name)
Definition Rtypes.h:377
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:62
RooRangeBoolean.
RooRealProxy _x
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
~RooRangeBoolean() override
Destructor.
RooRangeBoolean()
Default constructor.
double evaluate() const override
Return 1 if x is in range, zero otherwis.
const T & arg() const
Return reference to object held in proxy.
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * Data() const
Definition TString.h:380
Double_t x[n]
Definition legend1.C:17