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

#include <TGoodRunsListWriter.h>

Inheritance diagram for Root::TGoodRunsListWriter:
Collaboration diagram for Root::TGoodRunsListWriter:

Public Member Functions

 TGoodRunsListWriter ()
 TGoodRunsListWriter (const TGoodRunsList &goodrunslist, const TString &dataCardName)
 ~TGoodRunsListWriter ()
Bool_t WriteXMLFile ()
Bool_t WriteXMLFiles ()
const TString & GetXMLString ()
const std::vector< TString > & GetXMLStrings ()
const TString & GetFilename () const
const TGoodRunsList GetMergedGoodRunsList (const Root::BoolOperation &operation=OR) const
const TGRLCollectionGetGRLCollection () const
void SetMergeGoodRunsLists (bool merge=true)
void SetCheckGRLInfo (bool check=true)
void SetIndividuals (bool indf=true)
void SetGRLCollection (const TGRLCollection &grlvec)
void SetGoodRunsList (const TGoodRunsList &goodrunslist)
void SetFilename (const TString &dataCardName)
void SetPrefix (const TString &prefix)
void AddGoodRunsList (const TGoodRunsList &goodrunslist)

Private Member Functions

void reset ()
Bool_t WriteLumiRangeCollection (xmlTextWriterPtr writer)
Bool_t WriteNamedLumiRange (xmlTextWriterPtr writer)
Bool_t WriteMetadata (xmlTextWriterPtr writer)
Bool_t WriteLumiBlockCollection (xmlTextWriterPtr writer, const TGoodRun &goodrun)
Bool_t WriteElement (xmlTextWriterPtr writer, const char *name, const char *value=0, const char *atr1=0, const char *val1=0, const char *atr2=0, const char *val2=0)
xmlCharConvertInput (const char *in, const char *encoding)
 ConvertInput: @in: string in a given encoding @encoding: the encoding used.

Private Attributes

TGRLCollection m_grlvec
TGoodRunsList m_grl
std::vector< TString > m_xmlstringVec
TString m_xmlstring
TString m_dataCardName
TString m_prefix
TMsgLogger m_logger
Bool_t m_mergegrls
Bool_t m_individuals

Detailed Description

Definition at line 38 of file TGoodRunsListWriter.h.

Constructor & Destructor Documentation

◆ TGoodRunsListWriter() [1/2]

Root::TGoodRunsListWriter::TGoodRunsListWriter ( )

Definition at line 40 of file TGoodRunsListWriter.cxx.

41 : TObject()
42 , m_logger ( "TGoodRunsListWriter" )
43 , m_mergegrls(false)
44 , m_individuals(false)
45{
46}

◆ TGoodRunsListWriter() [2/2]

Root::TGoodRunsListWriter::TGoodRunsListWriter ( const TGoodRunsList & goodrunslist,
const TString & dataCardName )

Definition at line 49 of file TGoodRunsListWriter.cxx.

50 : TObject()
51 , m_dataCardName( dataCardName )
52 , m_logger ( "TGoodRunsListWriter" )
53 , m_mergegrls(false)
54 , m_individuals(false)
55{
56 m_grlvec.push_back(goodrunslist);
57}

◆ ~TGoodRunsListWriter()

Root::TGoodRunsListWriter::~TGoodRunsListWriter ( )

Definition at line 60 of file TGoodRunsListWriter.cxx.

61{
62 this->reset();
63}

Member Function Documentation

◆ AddGoodRunsList()

void Root::TGoodRunsListWriter::AddGoodRunsList ( const TGoodRunsList & goodrunslist)
inline

Definition at line 65 of file TGoodRunsListWriter.h.

65{ m_grlvec.push_back(goodrunslist); }

◆ ConvertInput()

xmlChar * Root::TGoodRunsListWriter::ConvertInput ( const char * in,
const char * encoding )
private

ConvertInput: @in: string in a given encoding @encoding: the encoding used.

Converts @in into UTF-8 for processing with libxml2 APIs

Returns the converted UTF-8 string, or NULL in case of error.

Definition at line 501 of file TGoodRunsListWriter.cxx.

502{
503 xmlChar* out(0);
504
505#ifndef __NOLIBXML__
506
507 int ret;
508 int size;
509 int out_size;
510 int temp;
511 xmlCharEncodingHandlerPtr handler;
512
513 if (in == 0)
514 return 0;
515
516 handler = xmlFindCharEncodingHandler(encoding);
517
518 if (!handler) {
519 m_logger << kWARNING << "ConvertInput: no encoding handler found for " << (encoding ? encoding : "") << GEndl;
520 return 0;
521 }
522
523 size = (int) strlen(in) + 1;
524 temp = size - 1;
525
526 xmlBufferPtr inBuf = xmlBufferCreateSize(size);
527 xmlBufferPtr outBuf = xmlBufferCreateSize(size * 2);
528 //xmlBufferAdd does not return a value
529 //coverity[CHECKED_RETURN:FALSE]
530 xmlBufferAdd(inBuf, (const xmlChar *) in, temp);
531 ret = xmlCharEncInFunc(handler, outBuf, inBuf);
532
533 if (ret < 0) {
534 m_logger << kWARNING << "ConvertInput: conversion wasn't successful." << GEndl;
535 out = 0;
536 } else {
537 out_size = xmlBufferLength(outBuf);
538 out = (unsigned char *) xmlMalloc((size_t) out_size + 1);
539 if (out != 0) {
540 memcpy(out, xmlBufferContent(outBuf), out_size);
541 out[out_size] = 0;
542 } else {
543 m_logger << kWARNING << "ConvertInput: no mem" << GEndl;
544 }
545 }
546 xmlBufferFree(inBuf);
547 xmlBufferFree(outBuf);
548
549#else
550
551 m_logger << kWARNING << "GoodRunsLists package compiled without libxml2" << GEndl;
552 m_logger << kWARNING << "can not write out GoodRunsList" << GEndl;
553
554
555#endif
556
557 return out;
558}
unsigned char xmlChar
#define GEndl
Definition TMsgLogger.h:147
@ kWARNING
Definition TMsgLogger.h:41
void handler(int sig)
signal handler
Definition rmain.cxx:99

◆ GetFilename()

const TString & Root::TGoodRunsListWriter::GetFilename ( ) const
inline

Definition at line 52 of file TGoodRunsListWriter.h.

52{ return m_dataCardName; }

◆ GetGRLCollection()

const TGRLCollection & Root::TGoodRunsListWriter::GetGRLCollection ( ) const
inline

Definition at line 55 of file TGoodRunsListWriter.h.

55{ return m_grlvec; }

◆ GetMergedGoodRunsList()

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

Definition at line 53 of file TGoodRunsListWriter.h.

54 { return m_grlvec.GetMergedGoodRunsList(operation); }

◆ GetXMLString()

const TString & Root::TGoodRunsListWriter::GetXMLString ( )

Definition at line 192 of file TGoodRunsListWriter.cxx.

193{
194 m_xmlstring="";
195
196 if (m_grlvec.IsEmpty()) {
197 m_logger << kWARNING << "GoodRunsList is empty - nothing to write. Return false." << GEndl;
198 return m_xmlstring;
199 }
200
201#ifndef __NOLIBXML__
202
203 int rc;
205 xmlBufferPtr buf;
206
207 /* Create a new XML buffer, to which the XML document will be
208 * written */
209 buf = xmlBufferCreate();
210 if (buf == NULL) {
211 m_logger << kWARNING << "testXmlwriterMemory: Error creating the xml buffer" << GEndl;
212 return m_xmlstring;
213 }
214
215 /* Create a new XmlWriter for memory, with no compression.
216 * Remark: there is no compression for this kind of xmlTextWriter */
217 writer = xmlNewTextWriterMemory(buf, 0);
218 if (writer == NULL) {
219 m_logger << kWARNING << "testXmlwriterMemory: Error creating the xml writer" << GEndl;
220 return m_xmlstring;
221 }
222
223 /* Write out goodrunslist here */
225
226 /* Here we could close the elements ORDER and EXAMPLE using the
227 * function xmlTextWriterEndElement, but since we do not want to
228 * write any other elements, we simply call xmlTextWriterEndDocument,
229 * which will do all the work. */
230 rc = xmlTextWriterEndDocument(writer);
231 if (rc < 0) {
232 m_logger << kWARNING << "testXmlwriterMemory: Error at xmlTextWriterEndDocument" << GEndl;
233 return m_xmlstring;
234 }
235
236 xmlFreeTextWriter(writer);
237 m_xmlstring = (const char *) xmlBufferContent(buf);
238 xmlBufferFree(buf);
239
240#else
241
242 m_logger << kWARNING << "GoodRunsLists package compiled without libxml2" << GEndl;
243 m_logger << kWARNING << "can not write out GoodRunsList" << GEndl;
244
245#endif
246
247 return m_xmlstring;
248}
std::shared_ptr< HepMC3::Writer > writer
static Double_t rc
xmlTextWriter * xmlTextWriterPtr
Bool_t WriteLumiRangeCollection(xmlTextWriterPtr writer)

◆ GetXMLStrings()

const std::vector< TString > & Root::TGoodRunsListWriter::GetXMLStrings ( )

loop over goodrunslists

set grl to store

Definition at line 164 of file TGoodRunsListWriter.cxx.

165{
166 m_xmlstringVec.clear();
167
168 if (m_grlvec.IsEmpty()) {
169 m_logger << kWARNING << "GoodRunsList is empty - nothing to write. Return false." << GEndl;
170 return m_xmlstringVec;
171 }
172
173 // individual strings
174 m_individuals=true;
175
177 for (const TGoodRunsList& grl : m_grlvec) {
179 m_grl = grl;
180 // get xml string for this goodrunslist
181 m_xmlstringVec.push_back( this->GetXMLString() );
182 }
183
184 // reset back to original values
185 m_individuals=false;
186
187 return m_xmlstringVec;
188}
std::vector< TString > m_xmlstringVec

◆ reset()

void Root::TGoodRunsListWriter::reset ( )
private

Definition at line 67 of file TGoodRunsListWriter.cxx.

68{
69 m_grlvec.Reset();
70 m_grl.clear();
71 m_mergegrls = false;
72 m_individuals = false;
73 m_prefix="";
74 m_xmlstring="";
75 m_xmlstringVec.clear();
76}

◆ SetCheckGRLInfo()

void Root::TGoodRunsListWriter::SetCheckGRLInfo ( bool check = true)
inline

Definition at line 58 of file TGoodRunsListWriter.h.

58{ m_grlvec.SetCheckGRLInfo( check ); }

◆ SetFilename()

void Root::TGoodRunsListWriter::SetFilename ( const TString & dataCardName)
inline

Definition at line 63 of file TGoodRunsListWriter.h.

63{ m_dataCardName=dataCardName; }

◆ SetGoodRunsList()

void Root::TGoodRunsListWriter::SetGoodRunsList ( const TGoodRunsList & goodrunslist)
inline

Definition at line 62 of file TGoodRunsListWriter.h.

62{ reset(); m_grlvec.push_back(goodrunslist); }

◆ SetGRLCollection()

void Root::TGoodRunsListWriter::SetGRLCollection ( const TGRLCollection & grlvec)
inline

Definition at line 61 of file TGoodRunsListWriter.h.

61{ reset(); m_grlvec=grlvec; }

◆ SetIndividuals()

void Root::TGoodRunsListWriter::SetIndividuals ( bool indf = true)
inline

Definition at line 59 of file TGoodRunsListWriter.h.

59{ m_individuals=indf; }

◆ SetMergeGoodRunsLists()

void Root::TGoodRunsListWriter::SetMergeGoodRunsLists ( bool merge = true)
inline

Definition at line 57 of file TGoodRunsListWriter.h.

merge(input_file_pattern, output_file)
Merge many input LHE files into a single output file.
Definition LHE.py:29

◆ SetPrefix()

void Root::TGoodRunsListWriter::SetPrefix ( const TString & prefix)
inline

Definition at line 64 of file TGoodRunsListWriter.h.

◆ WriteElement()

Bool_t Root::TGoodRunsListWriter::WriteElement ( xmlTextWriterPtr writer,
const char * name,
const char * value = 0,
const char * atr1 = 0,
const char * val1 = 0,
const char * atr2 = 0,
const char * val2 = 0 )
private

Definition at line 435 of file TGoodRunsListWriter.cxx.

438{
439#ifndef __NOLIBXML__
440
441 int rc;
442 /* Start an element named 'name' as child of previous element. */
443 rc = xmlTextWriterStartElement(writer, BAD_CAST (name));
444 if (rc < 0) {
445 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterStartElement" << GEndl;
446 return kFALSE;
447 }
448 /* Add an attribute 'atr1' and value 'val1' to element. */
449 if ((atr1!=0) && (val1!=0)) {
450 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (atr1), BAD_CAST (val1));
451 if (rc < 0) {
452 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterWriteAttribute" << GEndl;
453 return kFALSE;
454 }
455 }
456 /* Add an attribute 'atr2' and value 'val2' to element. */
457 if ((atr2!=0) && (val2!=0)) {
458 rc = xmlTextWriterWriteAttribute(writer, BAD_CAST (atr2), BAD_CAST (val2));
459 if (rc < 0) {
460 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterWriteAttribute" << GEndl;
461 return kFALSE;
462 }
463 }
464 /* Add value 'value' to the element */
465 if ((value!=0)) {
466 rc = xmlTextWriterWriteString(writer, BAD_CAST (value));
467 if(rc < 0) {
468 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterWriteString" << GEndl;
469 return kFALSE;
470 }
471 }
472 /* Close the element */
473 rc = xmlTextWriterEndElement(writer);
474 if (rc < 0) {
475 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterEndElement" << GEndl;
476 return kFALSE;
477 }
478
479#else
480
481 m_logger << kWARNING << "GoodRunsLists package compiled without libxml2" << GEndl;
482 m_logger << kWARNING << "can not write out GoodRunsList" << GEndl;
483
484
485#endif
486
487 return kTRUE;
488}

◆ WriteLumiBlockCollection()

Bool_t Root::TGoodRunsListWriter::WriteLumiBlockCollection ( xmlTextWriterPtr writer,
const TGoodRun & goodrun )
private

Definition at line 390 of file TGoodRunsListWriter.cxx.

391{
392#ifndef __NOLIBXML__
393 int rc;
394
395 /* Start an element named "NamedLumiRange" as child of LumiRangeCollection. */
396 rc = xmlTextWriterStartElement(writer, BAD_CAST "LumiBlockCollection");
397 if (rc < 0) {
398 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterStartElement" << GEndl;
399 return kFALSE;
400 }
401
402 if (!goodrun.IsEmpty()) {
403 /* Runnumber */
404 this->WriteElement(writer,"Run",Form("%d",goodrun.GetRunNumber()));
405 /* Start an element named "LBRange" */
406 std::vector<TLumiBlockRange>::const_iterator litr = goodrun.begin();
407 for (; litr!=goodrun.end(); ++litr)
408 if (!litr->IsEmpty()) {
409 if (litr->End()!=2147483647)
410 this->WriteElement(writer,"LBRange",0,"Start",Form("%d",litr->Begin()),"End",Form("%d",litr->End()));
411 else
412 this->WriteElement(writer,"LBRange",0,"Start",Form("%d",litr->Begin()));
413 }
414 }
415
416 /* Close the element named Metadata. */
417 rc = xmlTextWriterEndElement(writer);
418 if (rc < 0) {
419 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterEndElement" << GEndl;
420 return kFALSE;
421 }
422
423#else
424
425 m_logger << kWARNING << "GoodRunsLists package compiled without libxml2" << GEndl;
426 m_logger << kWARNING << "can not write out GoodRunsList" << GEndl;
427
428#endif
429
430 return kTRUE;
431}
Bool_t WriteElement(xmlTextWriterPtr writer, const char *name, const char *value=0, const char *atr1=0, const char *val1=0, const char *atr2=0, const char *val2=0)

◆ WriteLumiRangeCollection()

Bool_t Root::TGoodRunsListWriter::WriteLumiRangeCollection ( xmlTextWriterPtr writer)
private

Definition at line 252 of file TGoodRunsListWriter.cxx.

253{
254#ifndef __NOLIBXML__
255
256 int rc;
257 xmlChar *tmp;
258
259 /* Start the document with the xml default for the version,
260 * default encoding, and the default for the standalone declaration. */
261 rc = xmlTextWriterStartDocument(writer, NULL, NULL/*MY_ENCODING*/, NULL);
262 if (rc < 0) {
263 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterStartDocument" << GEndl;
264 return kFALSE;
265 }
266
267 /* Write DTD section */
268 rc = xmlTextWriterWriteDTD(writer, ConvertInput("LumiRangeCollection",MY_ENCODING), NULL,
269 ConvertInput("http://atlas-runquery.cern.ch/LumiRangeCollection.dtd", MY_ENCODING), NULL);
270 if (rc < 0) {
271 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTestWriterWriteDTD" << GEndl;
272 return kFALSE;
273 }
274
275 /* Write a comment as child of LumiRangeCollection.
276 * Please observe, that the input to the xmlTextWriter functions
277 * HAS to be in UTF-8, even if the output XML is encoded
278 * in iso-8859-1 */
279 tmp = ConvertInput("This document is created by GoodRunsListWriter.", MY_ENCODING);
280 rc = xmlTextWriterWriteComment(writer, tmp);
281 if (rc < 0) {
282 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterWriteComment" << GEndl;
283 return kFALSE;
284 }
285 if (tmp != NULL) xmlFree(tmp);
286
287 /* Start an element named "LumiRangeCollection". Since thist is the first
288 * element, this will be the root element of the document. */
289 rc = xmlTextWriterStartElement(writer, BAD_CAST "LumiRangeCollection");
290 if (rc < 0) {
291 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterStartElement" << GEndl;
292 return kFALSE;
293 }
294
295 /* Write the actual goodrunslist here.
296 * Use m_grl as global grl currently processed
297 */
298 if (m_individuals) {
299 // m_grl has already been set.
301 } else {
302 // m_grl is set here below
303 if (!m_mergegrls) {
304 std::vector< Root::TGoodRunsList >::const_iterator litr = m_grlvec.begin();
305 for (; litr!=m_grlvec.end(); ++litr) {
306 m_grl = (*litr);
308 }
309 } else {
310 m_grl = this->GetMergedGoodRunsList(); // OR merging
312 }
313 }
314
315 /* Close the element */
316 rc = xmlTextWriterEndElement(writer);
317 if (rc < 0) {
318 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterEndElement" << GEndl;
319 return kFALSE;
320 }
321
322#else
323
324 m_logger << kWARNING << "GoodRunsLists package compiled without libxml2" << GEndl;
325 m_logger << kWARNING << "can not write out GoodRunsList" << GEndl;
326
327
328#endif
329
330 return kTRUE;
331}
#define MY_ENCODING
xmlChar * ConvertInput(const char *in, const char *encoding)
ConvertInput: @in: string in a given encoding @encoding: the encoding used.
const TGoodRunsList GetMergedGoodRunsList(const Root::BoolOperation &operation=OR) const
Bool_t WriteNamedLumiRange(xmlTextWriterPtr writer)

◆ WriteMetadata()

Bool_t Root::TGoodRunsListWriter::WriteMetadata ( xmlTextWriterPtr writer)
private

◆ WriteNamedLumiRange()

Bool_t Root::TGoodRunsListWriter::WriteNamedLumiRange ( xmlTextWriterPtr writer)
private

Definition at line 335 of file TGoodRunsListWriter.cxx.

336{
337 if (m_dataCardName.IsNull()) {
338 m_dataCardName = m_prefix + "merged_" + m_grl.GetSuggestedName() + ".xml" ;
339 }
340
341#ifndef __NOLIBXML__
342
343 int rc;
344 /* Start an element named "NamedLumiRange" as child of LumiRangeCollection. */
345 rc = xmlTextWriterStartElement(writer, BAD_CAST "NamedLumiRange");
346 if (rc < 0) {
347 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterStartElement" << GEndl;
348 return kFALSE;
349 }
350
351 /* Compress grl before writing to file */
352 m_grl.Compress(); // safe space, remove duplicates.
353 /* Write an element named "NAME" as child of NamedLumiRange. */
354 this->WriteElement(writer,"Name",m_grl.GetName());
355 /* Write an element named "VERSION" as child of NamedLumiRange. */
356 if (m_grl.GetVersion().Length()>0) {
357 this->WriteElement(writer,"Version",m_grl.GetVersion().Data());
358 } else { m_logger << kINFO << "<Version> written to xml file <" << m_dataCardName << "> is empty." << GEndl; }
359 /* Write Metadata */
360 if (!m_grl.GetMetaData().empty()) {
361 std::map<TString,TString>::const_iterator mitr = m_grl.GetMetaData().begin();
362 for (; mitr!=m_grl.GetMetaData().end(); ++mitr)
363 this->WriteElement(writer,"Metadata",mitr->second.Data(),"Name",mitr->first.Data());
364 } else { m_logger << kINFO << "<Metadata> written to xml file <" << m_dataCardName << "> is empty." << GEndl; }
365 /* loop over goodruns */
366 std::map<Int_t,Root::TGoodRun>::const_iterator gitr = m_grl.begin();
367 for (; gitr!=m_grl.end(); ++gitr)
368 this->WriteLumiBlockCollection(writer,gitr->second);
369
370 /* Close the element named NamedLumiRange. */
371 rc = xmlTextWriterEndElement(writer);
372 if (rc < 0) {
373 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterEndElement" << GEndl;
374 return kFALSE;
375 }
376
377#else
378
379 m_logger << kWARNING << "GoodRunsLists package compiled without libxml2" << GEndl;
380 m_logger << kWARNING << "can not write out GoodRunsList" << GEndl;
381
382
383#endif
384
385 return kTRUE;
386}
Bool_t WriteLumiBlockCollection(xmlTextWriterPtr writer, const TGoodRun &goodrun)
@ kINFO
Definition TMsgLogger.h:40

◆ WriteXMLFile()

Bool_t Root::TGoodRunsListWriter::WriteXMLFile ( )

Definition at line 109 of file TGoodRunsListWriter.cxx.

110{
111 if (m_grlvec.IsEmpty()) {
112 m_logger << kWARNING << "GoodRunsList is empty - nothing to write to <" << m_dataCardName << ">. Return false." << GEndl;
113 return kFALSE;
114 }
115 if (m_dataCardName.IsNull()) {
116 m_logger << kINFO << "Output filename not set. Will be generated automatically." << GEndl;
117 }
118
119#ifndef __NOLIBXML__
120
121 int rc;
123 xmlDocPtr doc;
124
125 /* Create a new XmlWriter for DOM, with no compression. */
126 writer = xmlNewTextWriterDoc(&doc, 0);
127 if (writer == NULL) {
128 m_logger << kWARNING << "testXmlwriterDoc: Error creating the xml writer" << GEndl;
129 return kFALSE;
130 }
131
132 /* Write out goodrunslist here */
134
135 /* Here we could close the elements NamedLumiRange and LumiRangeCollection using the
136 * function xmlTextWriterEndElement, but since we do not want to
137 * write any other elements, we simply call xmlTextWriterEndDocument,
138 * which will do all the work. */
139 rc = xmlTextWriterEndDocument(writer);
140 if (rc < 0) {
141 m_logger << kWARNING << "testXmlwriterDoc: Error at xmlTextWriterEndDocument" << GEndl;
142 return kFALSE;
143 }
144
145 xmlFreeTextWriter(writer);
146 //xmlSaveFileEnc(m_dataCardName.Data(), doc, MY_ENCODING);
147 xmlSaveFormatFile(m_dataCardName.Data(), doc, 1);
148 xmlFreeDoc(doc);
149
150 m_logger << kINFO << "GoodRunsList stored as : " << m_dataCardName << GEndl;
151
152#else
153
154 m_logger << kWARNING << "GoodRunsLists package compiled without libxml2" << GEndl;
155 m_logger << kWARNING << "can not write out GoodRunsList" << GEndl;
156
157#endif
158
159 return kTRUE;
160}

◆ WriteXMLFiles()

Bool_t Root::TGoodRunsListWriter::WriteXMLFiles ( )

loop over goodrunslists

set grl to store

Definition at line 80 of file TGoodRunsListWriter.cxx.

81{
82 if (m_grlvec.IsEmpty()) {
83 m_logger << kWARNING << "GoodRunsList is empty - nothing to write. Return false." << GEndl;
84 return kFALSE;
85 }
86
87 m_individuals=true;
88 TString olddatacardname=m_dataCardName;
89
91 std::vector< Root::TGoodRunsList >::const_iterator litr = m_grlvec.begin();
92 for (int i=0; litr!=m_grlvec.end(); ++litr, ++i) {
94 m_grl = (*litr);
95 // write xml for this goodrunslist
96 m_dataCardName = m_prefix + Form("merged_%d_",i) + litr->GetSuggestedName() + ".xml" ;
97 (void) this->WriteXMLFile();
98 }
99
100 // reset back to original values
101 m_individuals=false;
102 m_dataCardName=olddatacardname;
103
104 return kTRUE;
105}

Member Data Documentation

◆ m_dataCardName

TString Root::TGoodRunsListWriter::m_dataCardName
private

Definition at line 86 of file TGoodRunsListWriter.h.

◆ m_grl

TGoodRunsList Root::TGoodRunsListWriter::m_grl
private

Definition at line 82 of file TGoodRunsListWriter.h.

◆ m_grlvec

TGRLCollection Root::TGoodRunsListWriter::m_grlvec
private

Definition at line 81 of file TGoodRunsListWriter.h.

◆ m_individuals

Bool_t Root::TGoodRunsListWriter::m_individuals
private

Definition at line 92 of file TGoodRunsListWriter.h.

◆ m_logger

TMsgLogger Root::TGoodRunsListWriter::m_logger
private

Definition at line 89 of file TGoodRunsListWriter.h.

◆ m_mergegrls

Bool_t Root::TGoodRunsListWriter::m_mergegrls
private

Definition at line 91 of file TGoodRunsListWriter.h.

◆ m_prefix

TString Root::TGoodRunsListWriter::m_prefix
private

Definition at line 87 of file TGoodRunsListWriter.h.

◆ m_xmlstring

TString Root::TGoodRunsListWriter::m_xmlstring
private

Definition at line 85 of file TGoodRunsListWriter.h.

◆ m_xmlstringVec

std::vector<TString> Root::TGoodRunsListWriter::m_xmlstringVec
private

Definition at line 84 of file TGoodRunsListWriter.h.


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