ATLAS Offline Software
Loading...
Searching...
No Matches
Root::TGRLCollection Class Reference

#include <TGRLCollection.h>

Inheritance diagram for Root::TGRLCollection:
Collaboration diagram for Root::TGRLCollection:

Public Member Functions

 TGRLCollection (Bool_t checkGRLInfo=kFALSE)
virtual ~TGRLCollection ()
 TGRLCollection (const Root::TGRLCollection &other)=default
TGRLCollectionoperator= (const TGRLCollection &other)=default
 TGRLCollection (Root::TGRLCollection &&)=default
TGRLCollectionoperator= (TGRLCollection &&other)=default
void SetVersion (const TString &version)
void SetMetaData (const std::map< TString, TString > &metadata)
void SetCheckGRLInfo (Bool_t check=kTRUE)
Bool_t HasRun (const Int_t &runnr) const
Bool_t HasRunLumiBlock (const Int_t &runnr, const Int_t &lumiblocknr) const
Bool_t IsEmpty () const
Bool_t HasGoodRunsList (const TString &name) const
const TGoodRunsList GetMergedGoodRunsList (const Root::BoolOperation &operation=OR) const
const TGoodRunsList GetGoodRunsList (unsigned int idx) const
std::vector< TGoodRunsList >::iterator find (const TString &name)
std::vector< TGoodRunsList >::const_iterator find (const TString &name) const
const Root::TGRLCollection GetMergedGRLCollection (const Root::BoolOperation &operation=OR) const
const Root::TGRLCollection GetOverlapWith (const TGoodRunsList &other) const
void Reset ()
void Summary (Bool_t verbose=kFALSE) const

Public Attributes

elements
 STL member.

Private Attributes

Bool_t m_checkGRLInfo

Detailed Description

Definition at line 24 of file TGRLCollection.h.

Constructor & Destructor Documentation

◆ TGRLCollection() [1/3]

Root::TGRLCollection::TGRLCollection ( Bool_t checkGRLInfo = kFALSE)

◆ ~TGRLCollection()

Root::TGRLCollection::~TGRLCollection ( )
virtual

Definition at line 22 of file TGRLCollection.cxx.

23{
24 this->Reset();
25}

◆ TGRLCollection() [2/3]

Root::TGRLCollection::TGRLCollection ( const Root::TGRLCollection & other)
default

◆ TGRLCollection() [3/3]

Root::TGRLCollection::TGRLCollection ( Root::TGRLCollection && )
default

Member Function Documentation

◆ find() [1/2]

std::vector< Root::TGoodRunsList >::iterator Root::TGRLCollection::find ( const TString & name)

Definition at line 205 of file TGRLCollection.cxx.

206{
207 Bool_t found(false);
208
209 std::vector<TGoodRunsList>::iterator itr = this->begin();
210 std::vector<TGoodRunsList>::iterator end = this->end();
211
212 for (; itr!=end; ++itr) {
213 found = ( name==TString(itr->GetName()) ) ;
214 if (found) break;
215 }
216
217 return itr;
218}

◆ find() [2/2]

std::vector< Root::TGoodRunsList >::const_iterator Root::TGRLCollection::find ( const TString & name) const

Definition at line 222 of file TGRLCollection.cxx.

223{
224 Bool_t found(false);
225
226 std::vector<TGoodRunsList>::const_iterator itr = this->begin();
227 std::vector<TGoodRunsList>::const_iterator end = this->end();
228
229 for (; itr!=end; ++itr) {
230 found = ( name==TString(itr->GetName()) ) ;
231 if (found) break;
232 }
233
234 return itr;
235}

◆ GetGoodRunsList()

const Root::TGoodRunsList Root::TGRLCollection::GetGoodRunsList ( unsigned int idx) const

Definition at line 151 of file TGRLCollection.cxx.

152{
153 // invalid idx. Return empty grl.
154 if (idx>=this->size()) return Root::TGoodRunsList();
155
156 return (*this)[idx];
157}

◆ GetMergedGoodRunsList()

const Root::TGoodRunsList Root::TGRLCollection::GetMergedGoodRunsList ( const Root::BoolOperation & operation = OR) const

Definition at line 107 of file TGRLCollection.cxx.

108{
109 // nothing interpreted. Return empty grl.
110 if (this->empty()) return Root::TGoodRunsList();
111
112 // set first goodrunslist
113 std::vector<Root::TGoodRunsList>::const_iterator itr = this->begin();
114 Root::TGoodRunsList grl(*itr);
115 if (this->size()==1) {
116 grl.Compress();
117 return grl;
118 }
119
120 TMsgLogger mylogger( "TGRLCollection" );
121 mylogger << kINFO << "Now merging GRLs." << GEndl;
122
123 // check version and metadata when merging goodrunslists?
124 grl.SetCheckGRLInfo(m_checkGRLInfo);
125
126 if (!m_checkGRLInfo)
127 mylogger << kINFO << "Metadata and other info not required to be identical between GRLs." << GEndl;
128
129 // start AND-ing or OR-ring with following goodrunslists
130 for (++itr; itr!=this->end(); ++itr) {
131 switch (operation) {
132 case OR :
133 if ( grl.HasOverlapWith(*itr,false/*verbose*/) ) { // MB 22-june: LB splitting across files, turn off warning.
134 //mylogger << kWARNING << "Merging GRLs with overlapping lumi-blocks! Overlapping LBs rejected." << GEndl;
135 //mylogger << kWARNING << "IMPORTANT : Check your analysis for possible duplicate events!" << GEndl;
136 }
137 grl.AddGRL( *itr );
138 break;
139 case AND :
140 grl = grl.GetOverlapWith(*itr);
141 break;
142 }
143 }
144
145 grl.Compress(); // cleanup, safe space
146 return grl;
147}
#define GEndl
Definition TMsgLogger.h:147
static const Attributes_t empty
@ kINFO
Definition TMsgLogger.h:40

◆ GetMergedGRLCollection()

const Root::TGRLCollection Root::TGRLCollection::GetMergedGRLCollection ( const Root::BoolOperation & operation = OR) const

Definition at line 161 of file TGRLCollection.cxx.

162{
163 if (this->empty() /*|| this->size()==1*/) return *this; // nothing to merge, return this
164
165 TMsgLogger mylogger( "TGRLCollection" );
166 mylogger << kINFO << "Now merging GRLs where possible. Metadata required to be identical." << GEndl;
167
168 Root::TGRLCollection mergevec;
169
170 std::vector<TGoodRunsList>::const_iterator itr = this->begin();
171 std::vector<TGoodRunsList>::const_iterator end = this->end();
172 std::vector<TGoodRunsList>::iterator mitr;
173
174 for (; itr!=end; ++itr) {
175 bool matchFound(false);
176 for (mitr=mergevec.begin(); mitr!=mergevec.end() && !matchFound ; ++mitr) {
177 if (mitr->HasSameGRLInfo(*itr)) {
178 matchFound = true;
179 switch (operation) {
180 case OR :
181 if ( mitr->HasOverlapWith(*itr,false/*verbose*/) ) { // // MB 22-june: LB splitting across files, turn off warning.
182 //mylogger << kWARNING << "Merging GRLs with overlapping lumi-blocks! Overlapping LBs rejected." << GEndl;
183 //mylogger << kWARNING << "IMPORTANT : Check your analysis for possible duplicate events!" << GEndl;
184 }
185 mitr->AddGRL( *itr );
186 break;
187 case AND :
188 *mitr = mitr->GetOverlapWith( *itr );
189 break;
190 }
191 mitr->Compress(); // safe space
192 }
193 }
194 if (!matchFound) {
195 mergevec.push_back(*itr);
196 mergevec.rbegin()->Compress(); // safe space
197 }
198 }
199
200 return mergevec;
201}

◆ GetOverlapWith()

const Root::TGRLCollection Root::TGRLCollection::GetOverlapWith ( const TGoodRunsList & other) const

Definition at line 246 of file TGRLCollection.cxx.

247{
248 Root::TGRLCollection overlapvec;
249
250 std::vector<TGoodRunsList>::const_iterator itr = this->begin();
251 for (; itr!=this->end(); ++itr) {
252 Root::TGoodRunsList overlapgrl = itr->GetOverlapWith(other);
253 overlapgrl.SetName(itr->GetName());
254 overlapgrl.SetVersion(itr->GetVersion());
255 overlapgrl.SetMetaData(itr->GetMetaData());
256 overlapgrl.Compress();
257 overlapvec.push_back(overlapgrl); // also push_back if empty!
258 }
259
260 return overlapvec;
261}
void SetVersion(const TString &version)
void SetMetaData(const std::map< TString, TString > &metadata)

◆ HasGoodRunsList()

Bool_t Root::TGRLCollection::HasGoodRunsList ( const TString & name) const

Definition at line 239 of file TGRLCollection.cxx.

240{
241 return (this->find(name)!=this->end());
242}
std::vector< TGoodRunsList >::iterator find(const TString &name)

◆ HasRun()

Bool_t Root::TGRLCollection::HasRun ( const Int_t & runnr) const

Definition at line 65 of file TGRLCollection.cxx.

66{
67 std::vector<TGoodRunsList>::const_iterator itr = this->begin();
68 std::vector<TGoodRunsList>::const_iterator end = this->end();
69
70 Bool_t pass(kFALSE);
71 for (; itr!=end && !pass; ++itr)
72 pass = itr->HasRun(runnr);
73
74 return pass;
75}

◆ HasRunLumiBlock()

Bool_t Root::TGRLCollection::HasRunLumiBlock ( const Int_t & runnr,
const Int_t & lumiblocknr ) const

Definition at line 79 of file TGRLCollection.cxx.

80{
81 std::vector<TGoodRunsList>::const_iterator itr = this->begin();
82 std::vector<TGoodRunsList>::const_iterator end = this->end();
83
84 Bool_t pass(kFALSE);
85 for (; itr!=end && !pass; ++itr)
86 pass = itr->HasRunLumiBlock(runnr,lumiblocknr);
87
88 return pass;
89}

◆ IsEmpty()

Bool_t Root::TGRLCollection::IsEmpty ( ) const

Definition at line 93 of file TGRLCollection.cxx.

94{
95 if (this->empty()) return kTRUE;
96
97 Bool_t isEmpty(kTRUE);
98 std::vector< TGoodRunsList >::const_iterator litr = this->begin();
99 for (; litr!=this->end() && isEmpty; ++litr)
100 isEmpty = isEmpty && litr->IsEmpty();
101
102 return isEmpty;
103}

◆ operator=() [1/2]

TGRLCollection & Root::TGRLCollection::operator= ( const TGRLCollection & other)
default

◆ operator=() [2/2]

TGRLCollection & Root::TGRLCollection::operator= ( TGRLCollection && other)
default

◆ Reset()

void Root::TGRLCollection::Reset ( )

Definition at line 29 of file TGRLCollection.cxx.

30{
31 this->clear();
32 m_checkGRLInfo=kFALSE;
33}

◆ SetCheckGRLInfo()

void Root::TGRLCollection::SetCheckGRLInfo ( Bool_t check = kTRUE)
inline

Definition at line 38 of file TGRLCollection.h.

◆ SetMetaData()

void Root::TGRLCollection::SetMetaData ( const std::map< TString, TString > & metadata)

Definition at line 46 of file TGRLCollection.cxx.

47{
48 std::vector<TGoodRunsList>::iterator itr = this->begin();
49 std::vector<TGoodRunsList>::iterator end = this->end();
50 for (; itr!=end; ++itr) itr->SetMetaData(metadata);
51}

◆ SetVersion()

void Root::TGRLCollection::SetVersion ( const TString & version)

Definition at line 37 of file TGRLCollection.cxx.

38{
39 std::vector<TGoodRunsList>::iterator itr = this->begin();
40 std::vector<TGoodRunsList>::iterator end = this->end();
41 for (; itr!=end; ++itr) itr->SetVersion(version);
42}

◆ Summary()

void Root::TGRLCollection::Summary ( Bool_t verbose = kFALSE) const

Definition at line 54 of file TGRLCollection.cxx.

55{
56 std::vector<TGoodRunsList>::const_iterator itr = this->begin();
57 std::vector<TGoodRunsList>::const_iterator end = this->end();
58
59 for (; itr!=end; ++itr)
60 itr->Summary(verbose) ;
61}
bool verbose
Definition hcg.cxx:73

Member Data Documentation

◆ elements

T std::vector< T >::elements
inherited

STL member.

◆ m_checkGRLInfo

Bool_t Root::TGRLCollection::m_checkGRLInfo
private

Definition at line 57 of file TGRLCollection.h.


The documentation for this class was generated from the following files: