ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
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)
 
TGRLCollectionoperator= (const TGRLCollection &other)
 
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. More...
 

Private Attributes

Bool_t m_checkGRLInfo
 

Detailed Description

Definition at line 29 of file TGRLCollection.h.

Constructor & Destructor Documentation

◆ TGRLCollection() [1/2]

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/2]

Root::TGRLCollection::TGRLCollection ( const Root::TGRLCollection other)

Definition at line 28 of file TGRLCollection.cxx.

29  : std::vector<TGoodRunsList>(other)
30  , TObject(other)
31  , m_checkGRLInfo(other.m_checkGRLInfo)
32 {
33 }

Member Function Documentation

◆ find() [1/2]

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

Definition at line 226 of file TGRLCollection.cxx.

227 {
228  Bool_t found(false);
229 
232 
233  for (; itr!=end; ++itr) {
234  found = ( name==TString(itr->GetName()) ) ;
235  if (found) break;
236  }
237 
238  return itr;
239 }

◆ find() [2/2]

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

Definition at line 243 of file TGRLCollection.cxx.

244 {
245  Bool_t found(false);
246 
247  std::vector<TGoodRunsList>::const_iterator itr = this->begin();
248  std::vector<TGoodRunsList>::const_iterator end = this->end();
249 
250  for (; itr!=end; ++itr) {
251  found = ( name==TString(itr->GetName()) ) ;
252  if (found) break;
253  }
254 
255  return itr;
256 }

◆ GetGoodRunsList()

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

Definition at line 172 of file TGRLCollection.cxx.

173 {
174  // invalid idx. Return empty grl.
175  if (idx>=this->size()) return Root::TGoodRunsList();
176 
177  return (*this)[idx];
178 }

◆ GetMergedGoodRunsList()

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

Definition at line 128 of file TGRLCollection.cxx.

129 {
130  // nothing interpreted. Return empty grl.
131  if (this->empty()) return Root::TGoodRunsList();
132 
133  // set first goodrunslist
134  std::vector<Root::TGoodRunsList>::const_iterator itr = this->begin();
135  Root::TGoodRunsList grl(*itr);
136  if (this->size()==1) {
137  grl.Compress();
138  return grl;
139  }
140 
141  TMsgLogger mylogger( "TGRLCollection" );
142  mylogger << kINFO << "Now merging GRLs." << GEndl;
143 
144  // check version and metadata when merging goodrunslists?
145  grl.SetCheckGRLInfo(m_checkGRLInfo);
146 
147  if (!m_checkGRLInfo)
148  mylogger << kINFO << "Metadata and other info not required to be identical between GRLs." << GEndl;
149 
150  // start AND-ing or OR-ring with following goodrunslists
151  for (++itr; itr!=this->end(); ++itr) {
152  switch (operation) {
153  case OR :
154  if ( grl.HasOverlapWith(*itr,false/*verbose*/) ) { // MB 22-june: LB splitting across files, turn off warning.
155  //mylogger << kWARNING << "Merging GRLs with overlapping lumi-blocks! Overlapping LBs rejected." << GEndl;
156  //mylogger << kWARNING << "IMPORTANT : Check your analysis for possible duplicate events!" << GEndl;
157  }
158  grl.AddGRL( *itr );
159  break;
160  case AND :
161  grl = grl.GetOverlapWith(*itr);
162  break;
163  }
164  }
165 
166  grl.Compress(); // cleanup, safe space
167  return grl;
168 }

◆ GetMergedGRLCollection()

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

Definition at line 182 of file TGRLCollection.cxx.

183 {
184  if (this->empty() /*|| this->size()==1*/) return *this; // nothing to merge, return this
185 
186  TMsgLogger mylogger( "TGRLCollection" );
187  mylogger << kINFO << "Now merging GRLs where possible. Metadata required to be identical." << GEndl;
188 
189  Root::TGRLCollection mergevec;
190 
191  std::vector<TGoodRunsList>::const_iterator itr = this->begin();
192  std::vector<TGoodRunsList>::const_iterator end = this->end();
194 
195  for (; itr!=end; ++itr) {
196  bool matchFound(false);
197  for (mitr=mergevec.begin(); mitr!=mergevec.end() && !matchFound ; ++mitr) {
198  if (mitr->HasSameGRLInfo(*itr)) {
199  matchFound = true;
200  switch (operation) {
201  case OR :
202  if ( mitr->HasOverlapWith(*itr,false/*verbose*/) ) { // // MB 22-june: LB splitting across files, turn off warning.
203  //mylogger << kWARNING << "Merging GRLs with overlapping lumi-blocks! Overlapping LBs rejected." << GEndl;
204  //mylogger << kWARNING << "IMPORTANT : Check your analysis for possible duplicate events!" << GEndl;
205  }
206  mitr->AddGRL( *itr );
207  break;
208  case AND :
209  *mitr = mitr->GetOverlapWith( *itr );
210  break;
211  }
212  mitr->Compress(); // safe space
213  }
214  }
215  if (!matchFound) {
216  mergevec.push_back(*itr);
217  mergevec.rbegin()->Compress(); // safe space
218  }
219  }
220 
221  return mergevec;
222 }

◆ GetOverlapWith()

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

Definition at line 267 of file TGRLCollection.cxx.

268 {
269  Root::TGRLCollection overlapvec;
270 
271  std::vector<TGoodRunsList>::const_iterator itr = this->begin();
272  for (; itr!=this->end(); ++itr) {
273  Root::TGoodRunsList overlapgrl = itr->GetOverlapWith(other);
274  overlapgrl.SetName(itr->GetName());
275  overlapgrl.SetVersion(itr->GetVersion());
276  overlapgrl.SetMetaData(itr->GetMetaData());
277  overlapgrl.Compress();
278  overlapvec.push_back(overlapgrl); // also push_back if empty!
279  }
280 
281  return overlapvec;
282 }

◆ HasGoodRunsList()

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

Definition at line 260 of file TGRLCollection.cxx.

261 {
262  return (this->find(name)!=this->end());
263 }

◆ HasRun()

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

Definition at line 86 of file TGRLCollection.cxx.

87 {
88  std::vector<TGoodRunsList>::const_iterator itr = this->begin();
89  std::vector<TGoodRunsList>::const_iterator end = this->end();
90 
91  Bool_t pass(kFALSE);
92  for (; itr!=end && !pass; ++itr)
93  pass = itr->HasRun(runnr);
94 
95  return pass;
96 }

◆ HasRunLumiBlock()

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

Definition at line 100 of file TGRLCollection.cxx.

101 {
102  std::vector<TGoodRunsList>::const_iterator itr = this->begin();
103  std::vector<TGoodRunsList>::const_iterator end = this->end();
104 
105  Bool_t pass(kFALSE);
106  for (; itr!=end && !pass; ++itr)
107  pass = itr->HasRunLumiBlock(runnr,lumiblocknr);
108 
109  return pass;
110 }

◆ IsEmpty()

Bool_t Root::TGRLCollection::IsEmpty ( ) const

Definition at line 114 of file TGRLCollection.cxx.

115 {
116  if (this->empty()) return kTRUE;
117 
118  Bool_t isEmpty(kTRUE);
119  std::vector< TGoodRunsList >::const_iterator litr = this->begin();
120  for (; litr!=this->end() && isEmpty; ++litr)
121  isEmpty = isEmpty && litr->IsEmpty();
122 
123  return isEmpty;
124 }

◆ operator=()

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

Definition at line 37 of file TGRLCollection.cxx.

38 {
39  if (&other==this) {
40  return *this ;
41  }
42  std::vector<TGoodRunsList>::operator=(other);
43  m_checkGRLInfo=other.m_checkGRLInfo;
44 
45  return *this ;
46 }

◆ Reset()

void Root::TGRLCollection::Reset ( )

Definition at line 50 of file TGRLCollection.cxx.

51 {
52  this->clear();
53  m_checkGRLInfo=kFALSE;
54 }

◆ SetCheckGRLInfo()

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

Definition at line 41 of file TGRLCollection.h.

◆ SetMetaData()

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

Definition at line 67 of file TGRLCollection.cxx.

68 {
71  for (; itr!=end; ++itr) itr->SetMetaData(metadata);
72 }

◆ SetVersion()

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

Definition at line 58 of file TGRLCollection.cxx.

59 {
62  for (; itr!=end; ++itr) itr->SetVersion(version);
63 }

◆ Summary()

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

Definition at line 75 of file TGRLCollection.cxx.

76 {
77  std::vector<TGoodRunsList>::const_iterator itr = this->begin();
78  std::vector<TGoodRunsList>::const_iterator end = this->end();
79 
80  for (; itr!=end; ++itr)
81  itr->Summary(verbose) ;
82 }

Member Data Documentation

◆ elements

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

STL member.

◆ m_checkGRLInfo

Bool_t Root::TGRLCollection::m_checkGRLInfo
private

Definition at line 60 of file TGRLCollection.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Root::TGRLCollection::m_checkGRLInfo
Bool_t m_checkGRLInfo
Definition: TGRLCollection.h:60
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
Root::AND
@ AND
Definition: TGRLCollection.h:32
collisions.grl
grl
Definition: collisions.py:25
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
Root::TGRLCollection::find
std::vector< TGoodRunsList >::iterator find(const TString &name)
Definition: TGRLCollection.cxx:226
GEndl
#define GEndl
Definition: TMsgLogger.h:151
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
grl
Definition: ZLumiScripts/grid/grl.py:1
Root::kINFO
@ kINFO
Definition: TMsgLogger.h:50
Root::TGoodRunsList::Compress
void Compress()
Definition: TGoodRunsList.cxx:429
Root::TGoodRunsList::SetMetaData
void SetMetaData(const std::map< TString, TString > &metadata)
Definition: TGoodRunsList.h:59
Root::TGoodRunsList::SetVersion
void SetVersion(const TString &version)
Definition: TGoodRunsList.h:57
beamspotman.runnr
runnr
Definition: beamspotman.py:724
Root::TGRLCollection
Definition: TGRLCollection.h:29
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Root::TGoodRunsList
Definition: TGoodRunsList.h:31
get_generator_info.version
version
Definition: get_generator_info.py:33
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
Root::TGRLCollection::Reset
void Reset()
Definition: TGRLCollection.cxx:50
Root::OR
@ OR
Definition: TGRLCollection.h:32
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69