16#ifndef ROO_TEMPLATE_PROXY
17#define ROO_TEMPLATE_PROXY
163 template<typename Bool = bool, typename = std::enable_if_t<std::is_same<Bool,bool>::value>>
165 Bool valueServer=
true,
bool shapeServer=
false)
187 bool valueServer=
true,
bool shapeServer=
false) :
188 RooArgProxy(theName, desc,
owner, const_cast<typename std::remove_const<T>::
type&>(ref), valueServer, shapeServer, false) { }
201 bool valueServer =
true,
bool shapeServer =
false)
221 if (
_arg && !
dynamic_cast<const T*
>(
_arg)) {
222 if (allowWrongTypes) {
223 coutE(InputArguments) <<
"Error trying to copy an argument from a proxy with an incompatible payload." << std::endl;
225 throw std::invalid_argument(
"Tried to construct a RooTemplateProxy with incompatible payload.");
235 return static_cast<T&
>(*_arg);
240 return static_cast<T*
>(
_arg);
246 operator typename T::value_type()
const {
255 if (std::string(
arg().
GetName()) != newRef.GetName()) {
256 newRef.setAttribute((
"ORIGNAME:" + std::string(
arg().
GetName())).c_str()) ;
268 template<
class U,
class... ConstructorArgs>
272 throw std::runtime_error(
"Error in RooTemplateProxy: emplaceOwnedArg<>() called on a proxy already owning an arg.");
274 auto ownedArg =
new U{std::forward<ConstructorArgs>(constructorArgs)...};
288 throw std::runtime_error(
"Error in RooTemplateProxy: putOwnedArg<>() called on a proxy already owning an arg.");
290 auto argPtr = ownedArg.get();
291 setArg(*ownedArg.release());
307 return arg().getCurrentLabel();
312 return arg().hasRange(rangeName);
316 const T&
arg()
const {
return static_cast<const T&
>(*_arg); }
321 lvptr(
static_cast<T*
>(
nullptr))->operator=(
value);
326 static_assert(std::is_base_of<RooAbsCategory, T>::value,
"Strings can only be assigned to category proxies.");
332 double min(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->getMin(rname) ; }
334 double max(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->getMax(rname) ; }
336 bool hasMin(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->hasMin(rname) ; }
338 bool hasMax(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->hasMax(rname) ; }
345 using LValue_t =
typename std::conditional<std::is_base_of<RooAbsReal, T>::value,
366 R__SUGGEST_ALTERNATIVE(
"The template argument of RooTemplateProxy needs to derive from RooAbsRealLValue or RooAbsCategoryLValue to safely call this function.") {
377 R__SUGGEST_ALTERNATIVE(
"The template argument of RooTemplateProxy needs to derive from RooAbsRealLValue or RooAbsCategoryLValue to safely call this function.") {
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
A space to attach TBranches.
virtual value_type getCurrentIndex() const
Return index number of current state.
RooArgSet * _nset
! Normalization set to be used for evaluation of RooAbsPdf contents
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Abstract interface for RooAbsArg proxy classes.
RooAbsArg * _owner
Pointer to owner of proxy.
bool _ownArg
If true proxy owns contents.
RooAbsArg * owner() const
Returns the owner of this proxy.
RooAbsArg * _arg
Pointer to content of proxy.
bool changePointer(const RooAbsCollection &newServerSet, bool nameChange=false, bool factoryInitMode=false) override
Change proxied object to object of same name in given list.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
TObject * Clone(const char *newName=nullptr) const override
Make a clone of an object using the Streamer facility.
LValue_t * lvptr(RooAbsArg *)
Return l-value pointer to contents.
bool hasRange(const char *rangeName) const
Check if the stored object has a range with the given name.
T & operator*() const
Return reference to the proxied object.
T::value_type retrieveValue(const RooAbsCategory &cat) const
Retrieve index state from a category.
RooTemplateProxy(const char *theName, RooAbsArg *owner, const RooTemplateProxy< U > &other, bool allowWrongTypes=false)
Copy from an existing proxy.
RooTemplateProxy< T > & operator=(typename T::value_type value)
Assign a new value to the object pointed to by the proxy.
RooTemplateProxy(const char *theName, const char *desc, RooAbsArg *owner, T &ref, bool valueServer=true, bool shapeServer=false)
Constructor with owner and proxied object.
bool hasMin(const char *rname=nullptr) const
Check if the range has a lower bound. This requires the payload to be RooAbsRealLValue or derived.
RooTemplateProxy(const char *theName, const char *desc, RooAbsArg *owner, Bool valueServer=true, bool shapeServer=false)
Constructor with owner.
U & putOwnedArg(std::unique_ptr< U > ownedArg)
Move a new object held and owned by proxy.
RooTemplateProxy< T > & operator=(const std::string &newState)
Set a category state using its state name. This function can only work for category-type proxies.
const LValue_t * lvptr(const RooAbsArg *) const
Return l-value pointer to contents.
RooTemplateProxy(const char *theName, const char *desc, RooAbsArg *owner, std::unique_ptr< T > ptr, bool valueServer=true, bool shapeServer=false)
Constructor with owner and proxied object, taking ownership of the proxied object.
const LValue_t * lvptr(const LValue_t *) const
Return l-value pointer to contents.
const char * label() const
Get the label of the current category state. This function only makes sense for category proxies.
bool hasMax(const char *rname=nullptr) const
Check if the range has a upper bound. This requires the payload to be RooAbsRealLValue or derived.
double max(const char *rname=nullptr) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
T * operator->() const
Member access operator to proxied object.
LValue_t * lvptr(LValue_t *)
Return l-value pointer to contents.
T::value_type retrieveValue(const RooAbsReal &real) const
Retrieve value from a real-valued object.
bool setArg(T &newRef)
Change object held in proxy into newRef.
U & emplaceOwnedArg(ConstructorArgs &&... constructorArgs)
Create a new object held and owned by proxy.
const T & arg() const
Return reference to object held in proxy.
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
typename std::conditional< std::is_base_of< RooAbsReal, T >::value, RooAbsRealLValue, RooAbsCategoryLValue >::type LValue_t
Are we a real-valued proxy or a category proxy?
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.