ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::PhiRange Class Reference

Range class declaration. More...

#include <PhiRange.h>

Collaboration diagram for LVL1::PhiRange:

Public Member Functions

 PhiRange ()
 PhiRange (double min, double max)
 ~PhiRange ()=default
double min () const
double max () const
void setRange (double min, double max)
 sets range
bool contains (double number) const
 returns true if the range contains the number (i.e.
double centre () const
 returns the centre of the two ranges.

Private Member Functions

void checkValues ()
 This function makes sure m_min really is less than m_max.

Private Attributes

double m_min
double m_max

Detailed Description

Range class declaration.

Definition at line 17 of file PhiRange.h.

Constructor & Destructor Documentation

◆ PhiRange() [1/2]

LVL1::PhiRange::PhiRange ( )

Definition at line 19 of file PhiRange.cxx.

20 : m_min( 0.0 ), m_max( 0.0 ) {
21
22 }
double m_max
Definition PhiRange.h:40
double m_min
Definition PhiRange.h:39

◆ PhiRange() [2/2]

LVL1::PhiRange::PhiRange ( double min,
double max )

Definition at line 24 of file PhiRange.cxx.

25 : m_min( min ), m_max( max ) {
26
28 }
double min() const
Definition PhiRange.cxx:30
void checkValues()
This function makes sure m_min really is less than m_max.
Definition PhiRange.cxx:63
double max() const
Definition PhiRange.cxx:34

◆ ~PhiRange()

LVL1::PhiRange::~PhiRange ( )
default

Member Function Documentation

◆ centre()

double LVL1::PhiRange::centre ( ) const

returns the centre of the two ranges.

The ranges are assumed to be <PI. If this is not true, then this function will return a centre opposite the true centre.

Definition at line 93 of file PhiRange.cxx.

93 {
94 double diff = fabs( m_min - m_max );
95 if ( diff > M_PI ) {
96 // range must overlap 2PI
97 double cent = ( m_min + ( m_max - m_min + 2 * M_PI ) / 2 );
98 if ( cent < 0.0 ) return ( 2.0 * M_PI ) + cent;
99 if ( cent > ( 2.0 * M_PI ) ) return cent -( 2.0 * M_PI );
100 return cent;
101 }
102 // diff must be <=M_PI
103 return ( m_min + ( ( m_max - m_min ) / 2 ) );
104
105 }
#define M_PI
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Definition Jet.cxx:631

◆ checkValues()

void LVL1::PhiRange::checkValues ( )
private

This function makes sure m_min really is less than m_max.

This function makes sure m_min really is less than m_max, and checks that phi values are sensible.

Definition at line 63 of file PhiRange.cxx.

63 {
64 // should really check for more extreme values.
65
66// double & tmpMin = m_min;
67// double& tmpMax = m_max;
68
69 if ( m_min < 0.0 ) m_min = ( 2.0 * M_PI ) + m_min;
70 if ( m_max > ( 2.0 * M_PI ) ) m_max -= ( 2.0 * M_PI );
71
72 if ( fabs(m_min-m_max) > M_PI) {
73 // RoI range must span 2PI wraparound. In which case m_min should have higher value, m_max lower
74 if (m_min < m_max) {
75 // swap them
76 double temp = m_max;
77 m_max = m_min;
78 m_min = temp;
79 }
80 }
81 else if ( m_min >= m_max ) {
82 // swap them
83 double temp = m_max;
84 m_max = m_min;
85 m_min = temp;
86 }
87 // }
88 return;
89 }

◆ contains()

bool LVL1::PhiRange::contains ( double number) const

returns true if the range contains the number (i.e.

if min<=number<=max)

if min<=number<=max). Because with phi ranges it loops at phi=2PI, the assumption is made that phiMax-phiMin<PI. If this is not true, the output from this method will be wrong!

Definition at line 50 of file PhiRange.cxx.

50 {
51
52 double diff = fabs( m_min - m_max );
53 if ( diff > M_PI ) {
54 // range must overlap 2PI
55 return ( ( m_min <= number && number <= ( 2 * M_PI ) )
56 || ( ( 0 <= number && number <= m_max ) ) );
57 }
58 // diff must be <=M_PI
59 return ( ( m_min <= number ) && ( number <= m_max ) );
60 }
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186

◆ max()

double LVL1::PhiRange::max ( ) const

Definition at line 34 of file PhiRange.cxx.

34 {
35 return m_max;
36 }

◆ min()

double LVL1::PhiRange::min ( ) const

Definition at line 30 of file PhiRange.cxx.

30 {
31 return m_min;
32 }

◆ setRange()

void LVL1::PhiRange::setRange ( double min,
double max )

sets range

Definition at line 39 of file PhiRange.cxx.

39 {
40 m_min = min;
41 m_max = max;
43 }

Member Data Documentation

◆ m_max

double LVL1::PhiRange::m_max
private

Definition at line 40 of file PhiRange.h.

◆ m_min

double LVL1::PhiRange::m_min
private

Definition at line 39 of file PhiRange.h.


The documentation for this class was generated from the following files: