Functions
test_pipegraphwrappers.cxx File Reference
#include "WireCellPgraph/Factory.h"
#include "WireCellPgraph/Graph.h"
#include "WireCellUtil/PluginManager.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellIface/IConfigurable.h"
#include "WireCellIface/IDepoSink.h"
#include "WireCellUtil/Testing.h"
#include "WireCellUtil/Type.h"
#include <iostream>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 17 of file test_pipegraphwrappers.cxx.

18 {
20  pm.add("WireCellPgraph");
21  pm.add("WireCellGen");
22 
23  // User code normally does not see any construction/configuration
24  // related stuff. Don't replicate this in non-test code!
25  {
26  auto obj = Factory::lookup<IConfigurable>("TrackDepos");
27  auto cfg = obj->default_configuration();
28  cfg["tracks"][0]["time"] = 100.0*units::ms;
29  cfg["tracks"][0]["charge"] = 10000;
30  cfg["tracks"][0]["ray"]["tail"]["x"] = 0.0;
31  cfg["tracks"][0]["ray"]["tail"]["y"] = 0.0;
32  cfg["tracks"][0]["ray"]["tail"]["z"] = 0.0;
33  cfg["tracks"][0]["ray"]["head"]["x"] = 1*units::cm;
34  cfg["tracks"][0]["ray"]["head"]["y"] = 1*units::cm;
35  cfg["tracks"][0]["ray"]["head"]["z"] = 1*units::cm;
36  cerr << "TrackDepos cfg:\n" << cfg << endl;
37  obj->configure(cfg);
38  }
39  // DumpDepos needs no config.
40 
41  // Pretend like we are some app with a hard-coded graph structure
42  INode::pointer ds = Factory::lookup<INode>("TrackDepos");
43  INode::pointer dd = Factory::lookup<INode>("DumpDepos");
44 
45 
46  Pgraph::Factory pgwfac;
47 
48  auto dsnode = pgwfac(ds);
49  cerr << "TrackDepos node is type: " << type(dsnode) << endl;
50 
51  auto ddnode = pgwfac(dd);
52  cerr << "DumpDepos node is type: " << type(ddnode) << endl;
53 
55  graph.connect(dsnode, ddnode);
56  graph.execute();
57 
58  return 0;
59 }
def graph(desc, maker=maker)
Definition: apa.py:294
const std::string instance
cfg
Definition: dbjson.py:29
bool connect(Node *tail, Node *head, size_t tpind=0, size_t hpind=0)
Definition: Graph.cxx:21
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
static const double ms
Definition: Units.h:100
static QCString type
Definition: declinfo.cpp:672
static const double cm
Definition: Units.h:76
Plugin * add(const std::string &plugin_name, const std::string &libname="")
Add a plugin. If libname is not given, try to derive it.
QTextStream & endl(QTextStream &s)