Logo ROOT   6.16/01
Reference Guide
RooRealProxy.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 RooRealProxy.cxx
19\class RooRealProxy
20\ingroup Roofitcore
21
22RooRealProxy is the concrete proxy for RooAbsReal objects
23A RooRealProxy is the general mechanism to store references
24to RooAbsReals inside a RooAbsArg
25
26RooRealProxy provides a cast operator to Double_t, allowing
27the proxy to functions a Double_t on the right hand side of expressions.
28**/
29
30#include "RooFit.h"
31#include "Riostream.h"
32
33#include "TClass.h"
34#include "RooRealProxy.h"
35#include "RooRealVar.h"
36
37using namespace std;
38
40;
41
42
43////////////////////////////////////////////////////////////////////////////////
44/// Constructor with owner.
45
46RooRealProxy::RooRealProxy(const char* inName, const char* desc, RooAbsArg* owner,
47 Bool_t valueServer, Bool_t shapeServer, Bool_t ownArg) :
48 RooArgProxy(inName, desc, owner, valueServer, shapeServer, ownArg)
49{
50}
51
52
53
54////////////////////////////////////////////////////////////////////////////////
55/// Constructor with owner and proxied real-valued object. The propagation
56/// of value and shape dirty flags of the contained arg to the owner is
57/// controlled by the valueServer and shapeServer flags. If ownArg is true
58/// the proxy will take ownership of the contained arg
59
60RooRealProxy::RooRealProxy(const char* inName, const char* desc, RooAbsArg* owner, RooAbsReal& ref,
61 Bool_t valueServer, Bool_t shapeServer, Bool_t ownArg) :
62 RooArgProxy(inName, desc, owner,ref, valueServer, shapeServer, ownArg)
63{
64}
65
66
67
68////////////////////////////////////////////////////////////////////////////////
69/// Copy constructor
70
71RooRealProxy::RooRealProxy(const char* inName, RooAbsArg* owner, const RooRealProxy& other) :
72 RooArgProxy(inName, owner, other)
73{
74}
75
76
77
78////////////////////////////////////////////////////////////////////////////////
79/// Destructor
80
82{
83}
84
85
86
87////////////////////////////////////////////////////////////////////////////////
88/// Return l-value pointer to contents, if contents is in fact an l-value
89
91{
92 // WVE remove check here -- need to put it back in setArg and ctor
93 return (RooAbsRealLValue*) _arg ;
94
95 // Assert that the held arg is an LValue
96 RooAbsRealLValue* Lvptr = (RooAbsRealLValue*)dynamic_cast<const RooAbsRealLValue*>(_arg) ;
97 if (!Lvptr) {
98 cout << "RooRealProxy(" << name() << ")::INTERNAL error, expected " << _arg->GetName() << " to be an lvalue" << endl ;
99 assert(0) ;
100 }
101 return Lvptr ;
102}
103
104
105////////////////////////////////////////////////////////////////////////////////
106/// Change object held in proxy into newRef
107
109{
110 if (absArg()) {
111 if (TString(arg().GetName()!=newRef.GetName())) {
112 newRef.setAttribute(Form("ORIGNAME:%s",arg().GetName())) ;
113 }
114 return changePointer(RooArgSet(newRef),kTRUE) ;
115 } else {
116 return changePointer(RooArgSet(newRef),kFALSE,kTRUE);
117 }
118}
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:241
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
RooArgProxy is the abstact interface for RooAbsArg proxy classes.
Definition: RooArgProxy.h:24
virtual const char * name() const
Definition: RooArgProxy.h:42
virtual Bool_t changePointer(const RooAbsCollection &newServerSet, Bool_t nameChange=kFALSE, Bool_t factoryInitMode=kFALSE)
Change proxied object to object of same name in given list.
RooAbsArg * absArg() const
Definition: RooArgProxy.h:37
RooAbsArg * _arg
Definition: RooArgProxy.h:52
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
Definition: RooRealProxy.h:23
virtual ~RooRealProxy()
Destructor.
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
virtual Bool_t setArg(RooAbsReal &newRef)
Change object held in proxy into newRef.
RooAbsRealLValue * lvptr() const
Return l-value pointer to contents, if contents is in fact an l-value.
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
STL namespace.