ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LumiBlockRangeContainerConverter Class Reference

#include <LumiBlockRangeContainerConverter.h>

Collaboration diagram for LumiBlockRangeContainerConverter:

Public Member Functions

 LumiBlockRangeContainerConverter ()
 
virtual ~LumiBlockRangeContainerConverter ()
 
 LumiBlockRangeContainerConverter (const LumiBlockRangeContainerConverter &)=delete
 
LumiBlockRangeContainerConverteroperator= (const LumiBlockRangeContainerConverter &)=delete
 
xAOD::LumiBlockRangeContainerGetLumiBlockRangeContainer (const Root::TGoodRunsList &grl, std::map< TString, TString > &metadata, TString &version)
 
xAOD::LumiBlockRangeContainerGetLumiBlockRangeContainer (const Root::TGoodRunsList &grl) const
 
xAOD::LumiBlockRangeContainerGetLumiBlockRangeContainer (const char *xmlfile)
 
xAOD::LumiBlockRangeContainerGetLumiBlockRangeContainerFromString (const TString &xmlstring)
 
void CreateXMLFile (const Root::TGoodRunsList &grl, const TString &xmlfilename="", const TString &prefix="")
 
void CreateXMLFile (const Root::TGRLCollection &grlcollection, const char *xmlfilename)
 
void CreateXMLFile (const xAOD::LumiBlockRangeContainer &lbc, const grlmetadatamap &metadata=grlmetadatamap(), const char *version="", const TString &xmlfilename="", const TString &prefix="")
 
void CreateXMLFiles (const Root::TGRLCollection &grlcollection, const char *prefix)
 
const TString GetXMLString (const Root::TGoodRunsList &grl)
 
const TString GetXMLString (const Root::TGRLCollection &grlcollection)
 
const TString GetXMLString (const xAOD::LumiBlockRangeContainer &lbc, const grlmetadatamap &metadata=grlmetadatamap(), const char *version="")
 
const std::vector< TString > GetXMLStrings (const Root::TGRLCollection &grlcollection)
 
Root::TGoodRunsListGetGRLObject (const xAOD::LumiBlockRangeContainer &lbc, const grlmetadatamap &metadata=grlmetadatamap(), const char *version="") const
 
Root::TGoodRunsListGetGRLObject (const char *xmlfile)
 
Root::TGoodRunsListGetGRLObjectFromString (const TString &xmlstring)
 
Root::TGRLCollectionGetGRLCollection (const char *xmlfile)
 
Root::TGRLCollectionGetGRLCollectionFromString (const TString &xmlstring)
 
const TString GetSuggestedName (const xAOD::LumiBlockRangeContainer &lbc) const
 

Private Attributes

Root::TGoodRunsListReaderm_reader
 
Root::TGoodRunsListWriterm_writer
 

Detailed Description

Definition at line 34 of file LumiBlockRangeContainerConverter.h.

Constructor & Destructor Documentation

◆ LumiBlockRangeContainerConverter() [1/2]

LumiBlockRangeContainerConverter::LumiBlockRangeContainerConverter ( )

Definition at line 19 of file LumiBlockRangeContainerConverter.cxx.

22 {
23 }

◆ ~LumiBlockRangeContainerConverter()

LumiBlockRangeContainerConverter::~LumiBlockRangeContainerConverter ( )
virtual

Definition at line 26 of file LumiBlockRangeContainerConverter.cxx.

27 {
28  if (m_reader!=0) { delete m_reader; m_reader=0; }
29  if (m_writer!=0) { delete m_writer; m_writer=0; }
30 }

◆ LumiBlockRangeContainerConverter() [2/2]

LumiBlockRangeContainerConverter::LumiBlockRangeContainerConverter ( const LumiBlockRangeContainerConverter )
delete

Member Function Documentation

◆ CreateXMLFile() [1/3]

void LumiBlockRangeContainerConverter::CreateXMLFile ( const Root::TGoodRunsList grl,
const TString &  xmlfilename = "",
const TString &  prefix = "" 
)

Definition at line 107 of file LumiBlockRangeContainerConverter.cxx.

108 {
110  TString xmlfile = ( xmlfilename.IsNull() ? prefix + grl.GetSuggestedName() + ".xml" : xmlfilename );
111  m_writer->SetFilename( xmlfile.Data() ) ;
113 }

◆ CreateXMLFile() [2/3]

void LumiBlockRangeContainerConverter::CreateXMLFile ( const Root::TGRLCollection grlcollection,
const char *  xmlfilename 
)

Definition at line 98 of file LumiBlockRangeContainerConverter.cxx.

99 {
100  m_writer->SetGRLCollection( grlcollection ) ;
101  m_writer->SetFilename( xmlfilename ) ;
103 }

◆ CreateXMLFile() [3/3]

void LumiBlockRangeContainerConverter::CreateXMLFile ( const xAOD::LumiBlockRangeContainer lbc,
const grlmetadatamap metadata = grlmetadatamap(),
const char *  version = "",
const TString &  xmlfilename = "",
const TString &  prefix = "" 
)

Definition at line 117 of file LumiBlockRangeContainerConverter.cxx.

119 {
121  m_writer->SetGoodRunsList( *pgrl ) ;
122  TString xmlfile = ( xmlfilename.IsNull() ? prefix+pgrl->GetSuggestedName()+".xml" : xmlfilename );
123  m_writer->SetFilename( xmlfile.Data() ) ;
124  m_writer->WriteXMLFile() ;
125  delete pgrl;
126 }

◆ CreateXMLFiles()

void LumiBlockRangeContainerConverter::CreateXMLFiles ( const Root::TGRLCollection grlcollection,
const char *  prefix 
)

Definition at line 130 of file LumiBlockRangeContainerConverter.cxx.

131 {
132  m_writer->SetGRLCollection( grlcollection ) ;
135 }

◆ GetGRLCollection()

Root::TGRLCollection * LumiBlockRangeContainerConverter::GetGRLCollection ( const char *  xmlfile)

Definition at line 228 of file LumiBlockRangeContainerConverter.cxx.

229 {
230  m_reader->SetXMLFile( xmlfile );
231  (void) m_reader->Interpret();
233 }

◆ GetGRLCollectionFromString()

Root::TGRLCollection * LumiBlockRangeContainerConverter::GetGRLCollectionFromString ( const TString &  xmlstring)

Definition at line 237 of file LumiBlockRangeContainerConverter.cxx.

238 {
239  m_reader->SetXMLString( xmlstring );
240  (void) m_reader->Interpret();
242 }

◆ GetGRLObject() [1/2]

Root::TGoodRunsList * LumiBlockRangeContainerConverter::GetGRLObject ( const char *  xmlfile)

Definition at line 210 of file LumiBlockRangeContainerConverter.cxx.

211 {
212  m_reader->SetXMLFile( xmlfile );
213  (void) m_reader->Interpret();
215 }

◆ GetGRLObject() [2/2]

Root::TGoodRunsList * LumiBlockRangeContainerConverter::GetGRLObject ( const xAOD::LumiBlockRangeContainer lbc,
const grlmetadatamap metadata = grlmetadatamap(),
const char *  version = "" 
) const

Definition at line 174 of file LumiBlockRangeContainerConverter.cxx.

175 {
177  grl->SetVersion(version);
178  grl->SetMetaData(metadata);
179 
180  if (!lbc.empty()) {
181  Root::TGoodRun goodrun;
182  int prev_runnbr(-1), cur_runnbr(-1), cur_lbstart(-1), cur_lbstop(-1);
183 
184  for (const xAOD::LumiBlockRange* lbr : lbc) {
185  // for( xAOD::LumiBlockRangeContainer::const_iterator it=lbc.begin(); it != lbc.end(); ++it ) {
186  // const LB_IOVRange* iovr = (*it);
187  cur_runnbr = lbr->startRunNumber();
188  cur_lbstart = lbr->startLumiBlockNumber();
189  cur_lbstop = lbr->stopLumiBlockNumber();
190  // store previous run and reset
191  if (prev_runnbr!=cur_runnbr) {
192  if (prev_runnbr>=0) { (*grl)[prev_runnbr]=goodrun; }
193  goodrun.clear();
194  goodrun.SetRunNumber(cur_runnbr);
195  }
196  // store lumiblock range
197  goodrun.push_back( Root::TLumiBlockRange(cur_lbstart,cur_lbstop) ) ;
198  prev_runnbr = cur_runnbr;
199  } // loop over lbs
200  (*grl)[prev_runnbr]=goodrun; // also store last goodrun
201  } // lbc !empty
202 
203 
204  grl->Compress();
205  return grl;
206 }

◆ GetGRLObjectFromString()

Root::TGoodRunsList * LumiBlockRangeContainerConverter::GetGRLObjectFromString ( const TString &  xmlstring)

Definition at line 219 of file LumiBlockRangeContainerConverter.cxx.

220 {
221  m_reader->SetXMLString( xmlstring );
222  (void) m_reader->Interpret();
224 }

◆ GetLumiBlockRangeContainer() [1/3]

xAOD::LumiBlockRangeContainer * LumiBlockRangeContainerConverter::GetLumiBlockRangeContainer ( const char *  xmlfile)

Definition at line 79 of file LumiBlockRangeContainerConverter.cxx.

80 {
81  Root::TGoodRunsList* pgrl = this->GetGRLObject( xmlfile );
83  delete pgrl;
84  return iovc;
85 }

◆ GetLumiBlockRangeContainer() [2/3]

xAOD::LumiBlockRangeContainer * LumiBlockRangeContainerConverter::GetLumiBlockRangeContainer ( const Root::TGoodRunsList grl) const

Definition at line 43 of file LumiBlockRangeContainerConverter.cxx.

44 {
45  // xAOD::LumiBlockRangeContainer* iovc = new xAOD::LumiBlockRangeContainer();
48  piovComplete->setStore( piovCompleteAux );
49 
50  Root::TGoodRun goodrun;
51  std::map<Int_t, Root::TGoodRun>::const_iterator it;
52  std::vector< Root::TLumiBlockRange >::const_iterator itlbr;
53  int RunNumber(-1), LumiBlockStart(-1), LumiBlockEnd(-1);
54 
55  for(it = grl.begin(); it != grl.end(); ++it) {
56  RunNumber = it->first;
57  goodrun = it->second;
58  for(itlbr = goodrun.begin(); itlbr != goodrun.end(); ++itlbr) {
59  LumiBlockStart = itlbr->Begin();
60  LumiBlockEnd = itlbr->End();
62  piovComplete->push_back(iovr);
64  iovr->setStartLumiBlockNumber(LumiBlockStart);
66  iovr->setStopLumiBlockNumber(LumiBlockEnd);
67  iovr->setEventsExpected(0);
68  iovr->setEventsSeen(0);
69  // iovc->push_back(new LB_IOVRange(IOVTime(RunNumber, LumiBlockStart), IOVTime(RunNumber,LumiBlockEnd)));
70  }
71  }
72  // iovc->sort(xAOD::LumiBlockRangeContainer::SortIOVRangeByStart());
73  piovComplete->sort(xAOD::SortLumiBlockRangeByStart());
74  return piovComplete;
75 }

◆ GetLumiBlockRangeContainer() [3/3]

xAOD::LumiBlockRangeContainer * LumiBlockRangeContainerConverter::GetLumiBlockRangeContainer ( const Root::TGoodRunsList grl,
std::map< TString, TString > &  metadata,
TString &  version 
)

Definition at line 34 of file LumiBlockRangeContainerConverter.cxx.

35 {
36  metadata = grl.GetMetaData();
37  version = grl.GetVersion();
38  return this->GetLumiBlockRangeContainer( grl );
39 }

◆ GetLumiBlockRangeContainerFromString()

xAOD::LumiBlockRangeContainer * LumiBlockRangeContainerConverter::GetLumiBlockRangeContainerFromString ( const TString &  xmlstring)

Definition at line 89 of file LumiBlockRangeContainerConverter.cxx.

90 {
91  m_reader->SetXMLString( xmlstring );
92  (void) m_reader->Interpret();
94 }

◆ GetSuggestedName()

const TString LumiBlockRangeContainerConverter::GetSuggestedName ( const xAOD::LumiBlockRangeContainer lbc) const

Definition at line 246 of file LumiBlockRangeContainerConverter.cxx.

247 {
248  if (lbc.empty()) return "grl_empty";
249 
250  Int_t beginrun(-1), endrun(-1), beginlb(-1), endlb(-1);
251 
254 
255  // cur_runnbr = (*i)->startRunNumber();
256  // cur_lbstart = (*i)->startLumiBlockNumber();
257  // cur_lbstop = (*i)->stopLumiBlockNumber();
258 
259  beginrun = (*itb)->startRunNumber();
260  beginlb = (*itb)->startLumiBlockNumber();
261  endrun = (*ite)->stopRunNumber();
262  endlb = (*ite)->stopLumiBlockNumber();
263 
264  return Form("grl_%d.%d-%d.%d",beginrun,beginlb,endrun,endlb);
265 }

◆ GetXMLString() [1/3]

const TString LumiBlockRangeContainerConverter::GetXMLString ( const Root::TGoodRunsList grl)

Definition at line 139 of file LumiBlockRangeContainerConverter.cxx.

140 {
142  return m_writer->GetXMLString() ;
143 }

◆ GetXMLString() [2/3]

const TString LumiBlockRangeContainerConverter::GetXMLString ( const Root::TGRLCollection grlcollection)

Definition at line 147 of file LumiBlockRangeContainerConverter.cxx.

148 {
149  m_writer->SetGRLCollection( grlcollection ) ;
150  return m_writer->GetXMLString() ;
151 }

◆ GetXMLString() [3/3]

const TString LumiBlockRangeContainerConverter::GetXMLString ( const xAOD::LumiBlockRangeContainer lbc,
const grlmetadatamap metadata = grlmetadatamap(),
const char *  version = "" 
)

Definition at line 163 of file LumiBlockRangeContainerConverter.cxx.

164 {
166  m_writer->SetGoodRunsList( *pgrl ) ;
167  TString xmlstring = m_writer->GetXMLString() ;
168  delete pgrl;
169  return xmlstring;
170 }

◆ GetXMLStrings()

const std::vector< TString > LumiBlockRangeContainerConverter::GetXMLStrings ( const Root::TGRLCollection grlcollection)

Definition at line 155 of file LumiBlockRangeContainerConverter.cxx.

156 {
157  m_writer->SetGRLCollection( grlcollection ) ;
158  return m_writer->GetXMLStrings() ;
159 }

◆ operator=()

LumiBlockRangeContainerConverter& LumiBlockRangeContainerConverter::operator= ( const LumiBlockRangeContainerConverter )
delete

Member Data Documentation

◆ m_reader

Root::TGoodRunsListReader* LumiBlockRangeContainerConverter::m_reader
private

Definition at line 71 of file LumiBlockRangeContainerConverter.h.

◆ m_writer

Root::TGoodRunsListWriter* LumiBlockRangeContainerConverter::m_writer
private

Definition at line 72 of file LumiBlockRangeContainerConverter.h.


The documentation for this class was generated from the following files:
Root::TGoodRunsListReader
Definition: TGoodRunsListReader.h:34
xAOD::LumiBlockRange_v1::setStopLumiBlockNumber
void setStopLumiBlockNumber(uint32_t value)
Set the luminosity block of the stop time of the range.
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Root::TGoodRun
Definition: TGoodRun.h:27
LumiBlockRangeContainerConverter::GetLumiBlockRangeContainer
xAOD::LumiBlockRangeContainer * GetLumiBlockRangeContainer(const Root::TGoodRunsList &grl, std::map< TString, TString > &metadata, TString &version)
Definition: LumiBlockRangeContainerConverter.cxx:34
xAOD::SortLumiBlockRangeByStart
Helper functor used to sort xAOD::LumiBlockRangeContainer-s.
Definition: SortLumiBlockRangeByStart.h:29
Root::TGoodRun::SetRunNumber
void SetRunNumber(const Int_t &runnr)
Definition: TGoodRun.h:53
xAOD::LumiBlockRange_v1::setStopRunNumber
void setStopRunNumber(uint32_t value)
Set the run number of the stop time of the range.
xAOD::LumiBlockRangeAuxContainer_v1
Auxiliary container for xAOD::LumiBlockRangeContainer_v1.
Definition: LumiBlockRangeAuxContainer_v1.h:34
skel.it
it
Definition: skel.GENtoEVGEN.py:396
xAOD::LumiBlockRange_v1::setStartRunNumber
void setStartRunNumber(uint32_t value)
Set the run number of the start time of the range.
Root::TGoodRunsListReader::SetXMLString
void SetXMLString(const TString &xmlstring)
Definition: TGoodRunsListReader.h:50
collisions.grl
grl
Definition: collisions.py:25
python.XMLReader.xmlfile
xmlfile
Definition: XMLReader.py:72
LumiBlockRangeContainerConverter::m_reader
Root::TGoodRunsListReader * m_reader
Definition: LumiBlockRangeContainerConverter.h:71
LumiBlockRangeContainerConverter::m_writer
Root::TGoodRunsListWriter * m_writer
Definition: LumiBlockRangeContainerConverter.h:72
xAOD::LumiBlockRangeContainer
LumiBlockRangeContainer_v1 LumiBlockRangeContainer
Declare the latest version of the container.
Definition: LumiBlockRangeContainer.h:17
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
xAOD::LumiBlockRange
LumiBlockRange_v1 LumiBlockRange
Declare the latest version of the class.
Definition: LumiBlockRange.h:16
grl
Definition: ZLumiScripts/grid/grl.py:1
xAOD::LumiBlockRange_v1::setEventsExpected
void setEventsExpected(uint32_t value)
Set the number of expected events in this luminosity block range.
DeMoUpdate.endrun
int endrun
Definition: DeMoUpdate.py:463
Root::TGoodRunsListWriter::WriteXMLFile
Bool_t WriteXMLFile()
Definition: TGoodRunsListWriter.cxx:110
Root::TGoodRunsListWriter::GetXMLString
const TString & GetXMLString()
Definition: TGoodRunsListWriter.cxx:194
xAOD::LumiBlockRangeAuxContainer
LumiBlockRangeAuxContainer_v1 LumiBlockRangeAuxContainer
Declare the latest version of the auxiliary container.
Definition: LumiBlockRangeAuxContainer.h:16
LumiBlockRangeContainerConverter::GetGRLObject
Root::TGoodRunsList * GetGRLObject(const xAOD::LumiBlockRangeContainer &lbc, const grlmetadatamap &metadata=grlmetadatamap(), const char *version="") const
Definition: LumiBlockRangeContainerConverter.cxx:174
Root::TGoodRunsListWriter
Definition: TGoodRunsListWriter.h:38
Root::TGoodRunsListWriter::SetFilename
void SetFilename(const TString &dataCardName)
Definition: TGoodRunsListWriter.h:63
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
Root::TGoodRunsListWriter::SetGRLCollection
void SetGRLCollection(const TGRLCollection &grlvec)
Definition: TGoodRunsListWriter.h:61
xAOD::LumiBlockRange_v1::setEventsSeen
void setEventsSeen(uint32_t value)
Set the number of seen/processed events in this luminosity block range.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DataVector::rbegin
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
Root::TGRLCollection
Definition: TGRLCollection.h:29
EventInfoWrite.RunNumber
RunNumber
Definition: EventInfoWrite.py:50
Root::TGoodRunsListWriter::WriteXMLFiles
Bool_t WriteXMLFiles()
Definition: TGoodRunsListWriter.cxx:81
DataVector::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Standard const_reverse_iterator.
Definition: DataVector.h:846
Root::TGoodRunsListWriter::SetPrefix
void SetPrefix(const TString &prefix)
Definition: TGoodRunsListWriter.h:64
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Root::TGoodRunsList
Definition: TGoodRunsList.h:31
get_generator_info.version
version
Definition: get_generator_info.py:33
DataVector::sort
void sort()
Sort the container.
Root::TGoodRunsListWriter::SetGoodRunsList
void SetGoodRunsList(const TGoodRunsList &goodrunslist)
Definition: TGoodRunsListWriter.h:62
xAOD::LumiBlockRange_v1
Class describing a luminosity block range.
Definition: LumiBlockRange_v1.h:33
Root::TGoodRunsListReader::Interpret
Bool_t Interpret()
Definition: TGoodRunsListReader.cxx:71
Root::TLumiBlockRange
Definition: TLumiBlockRange.h:26
Root::TGoodRunsListWriter::GetXMLStrings
const std::vector< TString > & GetXMLStrings()
Definition: TGoodRunsListWriter.cxx:165
Root::TGoodRunsListReader::GetMergedGRLCollection
const TGRLCollection GetMergedGRLCollection(const Root::BoolOperation &operation=OR) const
Definition: TGoodRunsListReader.cxx:332
xAOD::LumiBlockRange_v1::setStartLumiBlockNumber
void setStartLumiBlockNumber(uint32_t value)
Set the luminosity block of the start time of the range.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
Root::TGoodRunsListReader::GetMergedGoodRunsList
const TGoodRunsList GetMergedGoodRunsList(const Root::BoolOperation &operation=OR) const
Definition: TGoodRunsListReader.cxx:318
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Root::TGoodRunsList::GetSuggestedName
TString GetSuggestedName() const
Definition: TGoodRunsList.cxx:390
Root::TGoodRunsListReader::SetXMLFile
void SetXMLFile(const TString &xmlfile)
Definition: TGoodRunsListReader.h:51