ATLAS Offline Software
Loading...
Searching...
No Matches
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.

20 : m_reader(new Root::TGoodRunsListReader())
21 , m_writer(new Root::TGoodRunsListWriter())
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{
109 m_writer->SetGoodRunsList( grl ) ;
110 TString xmlfile = ( xmlfilename.IsNull() ? prefix + grl.GetSuggestedName() + ".xml" : xmlfilename );
111 m_writer->SetFilename( xmlfile.Data() ) ;
112 m_writer->WriteXMLFile() ;
113}
static std::vector< std::string > xmlfile
Definition iLumiCalc.h:29

◆ 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 ) ;
102 m_writer->WriteXMLFile() ;
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{
120 Root::TGoodRunsList* pgrl = this->GetGRLObject(lbc,metadata,version);
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}
Root::TGoodRunsList * GetGRLObject(const xAOD::LumiBlockRangeContainer &lbc, const grlmetadatamap &metadata=grlmetadatamap(), const char *version="") const
TString GetSuggestedName() const

◆ 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 ) ;
133 m_writer->SetPrefix( prefix ) ;
134 m_writer->WriteXMLFiles() ;
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();
232 return (new Root::TGRLCollection( m_reader->GetMergedGRLCollection() ));
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();
241 return (new Root::TGRLCollection( m_reader->GetMergedGRLCollection() ));
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();
214 return (new Root::TGoodRunsList( m_reader->GetMergedGoodRunsList() ));
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{
176 Root::TGoodRunsList* grl = new Root::TGoodRunsList();
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}
bool empty() const noexcept
Returns true if the collection is empty.
void SetRunNumber(const Int_t &runnr)
Definition TGoodRun.h:43
LumiBlockRange_v1 LumiBlockRange
Declare the latest version of the class.

◆ 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();
223 return (new Root::TGoodRunsList( m_reader->GetMergedGoodRunsList() ));
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}
xAOD::LumiBlockRangeContainer * GetLumiBlockRangeContainer(const Root::TGoodRunsList &grl, std::map< TString, TString > &metadata, TString &version)
LumiBlockRangeContainer_v1 LumiBlockRangeContainer
Declare the latest version of the container.

◆ 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);
63 iovr->setStartRunNumber(RunNumber);
64 iovr->setStartLumiBlockNumber(LumiBlockStart);
65 iovr->setStopRunNumber(RunNumber);
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}
void sort()
Sort the container.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void setStopRunNumber(uint32_t value)
Set the run number of the stop time of the range.
void setEventsSeen(uint32_t value)
Set the number of seen/processed events in this luminosity block range.
void setStartRunNumber(uint32_t value)
Set the run number of the start time of the range.
void setEventsExpected(uint32_t value)
Set the number of expected events in this luminosity block range.
void setStartLumiBlockNumber(uint32_t value)
Set the luminosity block of the start time of the range.
void setStopLumiBlockNumber(uint32_t value)
Set the luminosity block of the stop time of the range.
LumiBlockRangeAuxContainer_v1 LumiBlockRangeAuxContainer
Declare the latest version of the auxiliary container.

◆ 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();
93 return this->GetLumiBlockRangeContainer( m_reader->GetMergedGoodRunsList() );
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}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition DataVector.h:847

◆ GetXMLString() [1/3]

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

Definition at line 139 of file LumiBlockRangeContainerConverter.cxx.

140{
141 m_writer->SetGoodRunsList( grl ) ;
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{
165 Root::TGoodRunsList* pgrl = this->GetGRLObject(lbc,metadata,version);
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: