9 #include <boost/python/class.hpp> 
   10 #include <boost/python/copy_const_reference.hpp> 
   12 #include <framework/dataobjects/FileMetaData.h> 
   13 #include <framework/utilities/HTML.h> 
   14 #include <framework/utilities/KeyValuePrinter.h> 
   16 #include <boost/algorithm/string.hpp> 
   18 #include <nlohmann/json.hpp> 
   24 using namespace boost::python;
 
   26 FileMetaData::FileMetaData() :
 
   27   m_lfn(
""), m_nEvents(0), m_experimentLow(0), m_runLow(0), m_eventLow(0),
 
   28   m_experimentHigh(0), m_runHigh(0), m_eventHigh(0), m_date(
""), m_site(
""), m_user(
""), m_release(
""),
 
   29   m_steering(
""), m_isMC(true), m_mcEvents(0)
 
   51   class_<FileMetaData>(
"FileMetaData")
 
   78   if (option && (option == std::string(
"steering"))) {
 
   81   } 
else if (option && (option == std::string(
"json"))) {
 
   85   const bool all = (option && option == std::string(
"all"));
 
  103   std::cout << 
"=== FileMetaData ===\n";
 
  104   std::cout << printer.
string();
 
  109   physicalFileName = 
"";
 
  110   if (input.eof()) 
return false;
 
  113   std::getline(input, line);
 
  114   boost::algorithm::trim(line);
 
  115   if (line.compare(
"<File>") != 0) 
return false;
 
  117   while (!input.eof()) {
 
  118     std::getline(input, line);
 
  119     boost::algorithm::trim(line);
 
  120     if (line.compare(
"</File>") == 0) 
return true;
 
  122     int pos = line.find(
'>') + 1;
 
  123     std::string tag = line.substr(0, pos);
 
  124     std::string value = line.substr(pos, line.rfind(
'<') - pos);
 
  125     if (tag.compare(
"<LFN>") == 0) {
 
  127     } 
else if (tag.compare(
"<PFN>") == 0) {
 
  129     } 
else if (tag.compare(
"<ExperimentLow>") == 0) {
 
  131     } 
else if (tag.compare(
"<RunLow>") == 0) {
 
  133     } 
else if (tag.compare(
"<EventLow>") == 0) {
 
  135     } 
else if (tag.compare(
"<ExperimentHigh>") == 0) {
 
  137     } 
else if (tag.compare(
"<RunHigh>") == 0) {
 
  139     } 
else if (tag.compare(
"<EventHigh>") == 0) {
 
  141     } 
else if (tag.compare(
"<Parents>") == 0) {
 
  142       pos = value.find(
',');
 
  145         value.erase(0, pos + 1);
 
  146         pos = value.find(
',');
 
  157   output << 
"  <File>\n";
 
  159   if (!physicalFileName.empty()) {
 
  160     output << 
"    <PFN>" << 
HTML::escape(physicalFileName) << 
"</PFN>\n";
 
  162   output << 
"    <ExperimentLow>" << 
m_experimentLow << 
"</ExperimentLow>\n";
 
  163   output << 
"    <RunLow>" << 
m_runLow << 
"</RunLow>\n";
 
  164   output << 
"    <EventLow>" << 
m_eventLow << 
"</EventLow>\n";
 
  166   output << 
"    <RunHigh>" << 
m_runHigh << 
"</RunHigh>\n";
 
  167   output << 
"    <EventHigh>" << 
m_eventHigh << 
"</EventHigh>\n";
 
  170     for (
unsigned int parent = 1; parent < 
m_parentLfns.size(); parent++) {
 
  173     output << 
"</Parents>\n";
 
  175   output << 
"  </File>\n";
 
  182   nlohmann::json metadata = {
 
  203   return metadata.dump(2);
 
create human-readable or JSON output for key value pairs.
void put(const std::string &key, const T &value)
Add one key-value pair.
std::string string() const
Return completed string.
std::string escape(const std::string &str)
Convert &, <, > etc.
std::string unescape(const std::string &str)
inverse of escape()
Abstract base class for different kinds of events.