KaliVeda
Toolkit for HIC analysis
run_index_list.h
1 #pragma once
2 
3 #include "run_index.h"
4 #include <set>
5 #include "KVNumberList.h"
6 
32  std::set<run_index_t> fRunList;
33 public:
35  {
36  SetList(l);
37  }
38  run_index_list() = default;
39  run_index_list(const run_index_list&) = default;
43 
44  auto begin() const
45  {
46  return std::begin(fRunList);
47  }
48  auto end() const
49  {
50  return std::end(fRunList);
51  }
52  auto rbegin() const
53  {
54  return std::rbegin(fRunList);
55  }
56  auto rend() const
57  {
58  return std::rend(fRunList);
59  }
60 
61  void Add(const run_index_t& r)
62  {
63  fRunList.insert(r);
64  }
65  void Add(const run_index_list&);
66  void Remove(const run_index_t& r)
67  {
68  fRunList.erase(r);
69  }
70  void Remove(const run_index_list&);
71 
72  bool Contains(const run_index_t& r) const
73  {
74  return fRunList.count(r) > 0;
75  }
76  bool IsEmpty() const
77  {
78  return fRunList.empty();
79  }
80  Bool_t operator!() const
81  {
83  return IsEmpty();
84  }
85  operator Bool_t() const
86  {
88  return !IsEmpty();
89  }
90  TString GetList(bool no_commas = true) const;
91  void SetList(const TString& slist);
92  void SetListSelection(const TString& slist, const run_index_list& full_list);
93  TString AsString(Int_t maxlen = 0) const;
94  Int_t GetNValues() const
95  {
96  return fRunList.size();
97  }
98  Int_t GetEntries() const
99  {
100  return GetNValues();
101  }
102  void Clear()
103  {
104  fRunList.clear();
105  }
106  void ls() const
107  {
108  std::cout << AsString() << std::endl;
109  }
110  void Inter(const run_index_list&);
112  {
114  auto tmp = R1;
115  tmp.Inter(R2);
116  return tmp;
117  }
118 
120 
122  {
123  Add(A);
124  return *this;
125  }
126 
128  {
129  auto tmp = A;
130  tmp += B;
131  return tmp;
132  }
133 
135  {
136  Remove(A);
137  return *this;
138  }
139 
141  {
142  auto tmp = A;
143  tmp -= B;
144  return tmp;
145  }
146 
147  const run_index_t& First() const
148  {
150  auto it = fRunList.cbegin();
151  return *it;
152  }
153  const run_index_t& Last() const
154  {
156  auto it = fRunList.crbegin();
157  return *it;
158  }
159 
161 };
int Int_t
ROOT::R::TRInterface & r
bool Bool_t
#define ClassDef(name, id)
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
List of runfiles specified by run number and file index ,.
TString AsString(Int_t maxlen=0) const
run_index_list(const run_index_list &)=default
Int_t GetEntries() const
run_index_list(run_index_list &&)=default
Int_t GetNValues() const
void SetListSelection(const TString &slist, const run_index_list &full_list)
auto end() const
const run_index_t & Last() const
run_index_list(const TString &l)
run_index_list operator-=(const run_index_list &A)
auto begin() const
std::set< run_index_t > fRunList
void ls() const
void Remove(const run_index_t &r)
void Inter(const run_index_list &)
run_index_list()=default
Bool_t operator!() const
run_index_list & operator=(run_index_list &&)=default
void Add(const run_index_t &r)
run_index_list & operator=(const run_index_list &)=default
friend run_index_list operator-(const run_index_list &A, const run_index_list &B)
bool IsEmpty() const
auto rend() const
const run_index_t & First() const
TString GetList(bool no_commas=true) const
auto rbegin() const
void SetList(const TString &slist)
friend run_index_list operator+(const run_index_list &A, const run_index_list &B)
friend run_index_list operator&&(const run_index_list &R1, const run_index_list &R2)
KVNumberList GetRunNumberList() const
Returns just the list of run numbers.
run_index_list & operator+=(const run_index_list &A)
bool Contains(const run_index_t &r) const
Specifies a runfile according to run number and file index ,.
Definition: run_index.h:31
#define R1(v, w, x, y, z, i)
#define R2(v, w, x, y, z, i)
TLine l