16#ifndef ROO_TEMPLATE_PROXY
17#define ROO_TEMPLATE_PROXY
165 template<typename Bool = bool, typename = std::enable_if_t<std::is_same<Bool,bool>::value>>
179#ifndef ROOFIT_MEMORY_SAFE_INTERFACES
196 template<typename Bool = bool, typename = std::enable_if_t<std::is_same<Bool,bool>::value>>
197 R__DEPRECATED(6,36,
"Use RooTemplateProxy(const char*, const char*, RooAbsArg*, bool, bool) and transfer the ownership with RooTemplateProxy::putOwnedArg().")
217#ifndef ROOFIT_MEMORY_SAFE_INTERFACES
234 R__DEPRECATED(6,36,
"Use constructors without proxyOwnsArg argument, taking the one that accepts a std::unique_ptr<T> if you want to pass ownership.")
271 if (
_arg && !
dynamic_cast<const T*
>(
_arg)) {
272 if (allowWrongTypes) {
273 coutE(InputArguments) <<
"Error trying to copy an argument from a proxy with an incompatible payload." << std::endl;
275 throw std::invalid_argument(
"Tried to construct a RooTemplateProxy with incompatible payload.");
285 return static_cast<T&
>(*_arg);
289 T* operator->()
const {
290 return static_cast<T*
>(
_arg);
296 operator typename T::value_type()
const {
303 bool setArg(T& newRef) {
305 if (std::string(arg().
GetName()) != newRef.GetName()) {
306 newRef.setAttribute((
"ORIGNAME:" + std::string(arg().
GetName())).c_str()) ;
318 template<
class U,
class... ConstructorArgs>
319 U& emplaceOwnedArg(ConstructorArgs&&... constructorArgs) {
322 throw std::runtime_error(
"Error in RooTemplateProxy: emplaceOwnedArg<>() called on a proxy already owning an arg.");
324 auto ownedArg =
new U{std::forward<ConstructorArgs>(constructorArgs)...};
335 U& putOwnedArg(std::unique_ptr<U> ownedArg) {
338 throw std::runtime_error(
"Error in RooTemplateProxy: putOwnedArg<>() called on a proxy already owning an arg.");
340 auto argPtr = ownedArg.get();
341 setArg(*ownedArg.release());
356 const char* label()
const {
357 return arg().getCurrentLabel();
361 bool hasRange(
const char* rangeName)
const {
362 return arg().hasRange(rangeName);
366 const T& arg()
const {
return static_cast<const T&
>(*_arg); }
376 static_assert(std::is_base_of<RooAbsCategory, T>::value,
"Strings can only be assigned to category proxies.");
382 double min(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->getMin(rname) ; }
384 double max(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->getMax(rname) ; }
386 bool hasMin(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->hasMin(rname) ; }
388 bool hasMax(
const char* rname=
nullptr)
const {
return lvptr(
static_cast<const T*
>(
nullptr))->hasMax(rname) ; }
395 using LValue_t =
typename std::conditional<std::is_base_of<RooAbsReal, T>::value,
407 const LValue_t*
lvptr(
const LValue_t*)
const {
408 return static_cast<const LValue_t*
>(
_arg);
412 return static_cast<LValue_t*
>(
_arg);
416 R__SUGGEST_ALTERNATIVE(
"The template argument of RooTemplateProxy needs to derive from RooAbsRealLValue or RooAbsCategoryLValue to safely call this function.") {
418 return static_cast<const LValue_t*
>(
_arg);
420 auto theArg =
dynamic_cast<const LValue_t*
>(
_arg);
427 R__SUGGEST_ALTERNATIVE(
"The template argument of RooTemplateProxy needs to derive from RooAbsRealLValue or RooAbsCategoryLValue to safely call this function.") {
429 return static_cast<LValue_t*
>(
_arg);
431 auto theArg =
dynamic_cast<LValue_t*
>(
_arg);
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
#define R__DEPRECATED(MAJOR, MINOR, REASON)
#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
TTime operator*(const TTime &t1, const TTime &t2)
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 * _arg
Pointer to content of proxy.
RooArgProxy & operator=(RooArgProxy const &other)=delete
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.
LValue_t * lvptr(RooAbsArg *)
Return l-value pointer to contents.
T::value_type retrieveValue(const RooAbsCategory &cat) const
Retrieve index state from a category.
const char RooAbsArg Bool bool bool proxyOwnsArg
RooTemplateProxy(const char *theName, const char *desc, RooAbsArg *owner, Bool valueServer=true, bool shapeServer=false)
Constructor with owner.
const LValue_t * lvptr(const RooAbsArg *) const
Return l-value pointer to contents.
const char RooAbsArg Bool bool shapeServer
const LValue_t * lvptr(const LValue_t *) const
Return l-value pointer to contents.
const char RooAbsArg * owner
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.
R__DEPRECATED(6, 36, "Use RooTemplateProxy(const char*, const char*, RooAbsArg*, bool, bool) and transfer the ownership with RooTemplateProxy::putOwnedArg().") RooTemplateProxy(const char *theName
Constructor with owner.
const char RooAbsArg Bool valueServer
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
__device__ AFloat max(AFloat x, AFloat y)