BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Range Class Reference

to specify 1-dim region or range by two floats More...

#include <Range.h>

Public Member Functions

 Range ()
 Constructor.
 
 Range (const Range &)
 Copy constructor.
 
 Range (float low, float high)
 Constructor.
 
virtual float low (void) const
 returns lower limit.
 
virtual float high (void) const
 returns higher limit.
 
virtual float center (void) const
 returns center.
 
virtual float width (void) const
 returns width.
 
virtual float low (float lowIn)
 sets lower limit.
 
virtual float high (float highIn)
 sets higher limit.
 
virtual Rangeset (float low, float high)
 sets range.
 
virtual RangesetByCenter (float center, float width)
 sets range by center and width.
 
Rangeoperator= (const Range &)
 Copy operator.
 
bool operator== (const Range &) const
 returns true if range is the same.
 
bool operator!= (const Range &) const
 returns true if range is different.
 
bool operator& (const Range &) const
 returns true if two are overlaped each other.
 
bool within (const float value) const
 returns true if given value is within a range.
 
bool within2 (const float value) const
 returns true if given value is within a range.
 
bool within (const Range &) const
 returns true if given Range is within(included in) a range.
 
virtual int dump (void) const
 displays debug information.
 
 Range ()
 Constructor.
 
 Range (const Range &)
 Copy constructor.
 
 Range (float low, float high)
 Constructor.
 
virtual float low (void) const
 returns lower limit.
 
virtual float high (void) const
 returns higher limit.
 
virtual float center (void) const
 returns center.
 
virtual float width (void) const
 returns width.
 
virtual float low (float lowIn)
 sets lower limit.
 
virtual float high (float highIn)
 sets higher limit.
 
virtual Rangeset (float low, float high)
 sets range.
 
virtual RangesetByCenter (float center, float width)
 sets range by center and width.
 
Rangeoperator= (const Range &)
 Copy operator.
 
bool operator== (const Range &) const
 returns true if range is the same.
 
bool operator!= (const Range &) const
 returns true if range is different.
 
bool operator& (const Range &) const
 returns true if two are overlaped each other.
 
bool within (const float value) const
 returns true if given value is within a range.
 
bool within2 (const float value) const
 returns true if given value is within a range.
 
bool within (const Range &) const
 returns true if given Range is within(included in) a range.
 
virtual int dump (void) const
 displays debug information.
 

Detailed Description

to specify 1-dim region or range by two floats

Definition at line 19 of file InstallArea/include/TrkReco/TrkReco/Range.h.

Constructor & Destructor Documentation

◆ Range() [1/6]

Range::Range ( )

Constructor.

Definition at line 16 of file Range.cxx.

16 {
17 _low = -999.;
18 _high = -999.;
19}

◆ Range() [2/6]

Range::Range ( const Range ib)

Copy constructor.

Definition at line 21 of file Range.cxx.

21 {
22 _low = ib.low();
23 _high = ib.high();
24}
virtual float high(void) const
returns higher limit.
virtual float low(void) const
returns lower limit.

◆ Range() [3/6]

Range::Range ( float  low,
float  high 
)

Constructor.

Definition at line 26 of file Range.cxx.

26 {
27 if (iHigh > iLow) {
28 _low = iLow;
29 _high = iHigh;
30 }
31 else {
32 _low = iHigh;
33 _high = iLow;
34 }
35}

◆ Range() [4/6]

Range::Range ( )

Constructor.

◆ Range() [5/6]

Range::Range ( const Range )

Copy constructor.

◆ Range() [6/6]

Range::Range ( float  low,
float  high 
)

Constructor.

Member Function Documentation

◆ center() [1/2]

float Range::center ( void  ) const
inlinevirtual

returns center.

Definition at line 129 of file InstallArea/include/TrkReco/TrkReco/Range.h.

129 {
130 return (_low + _high) / 2.;
131}

Referenced by setByCenter().

◆ center() [2/2]

virtual float Range::center ( void  ) const
virtual

returns center.

◆ dump() [1/2]

int Range::dump ( void  ) const
virtual

displays debug information.

Definition at line 45 of file Range.cxx.

45 {
46 std::cout << _low << "~" << _high;
47 return 0;
48}

◆ dump() [2/2]

virtual int Range::dump ( void  ) const
virtual

displays debug information.

◆ high() [1/4]

float Range::high ( float  highIn)
inlinevirtual

sets higher limit.

Definition at line 122 of file InstallArea/include/TrkReco/TrkReco/Range.h.

122 {
123 if (i < _low) i = _low;
124 return _high = i;
125}

◆ high() [2/4]

virtual float Range::high ( float  highIn)
virtual

sets higher limit.

◆ high() [3/4]

float Range::high ( void  ) const
inlinevirtual

returns higher limit.

Definition at line 116 of file InstallArea/include/TrkReco/TrkReco/Range.h.

116 {
117 return _high;
118}

Referenced by operator&(), operator=(), operator==(), Range(), and within().

◆ high() [4/4]

virtual float Range::high ( void  ) const
virtual

returns higher limit.

◆ low() [1/4]

float Range::low ( float  lowIn)
inlinevirtual

sets lower limit.

Definition at line 109 of file InstallArea/include/TrkReco/TrkReco/Range.h.

109 {
110 if (i > _high) i = _high;
111 return _low = i;
112}

◆ low() [2/4]

virtual float Range::low ( float  lowIn)
virtual

sets lower limit.

◆ low() [3/4]

float Range::low ( void  ) const
inlinevirtual

returns lower limit.

Definition at line 103 of file InstallArea/include/TrkReco/TrkReco/Range.h.

103 {
104 return _low;
105}

Referenced by operator&(), operator=(), operator==(), Range(), and within().

◆ low() [4/4]

virtual float Range::low ( void  ) const
virtual

returns lower limit.

◆ operator!=() [1/2]

bool Range::operator!= ( const Range a) const
inline

returns true if range is different.

Definition at line 205 of file InstallArea/include/TrkReco/TrkReco/Range.h.

205 {
206 if ((* this) == a) return false;
207 return true;
208}

◆ operator!=() [2/2]

bool Range::operator!= ( const Range ) const

returns true if range is different.

◆ operator&() [1/2]

bool Range::operator& ( const Range a) const
inline

returns true if two are overlaped each other.

Definition at line 212 of file InstallArea/include/TrkReco/TrkReco/Range.h.

212 {
213 if (within(a.low())) return true;
214 if (within(a.high())) return true;
215 if (a.within(low())) return true;
216 if (a.within(high())) return true;
217 return false;
218}
bool within(const float value) const
returns true if given value is within a range.

◆ operator&() [2/2]

bool Range::operator& ( const Range ) const

returns true if two are overlaped each other.

◆ operator=() [1/2]

Range & Range::operator= ( const Range ib)
inline

Copy operator.

Definition at line 163 of file InstallArea/include/TrkReco/TrkReco/Range.h.

163 {
164 _low = ib.low();
165 _high = ib.high();
166 return * this;
167}

◆ operator=() [2/2]

Range & Range::operator= ( const Range )

Copy operator.

◆ operator==() [1/2]

bool Range::operator== ( const Range a) const

returns true if range is the same.

Definition at line 38 of file Range.cxx.

38 {
39 if (_low != a.low()) return false;
40 if (_high != a.high()) return false;
41 return true;
42}

◆ operator==() [2/2]

bool Range::operator== ( const Range ) const

returns true if range is the same.

◆ set() [1/2]

Range & Range::set ( float  low,
float  high 
)
inlinevirtual

sets range.

Definition at line 141 of file InstallArea/include/TrkReco/TrkReco/Range.h.

141 {
142 if (iHigh > iLow) {
143 _low = iLow;
144 _high = iHigh;
145 }
146 else {
147 _low = iHigh;
148 _high = iLow;
149 }
150 return * this;
151}

◆ set() [2/2]

virtual Range & Range::set ( float  low,
float  high 
)
virtual

sets range.

◆ setByCenter() [1/2]

Range & Range::setByCenter ( float  center,
float  width 
)
inlinevirtual

sets range by center and width.

Definition at line 155 of file InstallArea/include/TrkReco/TrkReco/Range.h.

155 {
156 _low = center - width;
157 _high = center + width;
158 return * this;
159}
virtual float width(void) const
returns width.
virtual float center(void) const
returns center.

◆ setByCenter() [2/2]

virtual Range & Range::setByCenter ( float  center,
float  width 
)
virtual

sets range by center and width.

◆ width() [1/2]

float Range::width ( void  ) const
inlinevirtual

returns width.

Definition at line 135 of file InstallArea/include/TrkReco/TrkReco/Range.h.

135 {
136 return (_high - _low);
137}

Referenced by setByCenter().

◆ width() [2/2]

virtual float Range::width ( void  ) const
virtual

returns width.

◆ within() [1/4]

bool Range::within ( const float  value) const
inline

returns true if given value is within a range.

Definition at line 171 of file InstallArea/include/TrkReco/TrkReco/Range.h.

171 {
172 if (_low == -999. && _high == -999.) {
173 return false;
174 }
175 if (_low == -999.) {
176 if (f <= _high) return true;
177 return false;
178 }
179 if (_high == -999.) {
180 if (f >= _low) return true;
181 }
182 if (f >= _low && f <= _high) return true;
183 return false;
184}

Referenced by operator&(), and within().

◆ within() [2/4]

bool Range::within ( const float  value) const

returns true if given value is within a range.

◆ within() [3/4]

bool Range::within ( const Range a) const
inline

returns true if given Range is within(included in) a range.

Definition at line 222 of file InstallArea/include/TrkReco/TrkReco/Range.h.

222 {
223 if (within(a.low()) && within(a.high())) return true;
224 return false;
225}

◆ within() [4/4]

bool Range::within ( const Range ) const

returns true if given Range is within(included in) a range.

◆ within2() [1/2]

bool Range::within2 ( const float  value) const
inline

returns true if given value is within a range.

Definition at line 188 of file InstallArea/include/TrkReco/TrkReco/Range.h.

188 {
189 if (_low == -999. && _high == -999.) {
190 return true;
191 }
192 if (_low == -999.) {
193 if (f <= _high) return true;
194 return false;
195 }
196 if (_high == -999.) {
197 if (f >= _low) return true;
198 }
199 if (f >= _low && f <= _high) return true;
200 return false;
201}

◆ within2() [2/2]

bool Range::within2 ( const float  value) const

returns true if given value is within a range.


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