Logo ROOT  
Reference Guide
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 "RooFit.h"
26
27#include "Riostream.h"
28#include "Riostream.h"
29#include <math.h>
30#include "TMath.h"
31
32#include "RooRangeBoolean.h"
33#include "RooAbsReal.h"
34#include "RooRealVar.h"
35#include "RooArgList.h"
36#include "RooMsgService.h"
37#include "TMath.h"
38
39using namespace std;
40
42;
43
44
45////////////////////////////////////////////////////////////////////////////////
46/// Default constructor
47
49{
50}
51
52
53////////////////////////////////////////////////////////////////////////////////
54
55RooRangeBoolean::RooRangeBoolean(const char* name, const char* title, RooAbsRealLValue& x, const char* rangeName) :
56 RooAbsReal(name, title),
57 _x("x", "Dependent", this, x),
58 _rangeName(rangeName)
59{
60}
61
62
63
64////////////////////////////////////////////////////////////////////////////////
65/// Copy constructor
66
68 RooAbsReal(other, name),
69 _x("x", this, other._x),
70 _rangeName(other._rangeName)
71{
72}
73
74
75
76
77////////////////////////////////////////////////////////////////////////////////
78/// Destructor
79
81{
82}
83
84
85
86
87////////////////////////////////////////////////////////////////////////////////
88/// Return 1 if x is in range, zero otherwis
89
91{
94
95 Double_t ret = (_x >= xmin && _x < xmax) ? 1.0 : 0.0 ;
96 return ret ;
97}
98
99
100
101////////////////////////////////////////////////////////////////////////////////
102
103std::list<Double_t>* RooRangeBoolean::plotSamplingHint(RooAbsRealLValue& obs, Double_t /*xlo*/, Double_t /*xhi*/) const
104{
105 if (string(obs.GetName())!=_x.arg().GetName()) {
106 return 0 ;
107 }
108
109 list<Double_t>* hint = new list<Double_t> ;
110 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())-1e-6) ;
111 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())+1e-6) ;
112 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())-1e-6) ;
113 hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())+1e-6) ;
114 return hint ;
115}
116
#define e(i)
Definition: RSha256.hxx:103
double Double_t
Definition: RtypesCore.h:55
#define ClassImp(name)
Definition: Rtypes.h:365
char name[80]
Definition: TGX11.cxx:109
float xmin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
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:59
RooRangeBoolean.
RooRealProxy _x
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Double_t evaluate() const
Return 1 if x is in range, zero otherwis.
RooRangeBoolean()
Default constructor.
virtual ~RooRangeBoolean()
Destructor.
const T & arg() const
Return reference to object held in proxy.
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
const char * Data() const
Definition: TString.h:364
Double_t x[n]
Definition: legend1.C:17