RooRealProxy.cxx

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  * @(#)root/roofitcore:$Id: RooRealProxy.cxx 28963 2009-06-12 15:47:45Z wouter $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 
00017 //////////////////////////////////////////////////////////////////////////////
00018 //
00019 // BEGIN_HTML
00020 // RooRealProxy is the concrete proxy for RooAbsReal objects
00021 // A RooRealProxy is the general mechanism to store references
00022 // to RooAbsReals inside a RooAbsArg
00023 //
00024 // RooRealProxy provides a cast operator to Double_t, allowing
00025 // the proxy to functions a Double_t on the right hand side of expressions.
00026 // END_HTML
00027 //
00028 
00029 #include "RooFit.h"
00030 #include "Riostream.h"
00031 
00032 #include "TClass.h"
00033 #include "RooRealProxy.h"
00034 #include "RooRealVar.h"
00035 
00036 ClassImp(RooRealProxy)
00037 ;
00038 
00039 
00040 //_____________________________________________________________________________
00041 RooRealProxy::RooRealProxy(const char* inName, const char* desc, RooAbsArg* owner, 
00042                            Bool_t valueServer, Bool_t shapeServer, Bool_t ownArg) : 
00043   RooArgProxy(inName, desc, owner, valueServer, shapeServer, ownArg)
00044 {
00045   // Constructor with owner. 
00046 }
00047 
00048 
00049 
00050 //_____________________________________________________________________________
00051 RooRealProxy::RooRealProxy(const char* inName, const char* desc, RooAbsArg* owner, RooAbsReal& ref,
00052                            Bool_t valueServer, Bool_t shapeServer, Bool_t ownArg) : 
00053   RooArgProxy(inName, desc, owner,ref, valueServer, shapeServer, ownArg)
00054 {
00055   // Constructor with owner and proxied real-valued object. The propagation
00056   // of value and shape dirty flags of the contained arg to the owner is
00057   // controlled by the valueServer and shapeServer flags. If ownArg is true
00058   // the proxy will take ownership of the contained arg
00059 }
00060 
00061 
00062 
00063 //_____________________________________________________________________________
00064 RooRealProxy::RooRealProxy(const char* inName, RooAbsArg* owner, const RooRealProxy& other) : 
00065   RooArgProxy(inName, owner, other) 
00066 {
00067   // Copy constructor 
00068 }
00069 
00070 
00071 
00072 //_____________________________________________________________________________
00073 RooRealProxy::~RooRealProxy() 
00074 {
00075   // Destructor
00076 }
00077 
00078 
00079 
00080 //_____________________________________________________________________________
00081 RooAbsRealLValue* RooRealProxy::lvptr() const 
00082 {
00083   // Return l-value pointer to contents, if contents is in fact an l-value
00084 
00085   // Assert that the held arg is an LValue
00086   RooAbsRealLValue* Lvptr = (RooAbsRealLValue*)dynamic_cast<const RooAbsRealLValue*>(_arg) ;
00087   if (!Lvptr) {
00088     cout << "RooRealProxy(" << name() << ")::INTERNAL error, expected " << _arg->GetName() << " to be an lvalue" << endl ;
00089     assert(0) ;
00090   }
00091   return Lvptr ;
00092 }
00093 
00094 
00095 //_____________________________________________________________________________
00096 Bool_t RooRealProxy::setArg(RooAbsReal& newRef) 
00097 {
00098   // Change object held in proxy into newRef
00099   if (absArg()) {
00100     if (TString(arg().GetName()!=newRef.GetName())) {
00101       newRef.setAttribute(Form("ORIGNAME:%s",arg().GetName())) ;
00102     }
00103     return changePointer(RooArgSet(newRef),kTRUE) ;
00104   } else {
00105     return changePointer(RooArgSet(newRef),kFALSE,kTRUE);
00106   }
00107 }

Generated on Tue Jul 5 15:07:27 2011 for ROOT_528-00b_version by  doxygen 1.5.1