Logo ROOT   6.08/07
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 "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 
39 using namespace std;
40 
42 ;
43 
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Default constructor
47 
49 {
50 }
51 
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 
55 RooRangeBoolean::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 {
92  Double_t xmin = ((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data()) ;
93  Double_t xmax = ((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data()) ;
94 
95  Double_t ret = (_x >= xmin && _x < xmax) ? 1.0 : 0.0 ;
96  return ret ;
97 }
98 
99 
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 
103 std::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 
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
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.
Double_t x[n]
Definition: legend1.C:17
RooRangeBoolean.
RooRangeBoolean()
Default constructor.
Double_t evaluate() const
Return 1 if x is in range, zero otherwis.
float xmax
Definition: THbookFile.cxx:93
#define ClassImp(name)
Definition: Rtypes.h:279
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
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooRealProxy _x
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
char name[80]
Definition: TGX11.cxx:109