15 : TGoodRunsList(
"noname")
22 , TNamed(name,
"notitle")
39 m_logger <<
kWARNING <<
"Incompatible NamedLumiRanges: " <<
GEndl;
41 other.Summary(kFALSE);
48 for (
const auto& othermditem : other.GetMetaData()) {
49 auto thismditem =
m_metadata.find(othermditem.first);
53 auto& nameStr = othermditem.first;
54 auto& thisvaluestr = thismditem->second;
55 if (thisvaluestr != othermditem.second) {
56 if (nameStr ==
"RunList") {
59 thisvaluestr +=
" | ";
61 thisvaluestr += othermditem.second;
68 std::map<Int_t,Root::TGoodRun>::const_iterator itr;
70 for (itr = diffgrl.begin(); itr!=diffgrl.end(); ++itr) {
71 if (this->
find(itr->first)!=this->end()) {
73 if (!grun.
IsEmpty()) (*this)[itr->first] = grun;
74 }
else if (!itr->second.IsEmpty()) {
75 (*this)[itr->first] = itr->second;
86 overlapgrl.SetName(
"Overlap of GRLs");
93 m_logger <<
kWARNING <<
"Incompatible NamedLumiRanges: " <<
GEndl;
95 other.Summary(kFALSE);
96 m_logger <<
kWARNING <<
"Returning empty GoodRunsList." <<
GEndl;
101 overlapgrl.SetName(this->GetName());
107 std::map<Int_t,Root::TGoodRun>::const_iterator itr = this->begin();
108 for (; itr!=this->end(); ++itr) {
109 if (other.find(itr->first)!=other.end()) {
110 Root::TGoodRun grun = itr->second.GetOverlapWith( other.find(itr->first)->second ) ;
113 overlapgrl[itr->first] = grun;
126 sumgrl.SetName(
"Sum of GRLs");
133 m_logger <<
kWARNING <<
"Incompatible NamedLumiRanges: " <<
GEndl;
135 other.Summary(kFALSE);
136 m_logger <<
kWARNING <<
"Returning empty GoodRunsList." <<
GEndl;
141 sumgrl.SetName(this->GetName());
146 std::map<Int_t,Root::TGoodRun>::const_iterator itr;
148 for (itr = this->begin(); itr!=this->end(); ++itr) {
149 if (other.find(itr->first)!=other.end()) {
150 Root::TGoodRun grun = itr->second.GetSumWith( other.find(itr->first)->second ) ;
151 if (!grun.
IsEmpty()) sumgrl[itr->first] = grun;
152 }
else if (!itr->second.IsEmpty()) {
153 sumgrl[itr->first] = itr->second;
157 for (itr = other.begin(); itr!=other.end(); ++itr) {
158 if (sumgrl.find(itr->first)==sumgrl.end() && !itr->second.IsEmpty()) {
159 sumgrl[itr->first] = itr->second;
170 return other.GetPartNotIn(*
this);
178 notinother.SetName(
"Difference of GRLs");
185 m_logger <<
kWARNING <<
"Incompatible NamedLumiRanges: " <<
GEndl;
187 other.Summary(kFALSE);
188 m_logger <<
kWARNING <<
"Returning empty GoodRunsList." <<
GEndl;
193 notinother.SetName(this->GetName());
198 std::map<Int_t,Root::TGoodRun>::const_iterator itr;
200 for (itr = this->begin(); itr!=this->end(); ++itr) {
201 if (other.find(itr->first)!=other.end()) {
202 Root::TGoodRun notinrun = itr->second.GetPartNotIn( other.find(itr->first)->second ) ;
203 if (!notinrun.
IsEmpty()) notinother[itr->first] = notinrun;
204 }
else if (!itr->second.IsEmpty()) {
205 notinother[itr->first] = itr->second;
216 return ( this->
find(runnr)!=this->end() );
223 const auto run = this->
find(runnr);
224 return (
run!=this->end() &&
run->second.HasLB( lumiblocknr ) );
231 std::map<TString,TString>::const_iterator itr =
m_metadata.begin();
233 TString triggername = itr->first;
234 triggername.ToLower();
235 if (triggername.BeginsWith(
"trigger") && itr->second.Length()>0)
return kTRUE;
245 bool isEmpty = overlapgrl.
IsEmpty();
261 std::map<TString,TString>::const_iterator titr =
m_metadata.begin();
263 m_logger <<
kINFO <<
"Metadata: " << (titr->first) <<
" : " << (titr->second) <<
GEndl;
265 m_logger <<
kINFO <<
"Number of runs: " << this->size() <<
GEndl;
269 std::map<Int_t,Root::TGoodRun>::const_iterator itr = this->begin();
270 std::map<Int_t,Root::TGoodRun>::const_iterator end = this->end();
271 for (; itr!=end; ++itr) itr->second.Summary();
279 std::vector<int> runlist;
280 for (
const auto& [runno,
run] : *
this) runlist.push_back(runno);
286std::vector<Root::TGoodRun>
289 std::vector<Root::TGoodRun> runlist;
290 for (
const auto& [runno,
run] : *
this) runlist.push_back(
run);
296std::vector<std::string>
299 std::vector<std::string> triggerchains;
302 TString triggername = key;
303 triggername.ToLower();
304 if (triggername.BeginsWith(
"trigger") && value.Length()>0) triggerchains.push_back(value.Data());
306 return triggerchains;
310std::vector<std::string>
313 std::vector<std::string> streamlist;
316 TString streamname = key;
317 streamname.ToLower();
318 if (streamname.BeginsWith(
"stream") && value.Length()>0) streamlist.push_back(value.Data());
331 same = same && (TString(this->GetName())==TString(other.GetName())) ;
333 m_logger <<
kDEBUG <<
"Incompatible names: <" << this->GetName() <<
"> <" << other.GetName() <<
">" <<
GEndl;
337 same = same && (this->
GetVersion()==other.GetVersion()) ;
339 m_logger <<
kDEBUG <<
"Incompatible versions: <" << this->
GetVersion() <<
"> <" << other.GetVersion() <<
">" <<
GEndl;
344 std::map<TString,TString>::const_iterator mitr = this->
GetMetaData().find(
"RQTSVNVersion");
345 std::map<TString,TString>::const_iterator oitr = other.GetMetaData().find(
"RQTSVNVersion");
346 if ( mitr==this->
GetMetaData().end() && oitr==other.GetMetaData().end() ) {
348 }
else if ( mitr!=this->
GetMetaData().end() && oitr!=other.GetMetaData().end() ) {
349 same = same && ( mitr->second==oitr->second );
350 if (!same) { m_logger <<
kDEBUG <<
"Incompatible run query versions: " << mitr->first
351 <<
" : <" << mitr->second <<
"> <" << oitr->second <<
">" <<
GEndl; }
352 }
else { same=kFALSE; }
356 same = same && (this->GetMetaData().size()==other.GetMetaData().size()) ;
358 m_logger << kDEBUG << "Incompatible metadata sizes: <" << this->GetMetaData().size() << "> <" << other.GetMetaData().size() << ">" << GEndl;
362 std::map<TString,TString>::const_iterator mitr = this->GetMetaData().begin();
363 for(; mitr!=this->GetMetaData().end() && same; ++mitr) {
364 if (other.GetMetaData().find(mitr->first)!=other.GetMetaData().end()) {
365 same = same && ( mitr->second==(other.GetMetaData().find(mitr->first))->second );
366 if (!same) { m_logger << kDEBUG << "Incompatible metadata: " << mitr->first
367 << " : <" << mitr->second << "> <" << (other.GetMetaData().find(mitr->first))->second << ">" << GEndl; }
378 if (this->
empty())
return kTRUE;
380 Bool_t isEmpty(kTRUE);
381 std::map< Int_t, TGoodRun >::const_iterator litr = this->begin();
382 for (; litr!=this->end() && isEmpty; ++litr)
383 isEmpty = isEmpty && litr->second.IsEmpty();
392 if (this->
IsEmpty())
return "grl_empty";
394 Int_t beginrun(-1), endrun(-1), beginlb(-1), endlb(-1);
401 beginlb = begingr.begin()->Begin();
405 endlb = endgr.rbegin()->End();
408 return Form(
"grl_%d.%d-%d.%d",beginrun,beginlb,endrun,endlb);
415 if (runnr<0 || lumiblocknr<0)
return;
418 std::map< Int_t, TGoodRun >::iterator itr = this->
find(runnr);
419 if (itr==this->end()) {
420 this->insert( std::pair< Int_t, TGoodRun >(runnr,
Root::TGoodRun(runnr)) );
421 itr = this->
find(runnr);
424 itr->second.AddLB(lumiblocknr);
431 for (
auto& [runno,
run] : *
this)
run.Compress();
ClassImp(Root::TGoodRunsList) Root
static const Attributes_t empty
Int_t GetRunNumber() const
std::vector< int > GetRunlist() const
Bool_t HasTriggerInfo() const
void Summary(Bool_t verbose=kFALSE) const
void SetVersion(const TString &version)
Bool_t HasRun(Int_t runnr) const
Bool_t HasSameGRLInfo(const TGoodRunsList &other) const
const TString & GetVersion() const
std::vector< std::string > GetTriggerList() const
const Root::TGoodRunsList GetSumWith(const TGoodRunsList &other) const
const Root::TGoodRunsList GetPartNotIn(const TGoodRunsList &other) const
Bool_t HasOverlapWith(const TGoodRunsList &other, bool verb=false) const
Bool_t HasRunLumiBlock(Int_t runnr, Int_t lumiblocknr) const
const Root::TGoodRunsList GetPartOnlyIn(const TGoodRunsList &other) const
void SetMetaData(const std::map< TString, TString > &metadata)
void AddRunLumiBlock(Int_t runnr, Int_t lumiblocknr)
const std::map< TString, TString > & GetMetaData() const
std::vector< Root::TGoodRun > GetGoodRuns() const
void AddGRL(const TGoodRunsList &other)
std::vector< std::string > GetStreamList() const
std::map< TString, TString > m_metadata
const Root::TGoodRunsList GetOverlapWith(const TGoodRunsList &other) const
TString GetSuggestedName() const
std::string find(const std::string &s)
return a remapped string