ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 * @(#)root/roofitcore:$Id: RooPullVar.cxx 24285 2008-06-16 15:05:15Z wouter $
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/

//////////////////////////////////////////////////////////////////////////////
//
// BEGIN_HTML
// Class RooPullVar represents the pull of measurement w.r.t to true value
// using the measurement value and its error. Both the true value and
// the measured value (with error) are taken from two user supplied
// RooRealVars. If an asymmetric error is defined on a given measurement the proper 
// side of that asymmetric error will be used
// END_HTML
//

#include "RooFit.h"

#include "Riostream.h"
#include "Riostream.h"
#include <math.h>

#include "RooPullVar.h"
#include "RooAbsReal.h"
#include "RooRealVar.h"

ClassImp(RooPullVar)
;


//_____________________________________________________________________________
RooPullVar::RooPullVar()
{
  // Default constructor
}



//_____________________________________________________________________________
RooPullVar::RooPullVar(const char* name, const char* title, RooRealVar& meas, RooAbsReal& truth) :
  RooAbsReal(name, title),
  _meas("meas","Measurement",this,meas),
  _true("true","Truth",this,truth)
{
  // Construct RooAbsReal representing the pull of a RooRealVar 'meas' providing the
  // measured value and its error and a RooAbsReal 'truth' providing the true value
}





//_____________________________________________________________________________
RooPullVar::RooPullVar(const RooPullVar& other, const char* name) :
  RooAbsReal(other, name), 
  _meas("meas",this,other._meas),
  _true("true",this,other._true)
{
  // Copy constructor
}



//_____________________________________________________________________________
RooPullVar::~RooPullVar() 
{
  // Destructor
}



//_____________________________________________________________________________
Double_t RooPullVar::evaluate() const 
{
  // Calculate pull. Use asymmetric error if defined in measurement,
  // otherwise use symmetric error. If measurement has no error
  // return zero.

  const RooRealVar& meas = static_cast<const RooRealVar&>(_meas.arg()) ;  
  if (meas.hasAsymError()) {
    Double_t delta = _meas-_true ;
    if (delta<0) {
      return delta/meas.getAsymErrorHi() ;
    } else {
      return -delta/meas.getAsymErrorLo() ;
    }
  } else if (meas.hasError()) {
    return (_meas-_true)/meas.getError() ;    
  } else {
    return 0 ;
  }
}


 RooPullVar.cxx:1
 RooPullVar.cxx:2
 RooPullVar.cxx:3
 RooPullVar.cxx:4
 RooPullVar.cxx:5
 RooPullVar.cxx:6
 RooPullVar.cxx:7
 RooPullVar.cxx:8
 RooPullVar.cxx:9
 RooPullVar.cxx:10
 RooPullVar.cxx:11
 RooPullVar.cxx:12
 RooPullVar.cxx:13
 RooPullVar.cxx:14
 RooPullVar.cxx:15
 RooPullVar.cxx:16
 RooPullVar.cxx:17
 RooPullVar.cxx:18
 RooPullVar.cxx:19
 RooPullVar.cxx:20
 RooPullVar.cxx:21
 RooPullVar.cxx:22
 RooPullVar.cxx:23
 RooPullVar.cxx:24
 RooPullVar.cxx:25
 RooPullVar.cxx:26
 RooPullVar.cxx:27
 RooPullVar.cxx:28
 RooPullVar.cxx:29
 RooPullVar.cxx:30
 RooPullVar.cxx:31
 RooPullVar.cxx:32
 RooPullVar.cxx:33
 RooPullVar.cxx:34
 RooPullVar.cxx:35
 RooPullVar.cxx:36
 RooPullVar.cxx:37
 RooPullVar.cxx:38
 RooPullVar.cxx:39
 RooPullVar.cxx:40
 RooPullVar.cxx:41
 RooPullVar.cxx:42
 RooPullVar.cxx:43
 RooPullVar.cxx:44
 RooPullVar.cxx:45
 RooPullVar.cxx:46
 RooPullVar.cxx:47
 RooPullVar.cxx:48
 RooPullVar.cxx:49
 RooPullVar.cxx:50
 RooPullVar.cxx:51
 RooPullVar.cxx:52
 RooPullVar.cxx:53
 RooPullVar.cxx:54
 RooPullVar.cxx:55
 RooPullVar.cxx:56
 RooPullVar.cxx:57
 RooPullVar.cxx:58
 RooPullVar.cxx:59
 RooPullVar.cxx:60
 RooPullVar.cxx:61
 RooPullVar.cxx:62
 RooPullVar.cxx:63
 RooPullVar.cxx:64
 RooPullVar.cxx:65
 RooPullVar.cxx:66
 RooPullVar.cxx:67
 RooPullVar.cxx:68
 RooPullVar.cxx:69
 RooPullVar.cxx:70
 RooPullVar.cxx:71
 RooPullVar.cxx:72
 RooPullVar.cxx:73
 RooPullVar.cxx:74
 RooPullVar.cxx:75
 RooPullVar.cxx:76
 RooPullVar.cxx:77
 RooPullVar.cxx:78
 RooPullVar.cxx:79
 RooPullVar.cxx:80
 RooPullVar.cxx:81
 RooPullVar.cxx:82
 RooPullVar.cxx:83
 RooPullVar.cxx:84
 RooPullVar.cxx:85
 RooPullVar.cxx:86
 RooPullVar.cxx:87
 RooPullVar.cxx:88
 RooPullVar.cxx:89
 RooPullVar.cxx:90
 RooPullVar.cxx:91
 RooPullVar.cxx:92
 RooPullVar.cxx:93
 RooPullVar.cxx:94
 RooPullVar.cxx:95
 RooPullVar.cxx:96
 RooPullVar.cxx:97
 RooPullVar.cxx:98
 RooPullVar.cxx:99
 RooPullVar.cxx:100
 RooPullVar.cxx:101
 RooPullVar.cxx:102
 RooPullVar.cxx:103
 RooPullVar.cxx:104
 RooPullVar.cxx:105