#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 501 of file TGoodRunsListWriter.cxx.
502{
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
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
529
530 xmlBufferAdd(inBuf, (
const xmlChar *) in, temp);
531 ret = xmlCharEncInFunc(
handler, outBuf, inBuf);
532
533 if (ret < 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);
542 } else {
544 }
545 }
546 xmlBufferFree(inBuf);
547 xmlBufferFree(outBuf);
548
549#else
550
553
554
555#endif
556
558}
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 192 of file TGoodRunsListWriter.cxx.
193{
195
199 }
200
201#ifndef __NOLIBXML__
202
206
207
208
209 buf = xmlBufferCreate();
210 if (buf == NULL) {
213 }
214
215
216
217 writer = xmlNewTextWriterMemory(buf, 0);
221 }
222
223
225
226
227
228
229
230 rc = xmlTextWriterEndDocument(
writer);
234 }
235
236 xmlFreeTextWriter(
writer);
237 m_xmlstring = (
const char *) xmlBufferContent(buf);
238 xmlBufferFree(buf);
239
240#else
241
244
245#endif
246
248}
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 164 of file TGoodRunsListWriter.cxx.
165{
167
171 }
172
173
175
177 for (
const TGoodRunsList& grl :
m_grlvec) {
180
182 }
183
184
186
188}
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 435 of file TGoodRunsListWriter.cxx.
438{
439#ifndef __NOLIBXML__
440
442
443 rc = xmlTextWriterStartElement(
writer, BAD_CAST (name));
446 return kFALSE;
447 }
448
449 if ((atr1!=0) && (val1!=0)) {
450 rc = xmlTextWriterWriteAttribute(
writer, BAD_CAST (atr1), BAD_CAST (val1));
453 return kFALSE;
454 }
455 }
456
457 if ((atr2!=0) && (val2!=0)) {
458 rc = xmlTextWriterWriteAttribute(
writer, BAD_CAST (atr2), BAD_CAST (val2));
461 return kFALSE;
462 }
463 }
464
465 if ((value!=0)) {
466 rc = xmlTextWriterWriteString(
writer, BAD_CAST (value));
469 return kFALSE;
470 }
471 }
472
473 rc = xmlTextWriterEndElement(
writer);
476 return kFALSE;
477 }
478
479#else
480
483
484
485#endif
486
487 return kTRUE;
488}
◆ WriteLumiBlockCollection()
Definition at line 390 of file TGoodRunsListWriter.cxx.
391{
392#ifndef __NOLIBXML__
394
395
396 rc = xmlTextWriterStartElement(
writer, BAD_CAST
"LumiBlockCollection");
399 return kFALSE;
400 }
401
402 if (!goodrun.IsEmpty()) {
403
405
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
413 }
414 }
415
416
417 rc = xmlTextWriterEndElement(
writer);
420 return kFALSE;
421 }
422
423#else
424
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
258
259
260
261 rc = xmlTextWriterStartDocument(
writer, NULL, NULL, NULL);
264 return kFALSE;
265 }
266
267
272 return kFALSE;
273 }
274
275
276
277
278
280 rc = xmlTextWriterWriteComment(
writer, tmp);
283 return kFALSE;
284 }
285 if (tmp != NULL) xmlFree(tmp);
286
287
288
289 rc = xmlTextWriterStartElement(
writer, BAD_CAST
"LumiRangeCollection");
292 return kFALSE;
293 }
294
295
296
297
299
301 } else {
302
304 std::vector< Root::TGoodRunsList >::const_iterator litr =
m_grlvec.begin();
305 for (; litr!=
m_grlvec.end(); ++litr) {
308 }
309 } else {
312 }
313 }
314
315
316 rc = xmlTextWriterEndElement(
writer);
319 return kFALSE;
320 }
321
322#else
323
326
327
328#endif
329
330 return kTRUE;
331}
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 335 of file TGoodRunsListWriter.cxx.
336{
339 }
340
341#ifndef __NOLIBXML__
342
344
345 rc = xmlTextWriterStartElement(
writer, BAD_CAST
"NamedLumiRange");
348 return kFALSE;
349 }
350
351
353
355
356 if (
m_grl.GetVersion().Length()>0) {
359
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)
365
366 std::map<Int_t,Root::TGoodRun>::const_iterator gitr =
m_grl.begin();
367 for (; gitr!=
m_grl.end(); ++gitr)
369
370
371 rc = xmlTextWriterEndElement(
writer);
374 return kFALSE;
375 }
376
377#else
378
381
382
383#endif
384
385 return kTRUE;
386}
Bool_t WriteLumiBlockCollection(xmlTextWriterPtr writer, const TGoodRun &goodrun)
◆ WriteXMLFile()
| Bool_t Root::TGoodRunsListWriter::WriteXMLFile |
( |
| ) |
|
Definition at line 109 of file TGoodRunsListWriter.cxx.
110{
113 return kFALSE;
114 }
116 m_logger <<
kINFO <<
"Output filename not set. Will be generated automatically." <<
GEndl;
117 }
118
119#ifndef __NOLIBXML__
120
124
125
126 writer = xmlNewTextWriterDoc(&doc, 0);
129 return kFALSE;
130 }
131
132
134
135
136
137
138
139 rc = xmlTextWriterEndDocument(
writer);
142 return kFALSE;
143 }
144
145 xmlFreeTextWriter(
writer);
146
148 xmlFreeDoc(doc);
149
151
152#else
153
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{
84 return kFALSE;
85 }
86
89
91 std::vector< Root::TGoodRunsList >::const_iterator litr =
m_grlvec.begin();
92 for (
int i=0; litr!=
m_grlvec.end(); ++litr, ++
i) {
95
98 }
99
100
103
104 return kTRUE;
105}
◆ 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: