Logo ROOT  
Reference Guide
RPadExtent.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_RPadExtent
10#define ROOT7_RPadExtent
11
12#include "ROOT/RPadLength.hxx"
13
14#include <array>
15#include <string>
16
17namespace ROOT {
18namespace Experimental {
19
20/** \class RPadExtent
21\ingroup GpadROOT7
22\brief An extent / size (horizontal and vertical) in a `RPad`.
23\author Axel Naumann <axel@cern.ch>
24\date 2017-07-07
25\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
26*/
28
29 RPadLength fHoriz; ///< horizontal part
30
31 RPadLength fVert; ///< vertical part
32
33public:
34
35 RPadExtent() = default;
36
37 RPadExtent(const RPadLength& horiz, const RPadLength& vert) : RPadExtent()
38 {
39 fHoriz = horiz;
40 fVert = vert;
41 }
42
43 RPadLength &Horiz() { return fHoriz; }
44 const RPadLength &Horiz() const { return fHoriz; }
45
46 RPadLength &Vert() { return fVert; }
47 const RPadLength &Vert() const { return fVert; }
48
49
50 /// Add two `RPadExtent`s.
51 friend RPadExtent operator+(RPadExtent lhs, const RPadExtent &rhs)
52 {
53 return {lhs.fHoriz + rhs.fHoriz, lhs.fVert + rhs.fVert};
54 }
55
56 /// Subtract two `RPadExtent`s.
57 friend RPadExtent operator-(RPadExtent lhs, const RPadExtent &rhs)
58 {
59 return {lhs.fHoriz - rhs.fHoriz, lhs.fVert - rhs.fVert};
60 }
61
62 /// Add a `RPadExtent`.
64 {
65 fHoriz += rhs.fHoriz;
66 fVert += rhs.fVert;
67 return *this;
68 };
69
70 /// Subtract a `RPadExtent`.
72 {
73 fHoriz -= rhs.fHoriz;
74 fVert -= rhs.fVert;
75 return *this;
76 };
77
78 /** \struct ScaleFactor
79 \ingroup GpadROOT7
80 \brief A scale factor (separate factors for horizontal and vertical) for scaling a `RPadLength`.
81 */
82 struct ScaleFactor {
83 double fHoriz; ///< Horizontal scale factor
84 double fVert; ///< Vertical scale factor
85 };
86
87 /// Scale a horizontally and vertically.
88 /// \param scale - the scale factor,
90 {
91 fHoriz *= scale.fHoriz;
92 fVert *= scale.fVert;
93 return *this;
94 };
95};
96
97
98} // namespace Experimental
99} // namespace ROOT
100
101#endif
An extent / size (horizontal and vertical) in a RPad.
Definition: RPadExtent.hxx:27
RPadLength fHoriz
horizontal part
Definition: RPadExtent.hxx:29
const RPadLength & Horiz() const
Definition: RPadExtent.hxx:44
friend RPadExtent operator-(RPadExtent lhs, const RPadExtent &rhs)
Subtract two RPadExtents.
Definition: RPadExtent.hxx:57
RPadExtent & operator*=(const ScaleFactor &scale)
Scale a horizontally and vertically.
Definition: RPadExtent.hxx:89
RPadLength fVert
vertical part
Definition: RPadExtent.hxx:31
const RPadLength & Vert() const
Definition: RPadExtent.hxx:47
RPadExtent(const RPadLength &horiz, const RPadLength &vert)
Definition: RPadExtent.hxx:37
RPadExtent & operator-=(const RPadExtent &rhs)
Subtract a RPadExtent.
Definition: RPadExtent.hxx:71
RPadExtent & operator+=(const RPadExtent &rhs)
Add a RPadExtent.
Definition: RPadExtent.hxx:63
friend RPadExtent operator+(RPadExtent lhs, const RPadExtent &rhs)
Add two RPadExtents.
Definition: RPadExtent.hxx:51
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
A scale factor (separate factors for horizontal and vertical) for scaling a RPadLength.
Definition: RPadExtent.hxx:82
double fHoriz
Horizontal scale factor.
Definition: RPadExtent.hxx:83
double fVert
Vertical scale factor.
Definition: RPadExtent.hxx:84