ROOT  6.06/09
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 //
19 // BEGIN_HTML
20 // RooRangeBoolean
21 // END_HTML
22 //
23 
24 #include "RooFit.h"
25 
26 #include "Riostream.h"
27 #include "Riostream.h"
28 #include <math.h>
29 #include "TMath.h"
30 
31 #include "RooRangeBoolean.h"
32 #include "RooAbsReal.h"
33 #include "RooRealVar.h"
34 #include "RooArgList.h"
35 #include "RooMsgService.h"
36 #include "TMath.h"
37 
38 using namespace std;
39 
41 ;
42 
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Default constructor
46 
48 {
49 }
50 
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 
54 RooRangeBoolean::RooRangeBoolean(const char* name, const char* title, RooAbsRealLValue& x, const char* rangeName) :
55  RooAbsReal(name, title),
56  _x("x", "Dependent", this, x),
57  _rangeName(rangeName)
58 {
59 }
60 
61 
62 
63 ////////////////////////////////////////////////////////////////////////////////
64 /// Copy constructor
65 
67  RooAbsReal(other, name),
68  _x("x", this, other._x),
69  _rangeName(other._rangeName)
70 {
71 }
72 
73 
74 
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Destructor
78 
80 {
81 }
82 
83 
84 
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// Return 1 if x is in range, zero otherwis
88 
90 {
91  Double_t xmin = ((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data()) ;
92  Double_t xmax = ((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data()) ;
93 
94  Double_t ret = (_x >= xmin && _x < xmax) ? 1.0 : 0.0 ;
95  return ret ;
96 }
97 
98 
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 
102 std::list<Double_t>* RooRangeBoolean::plotSamplingHint(RooAbsRealLValue& obs, Double_t /*xlo*/, Double_t /*xhi*/) const
103 {
104  if (string(obs.GetName())!=_x.arg().GetName()) {
105  return 0 ;
106  }
107 
108  list<Double_t>* hint = new list<Double_t> ;
109  hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())-1e-6) ;
110  hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())+1e-6) ;
111  hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())-1e-6) ;
112  hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())+1e-6) ;
113  return hint ;
114 }
115 
float xmin
Definition: THbookFile.cxx:93
virtual ~RooRangeBoolean()
Destructor.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
STL namespace.
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
const char * Data() const
Definition: TString.h:349
Double_t x[n]
Definition: legend1.C:17
ClassImp(RooRangeBoolean)
RooRangeBoolean()
Default constructor.
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
float xmax
Definition: THbookFile.cxx:93
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
Double_t evaluate() const
Return 1 if x is in range, zero otherwis.
#define name(a, b)
Definition: linkTestLib0.cpp:5
RooRealProxy _x