Logo ROOT   6.16/01
Reference Guide
RooPullVar.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 RooPullVar.cxx
19\class RooPullVar
20\ingroup Roofitcore
21
22Class RooPullVar represents the pull of measurement w.r.t to true value
23using the measurement value and its error. Both the true value and
24the measured value (with error) are taken from two user supplied
25RooRealVars. If an asymmetric error is defined on a given measurement the proper
26side of that asymmetric error will be used
27**/
28
29#include "RooFit.h"
30
31#include "Riostream.h"
32#include "Riostream.h"
33#include <math.h>
34
35#include "RooPullVar.h"
36#include "RooAbsReal.h"
37#include "RooRealVar.h"
38
39using namespace std;
40
42;
43
44
45////////////////////////////////////////////////////////////////////////////////
46/// Default constructor
47
49{
50}
51
52
53
54////////////////////////////////////////////////////////////////////////////////
55/// Construct RooAbsReal representing the pull of a RooRealVar 'meas' providing the
56/// measured value and its error and a RooAbsReal 'truth' providing the true value
57
58RooPullVar::RooPullVar(const char* name, const char* title, RooRealVar& meas, RooAbsReal& truth) :
59 RooAbsReal(name, title),
60 _meas("meas","Measurement",this,meas),
61 _true("true","Truth",this,truth)
62{
63}
64
65
66
67
68
69////////////////////////////////////////////////////////////////////////////////
70/// Copy constructor
71
72RooPullVar::RooPullVar(const RooPullVar& other, const char* name) :
73 RooAbsReal(other, name),
74 _meas("meas",this,other._meas),
75 _true("true",this,other._true)
76{
77}
78
79
80
81////////////////////////////////////////////////////////////////////////////////
82/// Destructor
83
85{
86}
87
88
89
90////////////////////////////////////////////////////////////////////////////////
91/// Calculate pull. Use asymmetric error if defined in measurement,
92/// otherwise use symmetric error. If measurement has no error
93/// return zero.
94
96{
97 const RooRealVar& meas = static_cast<const RooRealVar&>(_meas.arg()) ;
98 if (meas.hasAsymError()) {
99 Double_t delta = _meas-_true ;
100 if (delta<0) {
101 return delta/meas.getAsymErrorHi() ;
102 } else {
103 return -delta/meas.getAsymErrorLo() ;
104 }
105 } else if (meas.hasError()) {
106 return (_meas-_true)/meas.getError() ;
107 } else {
108 return 0 ;
109 }
110}
111
112
double Double_t
Definition: RtypesCore.h:55
#define ClassImp(name)
Definition: Rtypes.h:363
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
Class RooPullVar represents the pull of measurement w.r.t to true value using the measurement value a...
Definition: RooPullVar.h:25
Double_t evaluate() const
Calculate pull.
Definition: RooPullVar.cxx:95
virtual ~RooPullVar()
Destructor.
Definition: RooPullVar.cxx:84
RooPullVar()
Default constructor.
Definition: RooPullVar.cxx:48
RooRealProxy _meas
Definition: RooPullVar.h:38
RooRealProxy _true
Definition: RooPullVar.h:39
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Double_t getAsymErrorLo() const
Definition: RooRealVar.h:57
Bool_t hasAsymError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:59
Double_t getAsymErrorHi() const
Definition: RooRealVar.h:58
Bool_t hasError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:54
Double_t getError() const
Definition: RooRealVar.h:53
STL namespace.