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  TString GetList(bool no_commas = true) const;
81  void SetList(const TString& slist);
82  void SetListSelection(const TString& slist, const run_index_list& full_list);
83  TString AsString(Int_t maxlen = 0) const;
84  Int_t GetNValues() const
85  {
86  return fRunList.size();
87  }
88  Int_t GetEntries() const
89  {
90  return GetNValues();
91  }
92  void Clear()
93  {
94  fRunList.clear();
95  }
96  void ls() const
97  {
98  std::cout << AsString() << std::endl;
99  }
100  void Inter(const run_index_list&);
102 
104  {
105  auto tmp = A;
106  tmp.Remove(B);
107  return tmp;
108  }
109 
111  {
112  auto tmp = A;
113  tmp.Add(B);
114  return tmp;
115  }
116 
117  const run_index_t& First() const
118  {
120  auto it = fRunList.cbegin();
121  return *it;
122  }
123  const run_index_t& Last() const
124  {
126  auto it = fRunList.crbegin();
127  return *it;
128  }
129 
131 };
int Int_t
ROOT::R::TRInterface & r
#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)
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
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)
KVNumberList GetRunNumberList() const
Returns just the list of run numbers.
bool Contains(const run_index_t &r) const
Specifies a runfile according to run number and file index ,.
Definition: run_index.h:31
TLine l