Classes | Namespaces | Typedefs | Functions
DataFlowDumper_module.cc File Reference
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Modules/ProvenanceDumper.h"
#include "art/Persistency/Provenance/ProductMetaData.h"
#include "canvas/Persistency/Provenance/ProductID.h"
#include "canvas/Utilities/Exception.h"
#include "fhiclcpp/types/Atom.h"
#include "fhiclcpp/types/Name.h"
#include <algorithm>
#include <fstream>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  art::DataFlow
 
struct  art::DataFlow::Config
 

Namespaces

 art
 Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file.
 

Typedefs

using art::DataFlowDumper = ProvenanceDumper< DataFlow >
 

Functions

void write_id (art::ProductID const pid, std::ostream &os)
 
void write_id (art::Provenance const &p, std::ostream &os)
 
void format_product_node (std::string const &fcn, std::string const &pin, std::ostream &os)
 
void write_product_node (art::Provenance const &p, std::ostream &os, int debug)
 
void write_product_node (art::ProductID const pid, std::ostream &os, int debug)
 
void write_module_id (art::Provenance const &p, std::ostream &os)
 
std::size_t color (std::string const &procname)
 
void write_module_node (art::Provenance const &p, std::string const &colorscheme, std::ostream &os)
 
void write_creator_line (art::Provenance const &p, std::string const &colorscheme, std::ostream &os, int debug)
 
void write_parent_id (art::ProductID const parent, std::ostream &os)
 
void write_parentage_line (art::Provenance const &p, art::ProductID const parent, std::ostream &os, int debug)
 

Function Documentation

std::size_t color ( std::string const &  procname)

Definition at line 154 of file DataFlowDumper_module.cc.

References distance(), febshutoff_auto::end, and it.

Referenced by write_module_node().

155 {
156  static std::vector<std::string> names_seen;
157  auto it = std::find(begin(names_seen), end(names_seen), procname);
158  if (it == end(names_seen)) {
159  names_seen.push_back(procname);
160  return names_seen.size();
161  }
162  return std::distance(begin(names_seen), it) + 1;
163 }
set< int >::iterator it
unsigned distance(const T &t1, const T &t2)
void format_product_node ( std::string const &  fcn,
std::string const &  pin,
std::ostream &  os 
)

Definition at line 101 of file DataFlowDumper_module.cc.

References fcn.

Referenced by write_product_node().

104 {
105  os << " [label = \"" << fcn;
106  if (!pin.empty())
107  os << "/" << pin;
108  os << "\" shape = box];\n";
109 }
TF1 * fcn
Definition: warp_gsimple.C:35
void write_creator_line ( art::Provenance const &  p,
std::string const &  colorscheme,
std::ostream &  os,
int  debug 
)

Definition at line 175 of file DataFlowDumper_module.cc.

References write_id(), write_module_id(), and write_module_node().

Referenced by art::DataFlow::processEventProvenance().

179 {
180  if (debug > 0) {
181  os << "# write_creator_line for provenance: " << &p << '\n';
182  }
183  write_module_id(p, os);
184  write_module_node(p, colorscheme, os);
185  write_module_id(p, os);
186  os << " -> ";
187  write_id(p, os);
188  os << ";\n";
189 }
void write_module_node(art::Provenance const &p, std::string const &colorscheme, std::ostream &os)
const char * p
Definition: xmltok.h:285
void write_module_id(art::Provenance const &p, std::ostream &os)
void write_id(art::ProductID const pid, std::ostream &os)
void write_id ( art::ProductID const  pid,
std::ostream &  os 
)

Definition at line 88 of file DataFlowDumper_module.cc.

Referenced by write_creator_line(), write_id(), and write_product_node().

89 {
90  os << "\"b" << pid << '\"';
91 }
void write_id ( art::Provenance const &  p,
std::ostream &  os 
)

Definition at line 94 of file DataFlowDumper_module.cc.

References art::Provenance::productID(), and write_id().

95 {
96  write_id(p.productID(), os);
97 }
const char * p
Definition: xmltok.h:285
void write_id(art::ProductID const pid, std::ostream &os)
void write_module_id ( art::Provenance const &  p,
std::ostream &  os 
)

Definition at line 148 of file DataFlowDumper_module.cc.

References art::Provenance::moduleLabel(), and art::Provenance::processName().

Referenced by write_creator_line(), and write_parentage_line().

149 {
150  os << '\"' << p.moduleLabel() << '/' << p.processName() << '\"';
151 }
const char * p
Definition: xmltok.h:285
void write_module_node ( art::Provenance const &  p,
std::string const &  colorscheme,
std::ostream &  os 
)

Definition at line 166 of file DataFlowDumper_module.cc.

References color(), and art::Provenance::processName().

Referenced by write_creator_line().

169 {
170  os << " [ colorscheme=" << colorscheme << " color=" << color(p.processName())
171  << " style=filled ];\n";
172 }
const char * p
Definition: xmltok.h:285
std::size_t color(std::string const &procname)
void write_parent_id ( art::ProductID const  parent,
std::ostream &  os 
)

Definition at line 192 of file DataFlowDumper_module.cc.

References file_size_ana::parent.

Referenced by write_parentage_line().

193 {
194  os << 'b' << parent;
195 }
void write_parentage_line ( art::Provenance const &  p,
art::ProductID const  parent,
std::ostream &  os,
int  debug 
)

Definition at line 198 of file DataFlowDumper_module.cc.

References write_module_id(), and write_parent_id().

Referenced by art::DataFlow::processEventProvenance().

202 {
203  if (debug > 0) {
204  os << "# write_parentage_line for provenance: " << &p << " parent "
205  << parent << '\n';
206  }
207  write_parent_id(parent, os);
208  os << " -> ";
209  write_module_id(p, os);
210  os << ";\n";
211 }
const char * p
Definition: xmltok.h:285
void write_module_id(art::Provenance const &p, std::ostream &os)
void write_parent_id(art::ProductID const parent, std::ostream &os)
void write_product_node ( art::Provenance const &  p,
std::ostream &  os,
int  debug 
)

Definition at line 114 of file DataFlowDumper_module.cc.

References format_product_node(), art::Provenance::friendlyClassName(), art::Provenance::productInstanceName(), and write_id().

Referenced by art::DataFlow::processEventProvenance().

115 {
116  if (debug > 0) {
117  os << "# write_product_node for provenance: " << &p << '\n';
118  }
119  write_id(p, os);
120  format_product_node(p.friendlyClassName(), p.productInstanceName(), os);
121 }
const char * p
Definition: xmltok.h:285
void write_id(art::ProductID const pid, std::ostream &os)
void format_product_node(std::string const &fcn, std::string const &pin, std::ostream &os)
void write_product_node ( art::ProductID const  pid,
std::ostream &  os,
int  debug 
)

Definition at line 124 of file DataFlowDumper_module.cc.

References febshutoff_auto::end, srt_file_template::find_if, format_product_node(), art::ProductMetaData::instance(), it, BlessedPlots::pid, msf_helper::plist, and write_id().

125 {
126  if (debug > 0) {
127  os << "# write_product_node for pid: " << pid << '\n';
128  }
129  // Access to the productList is cheap, so not really worth caching.
130  auto const& pmd = art::ProductMetaData::instance();
131  auto const& plist = pmd.productList(); // note this is a map
132  // The mapped_type in the map contains all the information we want,
133  // but we have to do a linear search through the map to find the one
134  // with the right ProductID.
135  auto it = std::find_if(begin(plist), end(plist), [&pid](auto const& keyval) {
136  return keyval.second.productID() == pid;
137  });
138  if (it == plist.end()) {
139  os << "#Missing information for product with id " << pid << '\n';
140  return;
141  }
142  write_id(pid, os);
144  it->second.friendlyClassName(), it->second.productInstanceName(), os);
145 }
set< int >::iterator it
static ProductMetaData const & instance()
void write_id(art::ProductID const pid, std::ostream &os)
void format_product_node(std::string const &fcn, std::string const &pin, std::ostream &os)