Logo ROOT  
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 
22 RooPullVar represents the pull of a measurement w.r.t. the true value
23 using the measurement and its error. Both the true value and
24 the measured value (with error) are taken from two user-supplied
25 RooRealVars. If the measured parameter has an asymmetric error, the proper
26 side of that error will be used:
27 \f[
28  \mathrm{Pull}_x = \frac{x_\mathrm{meas}-x_\mathrm{true}}{\Delta_x}
29 \f]
30 **/
31 
32 #include "RooPullVar.h"
33 
34 #include "RooFit.h"
35 #include "RooAbsReal.h"
36 #include "RooRealVar.h"
37 
38 using namespace std;
39 
41 ;
42 
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Default constructor
46 
48 {
49 }
50 
51 
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Construct the pull of the RooRealVar 'meas'.
55 ///
56 /// \param[in] name Name of the pull variable.
57 /// \param[in] title The title (for plotting).
58 /// \param[in] meas The measurement. This variable needs to have an error, and therefore is a RooRealVar.
59 /// \param[in] truth The true value.
60 RooPullVar::RooPullVar(const char* name, const char* title, RooRealVar& meas, RooAbsReal& truth) :
61  RooAbsReal(name, title),
62  _meas("meas","Measurement",this,meas),
63  _true("true","Truth",this,truth)
64 {
65 }
66 
67 
68 
69 
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Copy constructor
73 
74 RooPullVar::RooPullVar(const RooPullVar& other, const char* name) :
75  RooAbsReal(other, name),
76  _meas("meas",this,other._meas),
77  _true("true",this,other._true)
78 {
79 }
80 
81 
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Destructor
85 
87 {
88 }
89 
90 
91 
92 ////////////////////////////////////////////////////////////////////////////////
93 /// Calculate pull. Use asymmetric error if defined in measurement,
94 /// otherwise use symmetric error. If measurement has no error
95 /// return zero.
96 
98 {
99  const auto& meas = _meas.arg();
100  if (meas.hasAsymError()) {
101  Double_t delta = _meas-_true ;
102  if (delta<0) {
103  return delta/meas.getAsymErrorHi() ;
104  } else {
105  return -delta/meas.getAsymErrorLo() ;
106  }
107  } else if (meas.hasError()) {
108  return (_meas-_true)/meas.getError() ;
109  } else {
110  return 0 ;
111  }
112 }
113 
114 
RooPullVar::RooPullVar
RooPullVar()
Default constructor.
Definition: RooPullVar.cxx:47
RooAbsReal.h
RooPullVar::_meas
RooTemplateProxy< RooRealVar > _meas
Definition: RooPullVar.h:37
RooFit.h
RooTemplateProxy::arg
const T & arg() const
Return reference to object held in proxy.
Definition: RooTemplateProxy.h:290
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooPullVar
RooPullVar represents the pull of a measurement w.r.t.
Definition: RooPullVar.h:24
RooPullVar::evaluate
Double_t evaluate() const
Calculate pull.
Definition: RooPullVar.cxx:97
RooPullVar::_true
RooRealProxy _true
Definition: RooPullVar.h:38
RooPullVar.h
RooRealVar.h
RooPullVar::~RooPullVar
virtual ~RooPullVar()
Destructor.
Definition: RooPullVar.cxx:86
Double_t
double Double_t
Definition: RtypesCore.h:59
name
char name[80]
Definition: TGX11.cxx:110
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39