Functions
test_wireparams.cxx File Reference
#include "WireCellGen/WireParams.h"
#include "WireCellUtil/Testing.h"
#include "WireCellUtil/Configuration.h"
#include "TH1F.h"
#include "TArrow.h"
#include "TLine.h"
#include "MultiPdf.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file test_wireparams.cxx.

15 {
16  WireParams wp;
17  auto cfg = wp.default_configuration();
18  cerr << cfg << endl;
19 
20 
21  MultiPdf pdf(argv[0]);
22  TH1F* frame = pdf.canvas.DrawFrame(0,-10, 20,10);
23  frame->SetTitle("Pitch (thick) and wire (thin) red=U, blue=V, +X (-drift) direction into page");
24  frame->SetXTitle("Transverse Z direction");
25  frame->SetYTitle("Transverse Y (W) direction");
26 
27  int colors[3] = {2, 4, 1};
28 
29  const Vector xaxis(1,0,0);
30  const Ray pitch_rays[3] = { wp.pitchU(), wp.pitchV(), wp.pitchW() };
31 
32  for (int ind=0; ind<3; ++ind) {
33  Ray r_pitch = pitch_rays[ind];
34  r_pitch.first.x(0.0);
35  r_pitch.second.x(0.0);
36 
37 
38  const Vector d_pitch = ray_vector(r_pitch).norm();
39  const Vector d_wire = d_pitch.cross(xaxis).norm();
40  const Ray r_wire(r_pitch.second - d_wire,
41  r_pitch.second + d_wire);
42  cout << ind
43  << ": d_pitch=" << d_pitch
44  << " d_wire=" << d_wire
45  << " r_wire=" << r_wire
46  << endl;
47 
48 
49 
50  TArrow* a_pitch = new TArrow(r_pitch.first.z(), r_pitch.first.y(),
51  r_pitch.second.z(), r_pitch.second.y(), 0.01, "|>");
52  a_pitch->SetLineColor(colors[ind]);
53  a_pitch->SetLineWidth(2);
54 
55  TArrow* a_wire = new TArrow(r_wire.first.z(), r_wire.first.y(),
56  r_wire.second.z(), r_wire.second.y(), 0.01);
57  a_wire->SetLineColor(colors[ind]);
58 
59  a_pitch->Draw();
60  a_wire->Draw();
61  }
62 
63  pdf();
64 
65  return 0;
66 
67 }
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
cfg
Definition: dbjson.py:29
const Ray & pitchW() const
Definition: WireParams.cxx:152
D3Vector norm() const
Return a normalized vector in the direction of this vector.
Definition: D3Vector.h:91
const Ray & pitchV() const
Definition: WireParams.cxx:151
const Ray & pitchU() const
Definition: WireParams.cxx:150
std::vector< float > Vector
D3Vector cross(const D3Vector &rhs) const
Return the cross product of this vector and the other.
Definition: D3Vector.h:100
Vector ray_vector(const Ray &ray)
Definition: Point.cxx:67
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
Definition: WireParams.cxx:29
QTextStream & endl(QTextStream &s)