Logo ROOT   6.10/09
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 Class RooPullVar represents the pull of measurement w.r.t to true value
23 using the measurement value and its error. Both the true value and
24 the measured value (with error) are taken from two user supplied
25 RooRealVars. If an asymmetric error is defined on a given measurement the proper
26 side 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 
39 using 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 
58 RooPullVar::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 
72 RooPullVar::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()) {
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 
Class RooPullVar represents the pull of measurement w.r.t to true value using the measurement value a...
Definition: RooPullVar.h:25
virtual ~RooPullVar()
Destructor.
Definition: RooPullVar.cxx:84
STL namespace.
Float_t delta
Bool_t hasAsymError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:59
Bool_t hasError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:54
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Double_t getAsymErrorHi() const
Definition: RooRealVar.h:58
RooPullVar()
Default constructor.
Definition: RooPullVar.cxx:48
#define ClassImp(name)
Definition: Rtypes.h:336
RooRealProxy _meas
Definition: RooPullVar.h:38
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
Calculate pull.
Definition: RooPullVar.cxx:95
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
Double_t getError() const
Definition: RooRealVar.h:53
Double_t getAsymErrorLo() const
Definition: RooRealVar.h:57
RooRealProxy _true
Definition: RooPullVar.h:39