24 l.SetLineColor(
color);
25 l.DrawLine(ray.first.z(), ray.first.y(),
26 ray.second.z(), ray.second.y());
33 m.SetMarkerColor(color);
34 m.SetMarkerSize(size);
35 m.SetMarkerStyle(style);
36 m.DrawMarker(p.z(), p.y());
43 t.DrawText(p.z(), p.y(), text.c_str());
51 const auto&
c1 =
cs[il];
52 const auto& c2 =
cs[
im];
57 const auto& j1 = rjs(il,im);
58 const auto& j2 = rjs(im,il);
64 ss <<
"(" << il <<
"," << im <<
")";
70 const auto c0 = rg.
centers()[0];
79 for (
int lind=2; lind < rg.
nlayers(); ++lind) {
83 const auto rdir = pdir.cross(ecks);
91 const auto pc = next_center;
92 const double d0 = p0.dot(
pc-c0);
93 const double d1 =
p1.dot(
pc-
c1);
94 if (d0 < 0 or d0 > pm0) {
break; }
95 if (d1 < 0 or d1 > pm1) {
break; }
99 if (1.0-p0.dot(pdir) < 0.001) {
103 else if (1.0-
p1.dot(pdir) < 0.001) {
112 std::vector<Vector> crossings {
118 sort(crossings.begin(), crossings.end(),
120 return rdir.dot(a-
pc) < rdir.dot(
b-
pc);
129 next_center = 0.5*(pa+
pb) + pmag * pdir;
138 for (
const auto& rp : raypairs) {
145 double xmin=-110,
double ymin=-110,
146 double xmax=+110,
double ymax=+110)
148 auto* frame = canvas.DrawFrame(xmin,ymin,xmax,ymax);
149 frame->SetTitle(title.c_str());
156 TCanvas canvas(
"test_raygrid",
"Ray Grid", 500, 500);
157 auto draw_print = [&](
std::string extra=
"") { canvas.Print((fname + extra).c_str(),
"pdf"); };
165 const int nbounds = raypairs.size();
171 draw_frame(canvas, Form(
"LAYER (%d,%d)", (
int)il, (
int)
im));
180 if (
p.z() < 0.0 or
p.z() > 100.0)
continue;
181 if (
p.y() < 0.0 or
p.y() > 100.0)
continue;
199 auto shape = ar.shape();
200 std::stringstream ss;
201 ss <<
"Dimensions: " << shape[0] <<
" " << shape[1] <<
" "<< shape[2];
205 for (
size_t i = 0; i < shape[0]; ++i) {
206 for (
size_t j = 0; j < shape[1]; ++j) {
208 for (
size_t k = 0;
k < shape[2]; ++
k) {
209 line += Form(
"%.1f", ar[i][j][
k]);
222 std::vector<double>
ps;
223 for (
int a=0;
a<2; ++
a) {
224 for (
int b=0;
b<2; ++
b) {
226 info(
"a={} b={} p={}",
a,
b,p);
231 Assert(ps.front() != ps.back());
250 for (
int ind=0; ind<rg.
nlayers(); ++ind) {
251 info(
"{} r1={} r2={} p={}[{}] c={}",
262 draw(fname, rg, raypairs);
void draw_pairs(const ray_pair_vector_t &raypairs)
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
const vector_array2d_t & ray_jumps() const
void msg(const char *fmt,...)
void info(const char *fmt, const Args &...args)
D3Vector< double > Point
A 3D Cartesian point in double precision.
double pitch_location(const coordinate_t &one, const coordinate_t &two, layer_index_t other) const
void dump(std::string msg, const tensor_t &ar)
void draw_ray(const Ray &ray, int color=1)
int main(int argc, char *argv[])
TH1F * draw_frame(TCanvas &canvas, std::string title, double xmin=-110, double ymin=-110, double xmax=+110, double ymax=+110)
const vector_array1d_t & pitch_dirs() const
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
void draw_segments(const Coordinates &rg)
Vector ray_crossing(const coordinate_t &one, const coordinate_t &two) const
const vector_array1d_t & centers() const
const std::vector< double > & pitch_mags() const
void draw_zero_crossing(const Coordinates &rg, layer_index_t il, layer_index_t im)
void draw_text(const Point &p, std::string text)
Vector zero_crossing(layer_index_t one, layer_index_t two) const
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
std::vector< ray_pair_t > ray_pair_vector_t
std::vector< float > Vector
void draw(std::string fname, const Coordinates &rg, const ray_pair_vector_t &raypairs)
void test_012(const Coordinates &rg)
void draw_point(const Point &p, float size=1, int style=20, int color=1)
ray_pair_vector_t make_raypairs(double width=100, double height=100, double pitch_mag=3, double angle=60.0 *M_PI/180.0)
second_as<> second
Type of time stored in seconds, in double precision.
boost::multi_array< double, 3 > tensor_t