ATLAS Offline Software
IndexRange.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #ifndef LArSamples_IndexRange_H
11 #define LArSamples_IndexRange_H
12 
13 #include "TString.h"
14 #include "TVectorD.h"
15 
16 namespace LArSamples {
17 
18  class IndexRange
19  {
20  public:
21 
22  virtual ~IndexRange() { }
23 
24  virtual int lwb() const = 0;
25  virtual int upb() const = 0;
26 
27  bool isInRange(int i) const { return (i >= lwb() && i <= upb()); }
28 
29  bool hasSameRange(int lw, int up) const { return (lwb() == lw && upb() == up); }
30  bool hasSameRange(const IndexRange& other) const { return hasSameRange(other.lwb(), other.upb()); }
31  bool hasSameRange(const TVectorD& v) const { return hasSameRange(v.GetLwb(), v.GetUpb()); }
32 
33  bool providesRange(int lw, int up) const { return (lwb() <= lw && upb() >= up); }
34  bool providesRange(const IndexRange& other) const { return providesRange(other.lwb(), other.upb()); }
35  bool providesRange(const TVectorD& v) const { return providesRange(v.GetLwb(), v.GetUpb()); }
36 
37  TString rangeStr() const { return Form("[%d, %d]", lwb(), upb()); }
38 
39  int commonLwb(const IndexRange& other) const { return (other.lwb() > lwb() ? other.lwb() : lwb()); }
40  int commonUpb(const IndexRange& other) const { return (other.upb() < upb() ? other.upb() : upb()); }
41 
42  bool checkRange(int& l, int& h) const;
43  };
44 }
45 
46 #endif
LArSamples::IndexRange::upb
virtual int upb() const =0
LArSamples::IndexRange::providesRange
bool providesRange(const IndexRange &other) const
Definition: IndexRange.h:34
LArSamples::IndexRange::checkRange
bool checkRange(int &l, int &h) const
Definition: IndexRange.cxx:14
python.LumiCalcWorking.lw
lw
Definition: LumiCalcWorking.py:112
LArSamples::IndexRange::hasSameRange
bool hasSameRange(int lw, int up) const
Definition: IndexRange.h:29
LArSamples::IndexRange::rangeStr
TString rangeStr() const
Definition: IndexRange.h:37
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
LArSamples
Definition: AbsShape.h:24
LArSamples::IndexRange::commonUpb
int commonUpb(const IndexRange &other) const
Definition: IndexRange.h:40
LArSamples::IndexRange::hasSameRange
bool hasSameRange(const TVectorD &v) const
Definition: IndexRange.h:31
LArSamples::IndexRange::providesRange
bool providesRange(const TVectorD &v) const
Definition: IndexRange.h:35
LArSamples::IndexRange::isInRange
bool isInRange(int i) const
Definition: IndexRange.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:85
CalibCoolCompareRT.up
up
Definition: CalibCoolCompareRT.py:109
LArSamples::IndexRange::commonLwb
int commonLwb(const IndexRange &other) const
Definition: IndexRange.h:39
LArSamples::IndexRange::lwb
virtual int lwb() const =0
python.PyAthena.v
v
Definition: PyAthena.py:154
LArSamples::IndexRange::hasSameRange
bool hasSameRange(const IndexRange &other) const
Definition: IndexRange.h:30
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
h
LArSamples::IndexRange
storage of the time histories of all the cells
Definition: IndexRange.h:19
LArSamples::IndexRange::providesRange
bool providesRange(int lw, int up) const
Definition: IndexRange.h:33
LArSamples::IndexRange::~IndexRange
virtual ~IndexRange()
Definition: IndexRange.h:22