ATLAS Offline Software
Loading...
Searching...
No Matches
grl_run.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
16
17
18#ifndef GRLRUN_H
19#define GRLRUN_H
20
21#include <iostream>
22#include <vector>
23#include <map>
24
25
26class grl_run : public std::vector<std::pair<int,int> > {
27
28public:
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
60private:
61
62 int m_run;
63
64 int m_size;
65
67 int m_last;
68
69};
70
71
72
73inline 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
virtual ~grl_run()
Definition grl_run.h:39
int m_last
Definition grl_run.h:67
int last() const
Definition grl_run.h:51
int run() const
Definition grl_run.h:49
int first() const
Definition grl_run.h:50
int lbsize() const
Definition grl_run.h:53
grl_run(int run, int first, int last)
Definition grl_run.h:32
int m_first
Definition grl_run.h:66
void add_range(int first, int last)
Definition grl_run.h:41
grl_run(int run)
Definition grl_run.h:30
static bool comparison(const grl_run *r1, const grl_run *r2)
Definition grl_run.h:55
int m_size
Definition grl_run.h:64
int m_run
Definition grl_run.h:62
std::ostream & operator<<(std::ostream &s, const grl_run &g)
Definition grl_run.h:73
Definition run.py:1