16#ifndef ROOT7_RPadLength
17#define ROOT7_RPadLength
22namespace Experimental {
30 template <
class DERIVED>
36 DERIVED &
ToDerived() {
return static_cast<DERIVED &
>(*this); }
40 friend DERIVED
operator+(DERIVED lhs, DERIVED rhs) {
return DERIVED{lhs.fVal + rhs.fVal}; }
41 friend DERIVED
operator-(DERIVED lhs, DERIVED rhs) {
return DERIVED{lhs.fVal - rhs.fVal}; }
42 friend double operator/(DERIVED lhs, DERIVED rhs) {
return lhs.fVal / rhs.fVal; }
58 friend DERIVED
operator*(
const DERIVED &lhs,
double rhs) {
return DERIVED(lhs.fVal * rhs); }
59 friend DERIVED
operator*(
double lhs,
const DERIVED &rhs) {
return DERIVED(lhs * rhs.fVal); }
60 friend DERIVED
operator/(
const DERIVED &lhs,
double rhs) {
return DERIVED(lhs.fVal * rhs); }
61 friend bool operator<(
const DERIVED &lhs,
const DERIVED &rhs) {
return lhs.fVal < rhs.fVal; }
62 friend bool operator>(
const DERIVED &lhs,
const DERIVED &rhs) {
return lhs.fVal > rhs.fVal; }
63 friend bool operator<=(
const DERIVED &lhs,
const DERIVED &rhs) {
return lhs.fVal <= rhs.fVal; }
64 friend bool operator>=(
const DERIVED &lhs,
const DERIVED &rhs) {
return lhs.fVal >= rhs.fVal; }
friend RPadLength operator+(RPadLength lhs, const RPadLength &rhs)
Add two RPadLengths.
friend RPadLength operator-(RPadLength lhs, const RPadLength &rhs)
Subtract two RPadLengths.
RPadLength(User user)
Constructor from a User coordinate.
RPadLength(Normal normal, Pixel px, User user)
Sort-of aggregate initialization constructor taking normal, pixel and user parts.
RPadLength(Normal normal)
Constructor from a Normal coordinate.
RPadLength(Pixel px)
Constructor from a Pixel coordinate.
void SetFromAttrString(const std::string &name, const std::string &attrStrVal)
Initialize a RPadLength from a style string.
Pixel fPixel
The pixel coordinate summand.
User fUser
The user coordinate summand.
RPadLength & operator-=(const RPadLength &rhs)
Subtract a RPadLength.
RPadLength operator-()
Unary -.
RPadLength & operator*=(double scale)
RPadLength()=default
Default constructor, initializing all coordinate parts to 0..
RPadLength & operator+=(const RPadLength &rhs)
Add a RPadLength.
Normal fNormal
The normalized coordinate summand.
Namespace for new ROOT classes and functions.
friend bool operator>=(const DERIVED &lhs, const DERIVED &rhs)
friend double operator/(DERIVED lhs, DERIVED rhs)
friend bool operator<=(const DERIVED &lhs, const DERIVED &rhs)
friend DERIVED operator*(double lhs, const DERIVED &rhs)
friend bool operator>(const DERIVED &lhs, const DERIVED &rhs)
friend DERIVED operator*(const DERIVED &lhs, double rhs)
friend DERIVED operator/(const DERIVED &lhs, double rhs)
DERIVED & operator+=(const DERIVED &rhs)
friend DERIVED operator+(DERIVED lhs, DERIVED rhs)
DERIVED & operator*=(double scale)
friend DERIVED operator-(DERIVED lhs, DERIVED rhs)
friend bool operator<(const DERIVED &lhs, const DERIVED &rhs)
DERIVED & operator-=(const DERIVED &rhs)
double fVal
Coordinate value.
A normalized coordinate: 0 in the left, bottom corner, 1 in the top, right corner of the RPad.
A pixel coordinate: 0 in the left, bottom corner, 1 in the top, right corner of the RPad.
A user coordinate, as defined by the EUserCoordSystem parameter of the RPad.