#include <TGoodRunsListWriter.h>
Definition at line 38 of file TGoodRunsListWriter.h.
◆ TGoodRunsListWriter() [1/2]
| Root::TGoodRunsListWriter::TGoodRunsListWriter |
( |
| ) |
|
◆ TGoodRunsListWriter() [2/2]
| Root::TGoodRunsListWriter::TGoodRunsListWriter |
( |
const TGoodRunsList & | goodrunslist, |
|
|
const TString & | dataCardName ) |
◆ ~TGoodRunsListWriter()
| Root::TGoodRunsListWriter::~TGoodRunsListWriter |
( |
| ) |
|
◆ AddGoodRunsList()
| void Root::TGoodRunsListWriter::AddGoodRunsList |
( |
const TGoodRunsList & | goodrunslist | ) |
|
|
inline |
◆ 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 502 of file TGoodRunsListWriter.cxx.
503{
505
506#ifndef __NOLIBXML__
507
508 int ret;
509 int size;
510 int out_size;
511 int temp;
512 xmlCharEncodingHandlerPtr
handler;
513
514 if (in == 0)
515 return 0;
516
517 handler = xmlFindCharEncodingHandler(encoding);
518
521 return 0;
522 }
523
524 size = (
int) strlen(in) + 1;
525 out_size = size * 2 - 1;
526 out = (
unsigned char *) xmlMalloc((
size_t) out_size);
527
528 if (out != 0) {
529 temp = size - 1;
530 ret =
handler->input(out, &out_size, (
const xmlChar *) in, &temp);
531 if ((ret < 0) || (temp - size + 1)) {
532 if (ret < 0) {
534 } else {
535 m_logger <<
kWARNING <<
"ConvertInput: conversion wasn't successful. Converted: " << temp <<
" octets." <<
GEndl;
536 }
537
538 xmlFree(out);
540 } else {
541 out = (
unsigned char *) xmlRealloc(out, out_size + 1);
543 }
544 } else {
546 }
547
548#else
549
552
553
554#endif
555
557}
void handler(int sig)
signal handler
◆ GetFilename()
| const TString & Root::TGoodRunsListWriter::GetFilename |
( |
| ) |
const |
|
inline |
◆ GetGRLCollection()
| const TGRLCollection & Root::TGoodRunsListWriter::GetGRLCollection |
( |
| ) |
const |
|
inline |
◆ GetMergedGoodRunsList()
◆ GetXMLString()
| const TString & Root::TGoodRunsListWriter::GetXMLString |
( |
| ) |
|
Definition at line 193 of file TGoodRunsListWriter.cxx.
194{
196
200 }
201
202#ifndef __NOLIBXML__
203
207
208
209
210 buf = xmlBufferCreate();
211 if (buf == NULL) {
214 }
215
216
217
218 writer = xmlNewTextWriterMemory(buf, 0);
222 }
223
224
226
227
228
229
230
231 rc = xmlTextWriterEndDocument(
writer);
235 }
236
237 xmlFreeTextWriter(
writer);
239 xmlBufferFree(buf);
240
241#else
242
245
246#endif
247
249}
std::shared_ptr< HepMC3::Writer > writer
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 165 of file TGoodRunsListWriter.cxx.
166{
168
172 }
173
174
176
178 for (
const TGoodRunsList& grl :
m_grlvec) {
181
183 }
184
185
187
189}
const TString & GetXMLString()
std::vector< TString > m_xmlstringVec
◆ reset()
| void Root::TGoodRunsListWriter::reset |
( |
| ) |
|
|
private |
◆ SetCheckGRLInfo()
| void Root::TGoodRunsListWriter::SetCheckGRLInfo |
( |
bool | check = true | ) |
|
|
inline |
◆ SetFilename()
| void Root::TGoodRunsListWriter::SetFilename |
( |
const TString & | dataCardName | ) |
|
|
inline |
◆ SetGoodRunsList()
| void Root::TGoodRunsListWriter::SetGoodRunsList |
( |
const TGoodRunsList & | goodrunslist | ) |
|
|
inline |
◆ SetGRLCollection()
| void Root::TGoodRunsListWriter::SetGRLCollection |
( |
const TGRLCollection & | grlvec | ) |
|
|
inline |
◆ SetIndividuals()
| void Root::TGoodRunsListWriter::SetIndividuals |
( |
bool | indf = true | ) |
|
|
inline |
◆ 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.
◆ SetPrefix()
| void Root::TGoodRunsListWriter::SetPrefix |
( |
const TString & | prefix | ) |
|
|
inline |
◆ 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 436 of file TGoodRunsListWriter.cxx.
439{
440#ifndef __NOLIBXML__
441
443
444 rc = xmlTextWriterStartElement(
writer, BAD_CAST (name));
447 return kFALSE;
448 }
449
450 if ((atr1!=0) && (val1!=0)) {
451 rc = xmlTextWriterWriteAttribute(
writer, BAD_CAST (atr1), BAD_CAST (val1));
454 return kFALSE;
455 }
456 }
457
458 if ((atr2!=0) && (val2!=0)) {
459 rc = xmlTextWriterWriteAttribute(
writer, BAD_CAST (atr2), BAD_CAST (val2));
462 return kFALSE;
463 }
464 }
465
466 if ((value!=0)) {
467 rc = xmlTextWriterWriteString(
writer, BAD_CAST (value));
470 return kFALSE;
471 }
472 }
473
474 rc = xmlTextWriterEndElement(
writer);
477 return kFALSE;
478 }
479
480#else
481
484
485
486#endif
487
488 return kTRUE;
489}
◆ WriteLumiBlockCollection()
Definition at line 391 of file TGoodRunsListWriter.cxx.
392{
393#ifndef __NOLIBXML__
395
396
397 rc = xmlTextWriterStartElement(
writer, BAD_CAST
"LumiBlockCollection");
400 return kFALSE;
401 }
402
403 if (!goodrun.IsEmpty()) {
404
406
407 std::vector<TLumiBlockRange>::const_iterator litr = goodrun.begin();
408 for (; litr!=goodrun.end(); ++litr)
409 if (!litr->IsEmpty()) {
410 if (litr->End()!=2147483647)
411 this->
WriteElement(
writer,
"LBRange",0,
"Start",Form(
"%d",litr->Begin()),
"End",Form(
"%d",litr->End()));
412 else
414 }
415 }
416
417
418 rc = xmlTextWriterEndElement(
writer);
421 return kFALSE;
422 }
423
424#else
425
428
429#endif
430
431 return kTRUE;
432}
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 253 of file TGoodRunsListWriter.cxx.
254{
255#ifndef __NOLIBXML__
256
259
260
261
262 rc = xmlTextWriterStartDocument(
writer, NULL, NULL, NULL);
265 return kFALSE;
266 }
267
268
273 return kFALSE;
274 }
275
276
277
278
279
281 rc = xmlTextWriterWriteComment(
writer, tmp);
284 return kFALSE;
285 }
286 if (tmp != NULL) xmlFree(tmp);
287
288
289
290 rc = xmlTextWriterStartElement(
writer, BAD_CAST
"LumiRangeCollection");
293 return kFALSE;
294 }
295
296
297
298
300
302 } else {
303
305 std::vector< Root::TGoodRunsList >::const_iterator litr =
m_grlvec.begin();
306 for (; litr!=
m_grlvec.end(); ++litr) {
309 }
310 } else {
313 }
314 }
315
316
317 rc = xmlTextWriterEndElement(
writer);
320 return kFALSE;
321 }
322
323#else
324
327
328
329#endif
330
331 return kTRUE;
332}
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()
◆ WriteNamedLumiRange()
| Bool_t Root::TGoodRunsListWriter::WriteNamedLumiRange |
( |
xmlTextWriterPtr | writer | ) |
|
|
private |
Definition at line 336 of file TGoodRunsListWriter.cxx.
337{
340 }
341
342#ifndef __NOLIBXML__
343
345
346 rc = xmlTextWriterStartElement(
writer, BAD_CAST
"NamedLumiRange");
349 return kFALSE;
350 }
351
352
354
356
357 if (
m_grl.GetVersion().Length()>0) {
360
361 if (!
m_grl.GetMetaData().empty()) {
362 std::map<TString,TString>::const_iterator mitr =
m_grl.GetMetaData().begin();
363 for (; mitr!=
m_grl.GetMetaData().
end(); ++mitr)
366
367 std::map<Int_t,Root::TGoodRun>::const_iterator gitr =
m_grl.begin();
368 for (; gitr!=
m_grl.end(); ++gitr)
370
371
372 rc = xmlTextWriterEndElement(
writer);
375 return kFALSE;
376 }
377
378#else
379
382
383
384#endif
385
386 return kTRUE;
387}
Bool_t WriteLumiBlockCollection(xmlTextWriterPtr writer, const TGoodRun &goodrun)
◆ WriteXMLFile()
| Bool_t Root::TGoodRunsListWriter::WriteXMLFile |
( |
| ) |
|
Definition at line 110 of file TGoodRunsListWriter.cxx.
111{
114 return kFALSE;
115 }
117 m_logger <<
kINFO <<
"Output filename not set. Will be generated automatically." <<
GEndl;
118 }
119
120#ifndef __NOLIBXML__
121
125
126
127 writer = xmlNewTextWriterDoc(&doc, 0);
130 return kFALSE;
131 }
132
133
135
136
137
138
139
140 rc = xmlTextWriterEndDocument(
writer);
143 return kFALSE;
144 }
145
146 xmlFreeTextWriter(
writer);
147
149 xmlFreeDoc(doc);
150
152
153#else
154
157
158#endif
159
160 return kTRUE;
161}
◆ WriteXMLFiles()
| Bool_t Root::TGoodRunsListWriter::WriteXMLFiles |
( |
| ) |
|
loop over goodrunslists
set grl to store
Definition at line 81 of file TGoodRunsListWriter.cxx.
82{
85 return kFALSE;
86 }
87
90
92 std::vector< Root::TGoodRunsList >::const_iterator litr =
m_grlvec.begin();
93 for (
int i=0; litr!=
m_grlvec.end(); ++litr, ++
i) {
96
99 }
100
101
104
105 return kTRUE;
106}
◆ m_dataCardName
| TString Root::TGoodRunsListWriter::m_dataCardName |
|
private |
◆ m_grl
◆ m_grlvec
◆ m_individuals
| Bool_t Root::TGoodRunsListWriter::m_individuals |
|
private |
◆ m_logger
◆ m_mergegrls
| Bool_t Root::TGoodRunsListWriter::m_mergegrls |
|
private |
◆ m_prefix
| TString Root::TGoodRunsListWriter::m_prefix |
|
private |
◆ m_xmlstring
| TString Root::TGoodRunsListWriter::m_xmlstring |
|
private |
◆ m_xmlstringVec
| std::vector<TString> Root::TGoodRunsListWriter::m_xmlstringVec |
|
private |
The documentation for this class was generated from the following files: