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

#include <LumiBlockCollectionConverter.h>

Collaboration diagram for LumiBlockCollectionConverter:

Public Member Functions

 LumiBlockCollectionConverter ()
 
virtual ~LumiBlockCollectionConverter ()
 
 LumiBlockCollectionConverter (const LumiBlockCollectionConverter &)=delete
 
LumiBlockCollectionConverteroperator= (const LumiBlockCollectionConverter &)=delete
 
LumiBlockCollectionGetLumiBlockCollection (const Root::TGoodRunsList &grl, std::map< TString, TString > &metadata, TString &version)
 
LumiBlockCollectionGetLumiBlockCollection (const Root::TGoodRunsList &grl) const
 
LumiBlockCollectionGetLumiBlockCollection (const char *xmlfile)
 
LumiBlockCollectionGetLumiBlockCollectionFromString (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 LumiBlockCollection &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 LumiBlockCollection &lbc, const grlmetadatamap &metadata=grlmetadatamap(), const char *version="")
 
const std::vector< TString > GetXMLStrings (const Root::TGRLCollection &grlcollection)
 
Root::TGoodRunsListGetGRLObject (const LumiBlockCollection &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 LumiBlockCollection &lbc) const
 

Private Attributes

Root::TGoodRunsListReaderm_reader
 
Root::TGoodRunsListWriterm_writer
 

Detailed Description

Definition at line 33 of file LumiBlockCollectionConverter.h.

Constructor & Destructor Documentation

◆ LumiBlockCollectionConverter() [1/2]

LumiBlockCollectionConverter::LumiBlockCollectionConverter ( )

Definition at line 20 of file LumiBlockCollectionConverter.cxx.

23 {
24 }

◆ ~LumiBlockCollectionConverter()

LumiBlockCollectionConverter::~LumiBlockCollectionConverter ( )
virtual

Definition at line 27 of file LumiBlockCollectionConverter.cxx.

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

◆ LumiBlockCollectionConverter() [2/2]

LumiBlockCollectionConverter::LumiBlockCollectionConverter ( const LumiBlockCollectionConverter )
delete

Member Function Documentation

◆ CreateXMLFile() [1/3]

void LumiBlockCollectionConverter::CreateXMLFile ( const LumiBlockCollection lbc,
const grlmetadatamap metadata = grlmetadatamap(),
const char *  version = "",
const TString &  xmlfilename = "",
const TString &  prefix = "" 
)

Definition at line 107 of file LumiBlockCollectionConverter.cxx.

109 {
111  m_writer->SetGoodRunsList( *pgrl ) ;
112  TString xmlfile = ( xmlfilename.IsNull() ? prefix+pgrl->GetSuggestedName()+".xml" : xmlfilename );
113  m_writer->SetFilename( xmlfile.Data() ) ;
114  m_writer->WriteXMLFile() ;
115  delete pgrl;
116 }

◆ CreateXMLFile() [2/3]

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

Definition at line 97 of file LumiBlockCollectionConverter.cxx.

98 {
100  TString xmlfile = ( xmlfilename.IsNull() ? prefix + grl.GetSuggestedName() + ".xml" : xmlfilename );
101  m_writer->SetFilename( xmlfile.Data() ) ;
103 }

◆ CreateXMLFile() [3/3]

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

Definition at line 88 of file LumiBlockCollectionConverter.cxx.

89 {
90  m_writer->SetGRLCollection( grlcollection ) ;
91  m_writer->SetFilename( xmlfilename ) ;
93 }

◆ CreateXMLFiles()

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

Definition at line 120 of file LumiBlockCollectionConverter.cxx.

121 {
122  m_writer->SetGRLCollection( grlcollection ) ;
125 }

◆ GetGRLCollection()

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

Definition at line 217 of file LumiBlockCollectionConverter.cxx.

218 {
219  m_reader->SetXMLFile( xmlfile );
220  (void) m_reader->Interpret();
222 }

◆ GetGRLCollectionFromString()

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

Definition at line 226 of file LumiBlockCollectionConverter.cxx.

227 {
228  m_reader->SetXMLString( xmlstring );
229  (void) m_reader->Interpret();
231 }

◆ GetGRLObject() [1/2]

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

Definition at line 199 of file LumiBlockCollectionConverter.cxx.

200 {
201  m_reader->SetXMLFile( xmlfile );
202  (void) m_reader->Interpret();
204 }

◆ GetGRLObject() [2/2]

Root::TGoodRunsList * LumiBlockCollectionConverter::GetGRLObject ( const LumiBlockCollection lbc,
const grlmetadatamap metadata = grlmetadatamap(),
const char *  version = "" 
) const

Definition at line 164 of file LumiBlockCollectionConverter.cxx.

165 {
167  grl->SetVersion(version);
168  grl->SetMetaData(metadata);
169 
170  if (!lbc.empty()) {
171  Root::TGoodRun goodrun;
172  int prev_runnbr(-1), cur_runnbr(-1), cur_lbstart(-1), cur_lbstop(-1);
173 
174  for( LumiBlockCollection::const_iterator it=lbc.begin(); it != lbc.end(); ++it ) {
175  const LB_IOVRange* iovr = (*it);
176  cur_runnbr = iovr->start().run();
177  cur_lbstart = iovr->start().event();
178  cur_lbstop = iovr->stop().event();
179  // store previous run and reset
180  if (prev_runnbr!=cur_runnbr) {
181  if (prev_runnbr>=0) { (*grl)[prev_runnbr]=goodrun; }
182  goodrun.clear();
183  goodrun.SetRunNumber(cur_runnbr);
184  }
185  // store lumiblock range
186  goodrun.push_back( Root::TLumiBlockRange(cur_lbstart,cur_lbstop) ) ;
187  prev_runnbr = cur_runnbr;
188  } // loop over lbs
189  (*grl)[prev_runnbr]=goodrun; // also store last goodrun
190  } // lbc !empty
191 
192 
193  grl->Compress();
194  return grl;
195 }

◆ GetGRLObjectFromString()

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

Definition at line 208 of file LumiBlockCollectionConverter.cxx.

209 {
210  m_reader->SetXMLString( xmlstring );
211  (void) m_reader->Interpret();
213 }

◆ GetLumiBlockCollection() [1/3]

LumiBlockCollection * LumiBlockCollectionConverter::GetLumiBlockCollection ( const char *  xmlfile)

Definition at line 69 of file LumiBlockCollectionConverter.cxx.

70 {
71  Root::TGoodRunsList* pgrl = this->GetGRLObject( xmlfile );
72  LumiBlockCollection* iovc = this->GetLumiBlockCollection( *pgrl );
73  delete pgrl;
74  return iovc;
75 }

◆ GetLumiBlockCollection() [2/3]

LumiBlockCollection * LumiBlockCollectionConverter::GetLumiBlockCollection ( const Root::TGoodRunsList grl) const

Definition at line 44 of file LumiBlockCollectionConverter.cxx.

45 {
47 
48  Root::TGoodRun goodrun;
49  std::map<Int_t, Root::TGoodRun>::const_iterator it;
50  std::vector< Root::TLumiBlockRange >::const_iterator itlbr;
51  int RunNumber(-1), LumiBlockStart(-1), LumiBlockEnd(-1);
52 
53  for(it = grl.begin(); it != grl.end(); ++it) {
54  RunNumber = it->first;
55  goodrun = it->second;
56  for(itlbr = goodrun.begin(); itlbr != goodrun.end(); ++itlbr) {
57  LumiBlockStart = itlbr->Begin();
58  LumiBlockEnd = itlbr->End();
59  iovc->push_back(new LB_IOVRange(IOVTime(RunNumber, LumiBlockStart), IOVTime(RunNumber,LumiBlockEnd)));
60  }
61  }
63 
64  return iovc;
65 }

◆ GetLumiBlockCollection() [3/3]

LumiBlockCollection * LumiBlockCollectionConverter::GetLumiBlockCollection ( const Root::TGoodRunsList grl,
std::map< TString, TString > &  metadata,
TString &  version 
)

Definition at line 35 of file LumiBlockCollectionConverter.cxx.

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

◆ GetLumiBlockCollectionFromString()

LumiBlockCollection * LumiBlockCollectionConverter::GetLumiBlockCollectionFromString ( const TString &  xmlstring)

Definition at line 79 of file LumiBlockCollectionConverter.cxx.

80 {
81  m_reader->SetXMLString( xmlstring );
82  (void) m_reader->Interpret();
84 }

◆ GetSuggestedName()

const TString LumiBlockCollectionConverter::GetSuggestedName ( const LumiBlockCollection lbc) const

Definition at line 235 of file LumiBlockCollectionConverter.cxx.

236 {
237  if (lbc.empty()) return "grl_empty";
238 
239  Int_t beginrun(-1), endrun(-1), beginlb(-1), endlb(-1);
240 
243 
244  beginrun = (*itb)->start().run();
245  beginlb = (*itb)->start().event();
246  endrun = (*ite)->stop().run();
247  endlb = (*ite)->stop().event();
248 
249  return Form("grl_%d.%d-%d.%d",beginrun,beginlb,endrun,endlb);
250 }

◆ GetXMLString() [1/3]

const TString LumiBlockCollectionConverter::GetXMLString ( const LumiBlockCollection lbc,
const grlmetadatamap metadata = grlmetadatamap(),
const char *  version = "" 
)

Definition at line 153 of file LumiBlockCollectionConverter.cxx.

154 {
156  m_writer->SetGoodRunsList( *pgrl ) ;
157  TString xmlstring = m_writer->GetXMLString() ;
158  delete pgrl;
159  return xmlstring;
160 }

◆ GetXMLString() [2/3]

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

Definition at line 129 of file LumiBlockCollectionConverter.cxx.

130 {
132  return m_writer->GetXMLString() ;
133 }

◆ GetXMLString() [3/3]

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

Definition at line 137 of file LumiBlockCollectionConverter.cxx.

138 {
139  m_writer->SetGRLCollection( grlcollection ) ;
140  return m_writer->GetXMLString() ;
141 }

◆ GetXMLStrings()

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

Definition at line 145 of file LumiBlockCollectionConverter.cxx.

146 {
147  m_writer->SetGRLCollection( grlcollection ) ;
148  return m_writer->GetXMLStrings() ;
149 }

◆ operator=()

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

Member Data Documentation

◆ m_reader

Root::TGoodRunsListReader* LumiBlockCollectionConverter::m_reader
private

Definition at line 70 of file LumiBlockCollectionConverter.h.

◆ m_writer

Root::TGoodRunsListWriter* LumiBlockCollectionConverter::m_writer
private

Definition at line 71 of file LumiBlockCollectionConverter.h.


The documentation for this class was generated from the following files:
Root::TGoodRunsListReader
Definition: TGoodRunsListReader.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Root::TGoodRun
Definition: TGoodRun.h:27
IOVTime::event
uint32_t event() const noexcept
Definition: IOVTime.h:106
Root::TGoodRun::SetRunNumber
void SetRunNumber(const Int_t &runnr)
Definition: TGoodRun.h:53
LumiBlockCollectionConverter::GetLumiBlockCollection
LumiBlockCollection * GetLumiBlockCollection(const Root::TGoodRunsList &grl, std::map< TString, TString > &metadata, TString &version)
Definition: LumiBlockCollectionConverter.cxx:35
IOVRange::start
const IOVTime & start() const
Definition: IOVRange.h:38
LumiBlockCollection
LumiBlockCollection
Definition: LumiBlockTPCnv.cxx:25
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LumiBlockCollection::SortIOVRangeByStart
Definition: LumiBlockCollection.h:42
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
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
IOVRange::stop
const IOVTime & stop() const
Definition: IOVRange.h:39
grl
Definition: ZLumiScripts/grid/grl.py:1
IOVTime
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
Definition: IOVTime.h:33
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
LumiBlockCollectionConverter::m_reader
Root::TGoodRunsListReader * m_reader
Definition: LumiBlockCollectionConverter.h:70
LumiBlockCollectionConverter::GetGRLObject
Root::TGoodRunsList * GetGRLObject(const LumiBlockCollection &lbc, const grlmetadatamap &metadata=grlmetadatamap(), const char *version="") const
Definition: LumiBlockCollectionConverter.cxx:164
LumiBlockCollection
Definition: LumiBlockCollection.h:21
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
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< LB_IOVRange >::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Standard const_reverse_iterator.
Definition: DataVector.h:846
LumiBlockCollectionConverter::m_writer
Root::TGoodRunsListWriter * m_writer
Definition: LumiBlockCollectionConverter.h:71
Root::TGoodRunsListWriter::SetPrefix
void SetPrefix(const TString &prefix)
Definition: TGoodRunsListWriter.h:64
IOVTime::run
uint32_t run() const noexcept
Definition: IOVTime.h:105
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
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
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
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
LB_IOVRange
Definition: LB_IOVRange.h:16
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