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