37 pm.
add(
"WireCellGen");
44 auto wp_cfg = WireCell::Factory::lookup<IConfigurable>(
"WireParams");
45 AssertMsg(wp_cfg,
"Failed to get IConfigurable from default WireParams");
47 auto cfg = wp_cfg->default_configuration();
49 put(
cfg,
"pitch_mm.u", pitch);
50 put(
cfg,
"pitch_mm.v", pitch);
51 put(
cfg,
"pitch_mm.w", pitch);
52 wp_cfg->configure(
cfg);
54 auto wp = WireCell::Factory::lookup<IWireParameters>(
"WireParams");
55 AssertMsg(wp,
"Failed to get IWireParameters from default WireParams");
56 cout <<
"Got WireParams IWireParameters interface @ " << wp <<
endl;
58 cout << tk(
"Configured WireParams") <<
endl;
59 cout << mu(
"Configured WireParams") <<
endl;
61 cout <<
"Wire Parameters:\n" 62 <<
"Bounds: " << wp->bounds() <<
"\n" 63 <<
"Upitch: " << wp->pitchU() <<
"\n" 64 <<
"Vpitch: " << wp->pitchV() <<
"\n" 65 <<
"Wpitch: " << wp->pitchW() <<
"\n" 69 auto wg = WireCell::Factory::lookup<IWireGenerator>(
"WireGenerator");
70 AssertMsg(wg,
"Failed to get IWireGenerator from default WireGenerator");
71 cout <<
"Got WireGenerator IWireGenerator interface @ " << wg <<
endl;
74 bool ok = (*wg)(wp, wires);
78 cout << tk(
"Generated ParamWires") <<
endl;
79 cout << mu(
"Generated ParamWires") <<
endl;
81 int nwires = wires->size();
82 cout <<
"Got " << nwires <<
" wires" <<
endl;
85 cout << tk(
"Made local wire collection") <<
endl;
86 cout << mu(
"Made local wire collection") <<
endl;
88 auto wser = WireCell::Factory::lookup<IWireSummarizer>(
"WireSummarizer");
90 ok = (*wser)(wires,
ws);
94 cout << tk(
"Made wire summary") <<
endl;
95 cout << mu(
"Made wire summary") <<
endl;
98 for (
size_t ind = 0; ind < wires->size(); ++ind) {
99 boundingbox(wires->at(ind)->ray());
103 cout << tk(
"Made bounding box") <<
endl;
104 cout << mu(
"Made bounding box") <<
endl;
106 vector<IWire::pointer> u_wires, v_wires, w_wires;
107 copy_if(wires->begin(), wires->end(), back_inserter(u_wires),
select_u_wires);
108 copy_if(wires->begin(), wires->end(), back_inserter(v_wires),
select_v_wires);
109 copy_if(wires->begin(), wires->end(), back_inserter(w_wires),
select_w_wires);
111 size_t n_wires[3] = {
122 m.SetMarkerStyle(20);
124 double max_width = 5.0;
126 cout << tk(
"Made TCanvas") <<
endl;
127 cout << mu(
"Made TCanvas") <<
endl;
129 TH1F* frame = pdf.
canvas.DrawFrame(bbox.first.z(), bbox.first.y(),
130 bbox.second.z(), bbox.second.y());
131 frame->SetTitle(
"Wires, red=U, blue=V, thicker=increasing index");
132 frame->SetXTitle(
"Z transverse direction");
133 frame->SetYTitle(
"Y transverse direction");
134 for (
auto wit = wires->begin(); wit != wires->end(); ++wit) {
137 Ray wray = wire->ray();
139 int iplane = wire->planeid().index();
140 int index = wire->index();
141 double width = ((index+1)*max_width)/n_wires[iplane];
143 l.SetLineColor(colors[iplane]);
144 l.SetLineWidth(width);
145 l.DrawLine(wray.first.z(), wray.first.y(), wray.second.z(), wray.second.y());
146 Point cent = wire->center();
147 m.SetMarkerColor(colors[iplane]);
148 m.DrawMarker(cent.z(), cent.y());
150 cout << tk(
"Canvas drawn") <<
endl;
151 cout << mu(
"Canvas drawn") <<
endl;
155 cout <<
"Timing summary:\n" << tk.
summary() <<
endl;
156 cout <<
"Memory summary:\n" << mu.
summary() <<
endl;
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
std::shared_ptr< const IWireSummary > pointer
D3Vector< double > Point
A 3D Cartesian point in double precision.
void put(Configuration &cfg, const std::string &dotpath, const T &val)
Put value in configuration at the dotted path.
static PluginManager & instance()
wire_selector select_u_wires
wire_selector select_w_wires
std::shared_ptr< const IWire::vector > output_pointer
wire_selector select_v_wires
std::string summary() const
Return summary up to now.
int main(int argc, char *argv[])
std::string summary() const
Return summary up to now.
Plugin * add(const std::string &plugin_name, const std::string &libname="")
Add a plugin. If libname is not given, try to derive it.
const Ray & bounds() const
Return the ray representing the bounds.
QTextStream & endl(QTextStream &s)