geo.h
Go to the documentation of this file.
1 enum noe_view_t{ kX, kY, kXorY };
2 
3 struct rect{
4  int xmin, ymin;
5  int xsize, ysize;
6  int ymax(){ return ymin + ysize; }
7  int xmax(){ return xmin + xsize; }
8 };
9 
10 // Given the number of pixels used for the vertical extent of a hit in one
11 // plane, return the number of pixels we should use the for the vertical
12 // extent.
13 int pixx_from_pixy(const int y);
14 
15 // Set the variables that tell us where to draw the edges of the detector
16 void setboxes();
17 
18 // Switch from ND to FD
19 void setfd();
20 
21 // Given the number of horizontal pixels per cell, return the size of the
22 // horizontal detector box. This is the number of pixels from the border
23 // to the last non-border pixel.
24 int total_x_pixels(const int pixels_x);
25 
26 // Given the number of vertical pixels per cell, return the size of the
27 // vertical detector box. This is the number of pixels from the border
28 // to the last non-border pixel.
29 int total_y_pixels(const int pixels_y);
30 
31 // Given the number of pixels used for the horizontal extent of a plane in one
32 // view, return the number of pixels we should use for the extent of
33 // scintillator. This is about 0.42 of the input.
34 int scintpix_from_pixx(const int x);
35 
36 // Given the plane and cell, return the top of the screen position in
37 // Cairo coordinates. More precisely, returns half a pixel above the top.
38 int det_to_screen_y(const int plane, const int cell);
39 
40 // Given the plane, returns the left side of the screen position in Cairo
41 // coordinates. More precisely, returns half a pixel to the left of the left
42 // side.
43 int det_to_screen_x(const int plane);
44 
45 // Given a point in fractional cell and plane coordinates, return the coordinates
46 // in pixels. The view is inferred from the plane number.
47 std::pair<int, int> cppoint_to_screen(const cppoint & tp);
48 
49 // Given a screen position, returns the plane number. Any x position within the
50 // boundaries of hits displayed in a plane, including the right and left
51 // pixels, will return the same plane number. In the muon catcher, return the
52 // nearest plane in the view if the screen position is in dead material. If
53 // the screen position is outside the detector boxes to the right or left,
54 // return -1.
55 int screen_to_plane(const noe_view_t view, const int x);
56 
57 // Same as screen_to_plane(), but is happy to return negative numbers and
58 // numbers bigger than the number of planes.
59 int screen_to_plane_unbounded(const noe_view_t view, const int x);
60 
61 // Given a screen position, returns the cell number. If this position is
62 // outside the detector boxes on the right or left, return -1. If this
63 // position is outside the detector boxes to the top or bottom, returns a cell
64 // number as if the detector continued in that direction.
65 int screen_to_cell(const noe_view_t view, const int x, const int y);
66 
67 // Same as screen_to_cell(), but is happy to return negative numbers and
68 // numbers bigger than the number of cells.
69 int screen_to_cell_unbounded(const noe_view_t view, const int x, const int y);
int xmax()
Definition: geo.h:7
int total_y_pixels(const int pixels_y)
Definition: geo.cxx:74
Definition: geo.h:1
int xmin
Definition: geo.h:4
void setboxes()
Definition: geo.cxx:149
int xsize
Definition: geo.h:5
int ymin
Definition: geo.h:4
int det_to_screen_y(const int plane, const int cell)
Definition: geo.cxx:119
std::pair< int, int > cppoint_to_screen(const cppoint &tp)
Definition: geo.cxx:139
int screen_to_plane_unbounded(const noe_view_t view, const int x)
Definition: geo.cxx:182
void setfd()
Definition: geo.cxx:80
int screen_to_cell_unbounded(const noe_view_t view, const int x, const int y)
Definition: geo.cxx:215
Definition: geo.h:3
int scintpix_from_pixx(const int x)
Definition: geo.cxx:61
int ysize
Definition: geo.h:5
int pixx_from_pixy(const int y)
Definition: geo.cxx:51
Definition: geo.h:1
int total_x_pixels(const int pixels_x)
Definition: geo.cxx:67
int screen_to_plane(const noe_view_t view, const int x)
Definition: geo.cxx:207
noe_view_t
Definition: geo.h:1
Definition: geo.h:1
Definition: event.h:9
int screen_to_cell(const noe_view_t view, const int x, const int y)
Definition: geo.cxx:229
int ymax()
Definition: geo.h:6
int det_to_screen_x(const int plane)
Definition: geo.cxx:100