16 #ifndef ROO_TEMPLATE_PROXY 
   17 #define ROO_TEMPLATE_PROXY 
   44 class RooTemplateProxy : 
public RooArgProxy {
 
   48   RooTemplateProxy() {} ;
 
   52   RooTemplateProxy(
const char* theName, 
const char* desc, RooAbsArg* owner,
 
   53       Bool_t valueServer=
true, Bool_t shapeServer=
false, Bool_t proxyOwnsArg=
false)
 
   54   : RooArgProxy(theName, desc, owner, valueServer, shapeServer, proxyOwnsArg) { }
 
   61   RooTemplateProxy(
const char* theName, 
const char* desc, RooAbsArg* owner, T& ref,
 
   62       Bool_t valueServer=
true, Bool_t shapeServer=
false, Bool_t proxyOwnsArg=
false) :
 
   63         RooArgProxy(theName, desc, owner, ref, valueServer, shapeServer, proxyOwnsArg) { }
 
   68   RooTemplateProxy(
const char* theName, RooAbsArg* owner, 
const RooTemplateProxy& other) :
 
   69     RooArgProxy(theName, owner, other) { }
 
   71   virtual TObject* Clone(
const char* newName=0)
 const { 
return new RooTemplateProxy<T>(newName,_owner,*
this); }
 
   73   inline operator Double_t()
 const {
 
   74     return arg().getVal(_nset);
 
   77   RooSpan<const double> getValBatch(std::size_t begin, std::size_t batchSize)
 const {
 
   78     return arg().getValBatch(begin, batchSize, _nset);
 
   82   inline const T& arg()
 const { 
return static_cast<T&
>(*_arg); }
 
   86   Bool_t setArg(T& newRef) {
 
   88       if (TString(arg().GetName()!=newRef.GetName())) {
 
   89         newRef.setAttribute(Form(
"ORIGNAME:%s",arg().GetName())) ;
 
   91       return changePointer(RooArgSet(newRef),kTRUE) ;
 
   93       return changePointer(RooArgSet(newRef),kFALSE,kTRUE);
 
   99   RooTemplateProxy<T>& operator=(
const Double_t& value) { lvptr()->setVal(value) ; 
return *this ; }
 
  101   Double_t min(
const char* rname=0)
 const { 
return lvptr()->getMin(rname) ; }
 
  103   Double_t max(
const char* rname=0)
 const { 
return lvptr()->getMax(rname) ; }
 
  105   Bool_t hasMin(
const char* rname=0)
 const { 
return lvptr()->hasMin(rname) ; }
 
  107   Bool_t hasMax(
const char* rname=0)
 const { 
return lvptr()->hasMax(rname) ; }
 
  120   RooAbsRealLValue* lvptr()
 const {
 
  121     return lvptr_impl(static_cast<T*>(
nullptr));
 
  125   RooAbsRealLValue* lvptr_impl(RooAbsRealLValue*)
 const {
 
  132   RooAbsRealLValue* lvptr_impl(RooAbsArg*) const
 
  133     R__SUGGEST_ALTERNATIVE("The template argument of RooTemplateProxy needs to derive from RooAbsRealLValue.") {
 
  135     return static_cast<RooAbsRealLValue*
>(_arg);
 
  137     auto theArg = 
dynamic_cast<RooAbsRealLValue*
>(_arg);
 
  143   ClassDef(RooTemplateProxy,1) 
 
  147 using RooRealProxy = RooTemplateProxy<RooAbsReal>;
 
  148 using RooPdfProxy     = RooTemplateProxy<RooAbsPdf>;
 
  149 using RooLVarProxy    = RooTemplateProxy<RooAbsRealLValue>;
 
  150 using RooRealVarProxy = RooTemplateProxy<RooRealVar>;