Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:47

0001 /*************************************************************************
0002  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 #ifndef ROOT7_RPadExtent
0010 #define ROOT7_RPadExtent
0011 
0012 #include "ROOT/RPadLength.hxx"
0013 
0014 #include <array>
0015 #include <string>
0016 
0017 namespace ROOT {
0018 namespace Experimental {
0019 
0020 /** \class RPadExtent
0021 \ingroup GpadROOT7
0022 \brief An extent / size (horizontal and vertical) in a `RPad`.
0023 \author Axel Naumann <axel@cern.ch>
0024 \date 2017-07-07
0025 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0026 */
0027 class RPadExtent  {
0028 
0029    RPadLength fHoriz;   ///<  horizontal part
0030 
0031    RPadLength fVert;    ///<   vertical part
0032 
0033 public:
0034 
0035    RPadExtent() = default;
0036 
0037    RPadExtent(const RPadLength& horiz, const RPadLength& vert) : RPadExtent()
0038    {
0039       fHoriz = horiz;
0040       fVert = vert;
0041    }
0042 
0043    RPadLength &Horiz() { return fHoriz; }
0044    const RPadLength &Horiz() const { return fHoriz; }
0045 
0046    RPadLength &Vert() { return fVert; }
0047    const RPadLength &Vert() const { return fVert; }
0048 
0049 
0050    /// Add two `RPadExtent`s.
0051    friend RPadExtent operator+(RPadExtent lhs, const RPadExtent &rhs)
0052    {
0053       return {lhs.fHoriz + rhs.fHoriz, lhs.fVert + rhs.fVert};
0054    }
0055 
0056    /// Subtract two `RPadExtent`s.
0057    friend RPadExtent operator-(RPadExtent lhs, const RPadExtent &rhs)
0058    {
0059       return {lhs.fHoriz - rhs.fHoriz, lhs.fVert - rhs.fVert};
0060    }
0061 
0062    /// Add a `RPadExtent`.
0063    RPadExtent &operator+=(const RPadExtent &rhs)
0064    {
0065       fHoriz += rhs.fHoriz;
0066       fVert += rhs.fVert;
0067       return *this;
0068    };
0069 
0070    /// Subtract a `RPadExtent`.
0071    RPadExtent &operator-=(const RPadExtent &rhs)
0072    {
0073       fHoriz -= rhs.fHoriz;
0074       fVert -= rhs.fVert;
0075       return *this;
0076    };
0077 
0078    /** \struct ScaleFactor
0079        \ingroup GpadROOT7
0080        \brief A scale factor (separate factors for horizontal and vertical) for scaling a `RPadLength`.
0081    */
0082    struct ScaleFactor {
0083       double fHoriz; ///< Horizontal scale factor
0084       double fVert;  ///< Vertical scale factor
0085    };
0086 
0087    /// Scale a horizontally and vertically.
0088    /// \param scale - the scale factor,
0089    RPadExtent &operator*=(const ScaleFactor &scale)
0090    {
0091       fHoriz *= scale.fHoriz;
0092       fVert *= scale.fVert;
0093       return *this;
0094    };
0095 };
0096 
0097 
0098 } // namespace Experimental
0099 } // namespace ROOT
0100 
0101 #endif