16 #ifndef ROOT7_TPadLength 17 #define ROOT7_TPadLength 20 namespace Experimental {
28 template <
class DERIVED>
34 DERIVED &
ToDerived() {
return static_cast<DERIVED &
>(*this); }
38 friend DERIVED
operator+(DERIVED lhs, DERIVED rhs) {
return DERIVED{lhs.
fVal + rhs.fVal}; }
39 friend DERIVED
operator-(DERIVED lhs, DERIVED rhs) {
return DERIVED{lhs.
fVal - rhs.fVal}; }
40 friend double operator/(DERIVED lhs, DERIVED rhs) {
return lhs.fVal / rhs.fVal; }
56 friend DERIVED
operator*(
const DERIVED &lhs,
double rhs) {
return DERIVED(lhs.fVal * rhs); }
57 friend DERIVED
operator*(
double lhs,
const DERIVED &rhs) {
return DERIVED(lhs * rhs.fVal); }
58 friend DERIVED
operator/(
const DERIVED &lhs,
double rhs) {
return DERIVED(lhs.fVal * rhs); }
59 friend bool operator<(
const DERIVED &lhs,
const DERIVED &rhs) {
return lhs.fVal < rhs.fVal; }
60 friend bool operator>(
const DERIVED &lhs,
const DERIVED &rhs) {
return lhs.fVal > rhs.fVal; }
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; }
friend DERIVED operator*(double lhs, const DERIVED &rhs)
A normalized coordinate: 0 in the left, bottom corner, 1 in the top, right corner of the TPad...
TPadLength(Normal normal, Pixel px, User user)
Sort-of aggregate initialization constructor taking normal, pixel and user parts. ...
Namespace for new ROOT classes and functions.
TPadLength & operator*=(double scale)
friend DERIVED operator*(const DERIVED &lhs, double rhs)
double fVal
Coordinate value.
friend DERIVED operator+(DERIVED lhs, DERIVED rhs)
Pixel fPixel
The pixel coordinate summand.
DERIVED & operator+=(const DERIVED &rhs)
friend bool operator>=(const DERIVED &lhs, const DERIVED &rhs)
TPadLength & operator+=(const TPadLength &rhs)
Add a TPadLength.
TPadLength(User user)
Constructor from a User coordinate.
Normal fNormal
The normalized coordinate summand.
TPadLength operator-()
Unary -.
A user coordinate, as defined by the EUserCoordSystem parameter of the TPad.
friend DERIVED operator/(const DERIVED &lhs, double rhs)
friend TPadLength operator-(TPadLength lhs, const TPadLength &rhs)
Subtract two TPadLengths.
friend bool operator<=(const DERIVED &lhs, const DERIVED &rhs)
friend bool operator>(const DERIVED &lhs, const DERIVED &rhs)
friend bool operator<(const DERIVED &lhs, const DERIVED &rhs)
TPadLength(Pixel px)
Constructor from a Pixel coordinate.
TPadLength(Normal normal)
Constructor from a Normal coordinate.
TPadLength()=default
Default constructor, initializing all coordinate parts to 0..
friend TPadLength operator+(TPadLength lhs, const TPadLength &rhs)
Add two TPadLengths.
friend double operator/(DERIVED lhs, DERIVED rhs)
DERIVED & operator-=(const DERIVED &rhs)
User fUser
The user coordinate summand.
TPadLength & operator-=(const TPadLength &rhs)
Subtract a TPadLength.
DERIVED & operator*=(double scale)
A pixel coordinate: 0 in the left, bottom corner, 1 in the top, right corner of the TPad...
friend DERIVED operator-(DERIVED lhs, DERIVED rhs)