ATLAS Offline Software
grl_run.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
18 #ifndef GRLRUN_H
19 #define GRLRUN_H
20 
21 #include <iostream>
22 #include <vector>
23 #include <map>
24 
25 
26 class grl_run : public std::vector<std::pair<int,int> > {
27 
28 public:
29 
30  grl_run( int run ) : m_run(run), m_size(0), m_first(0), m_last(0) { }
31 
32  grl_run( int run, int first, int last ) : m_run(run), m_size(0), m_first(0), m_last(0) {
33  this->push_back( std::pair<int,int>( first, last ) );
34  m_size += last-first+1;
35  m_first = first;
36  m_last = last;
37  }
38 
39  virtual ~grl_run() { }
40 
41  void add_range( int first, int last ) {
42  this->push_back( std::pair<int,int>( first, last ) );
43  m_size += last-first+1;
44  if ( last>m_last ) m_last = last;
45  if ( m_first==0 || first<m_first ) m_first = first;
46 
47  }
48 
49  int run() const { return m_run; }
50  int first() const { return m_first; }
51  int last() const { return m_last; }
52 
53  int lbsize() const { return m_size; }
54 
55  static bool comparison( const grl_run* r1, const grl_run* r2 ) {
56  return r1->lbsize()>r2->lbsize();
57  }
58 
59 
60 private:
61 
62  int m_run;
63 
64  int m_size;
65 
66  int m_first;
67  int m_last;
68 
69 };
70 
71 
72 
73 inline std::ostream& operator<<( std::ostream& s, const grl_run& g ) {
74  return s << "[run: " << g.run() << "\t: " << g.first() << "\t - " << g.last() << "\t: size " << g.lbsize() << " ]";
75 }
76 
77 
78 #endif // GRLRUN_H
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
grl_run::last
int last() const
Definition: grl_run.h:51
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
grl_run::grl_run
grl_run(int run, int first, int last)
Definition: grl_run.h:32
grl_run::lbsize
int lbsize() const
Definition: grl_run.h:53
grl_run::grl_run
grl_run(int run)
Definition: grl_run.h:30
grl_run::add_range
void add_range(int first, int last)
Definition: grl_run.h:41
grl_run::comparison
static bool comparison(const grl_run *r1, const grl_run *r2)
Definition: grl_run.h:55
operator<<
std::ostream & operator<<(std::ostream &s, const grl_run &g)
Definition: grl_run.h:73
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
run
Definition: run.py:1
grl_run::~grl_run
virtual ~grl_run()
Definition: grl_run.h:39
grl_run::m_first
int m_first
Definition: grl_run.h:66
grl_run::m_last
int m_last
Definition: grl_run.h:67
grl_run::run
int run() const
Definition: grl_run.h:49
grl_run::m_run
int m_run
Definition: grl_run.h:62
grl_run::m_size
int m_size
Definition: grl_run.h:64
grl_run::first
int first() const
Definition: grl_run.h:50
grl_run
Definition: grl_run.h:26