event.h
Go to the documentation of this file.
1 struct hit{
2  uint16_t cell, plane;
3  int16_t adc;
4  bool good_tns;
5  int32_t tdc;
6  float tns;
7 };
8 
9 struct cppoint{
10  // The integer parts of the positions.
11  uint16_t cell, plane;
12 
13  // The fractional part of the positions. Half-precision would be sufficient,
14  // but is awkward to implement. Integer representation is also difficult,
15  // since we cannot assume that these are within [-1, 1].
16  float fcell, fplane;
17 };
18 
19 struct track{
20  // integer mm to save a little memory
21  int16_t startx, starty, stopx, stopy;
22 
23  // FD is longer than 32767mm, and shorter than 65535mm, but
24  // let's not cut it too close.
25  int32_t startz, stopz;
26 
27  int32_t time; // mean time in TDC ticks
28  float tns; // time in ns. Copied from a double.
29 
30  std::vector<hit> hits;
31  std::vector<cppoint> traj[2 /* x and y */];
32 };
33 
34 struct vertex{
35  cppoint pos[2 /* x and y */]; // Positions in plane/cell space
36  short posx, posy, posz; // Positions in real space, in integer mm
37  int32_t time; // time in TDC ticks
38  float tns; // time in ns. Copied from a double.
39 };
40 
41 struct noeevent{
42  std::vector<hit> hits;
43  std::vector<track> tracks;
44  std::vector<vertex> vertices;
45  uint32_t nevent, nrun, nsubrun;
46 
47  // The first and last hits physically in the event
48  int32_t mintick = 0x7fffffff, maxtick = 0;
49 
50  // The user-input minimum and maximum, which must be a subset of the
51  // above. These are here so they can be remembered even if the user
52  // navigates to another event and then back to this one.
53  int32_t user_mintick = 0x7fffffff, user_maxtick = 0;
54 
55  // The actual range being displayed right now (or the last time the
56  // event was drawn), which is a subset of the user_ times during an
57  // animation. There is yet another relevant range of times, which
58  // is the range that needs to be drawn. This is some subset of the
59  // current_ times, depending on whether some hits are already on the
60  // screen. Those don't make much sense to store with the event. At the
61  // moment, the current_ times don't need to be stored with the event
62  // either, since they are always reset upon switch to the event, but
63  // it's easier to imagine that one might want to remember them so as
64  // to be able to animate multiple events "simultaneously".
65  //
66  // Also as it stands, current_mintick is always either user_mintick or
67  // current_maxtick, depending on whether the antimation is cumulative
68  // or not.
69  int32_t current_mintick = 0x7fffffff, current_maxtick = 0;
70 
71  bool fdlike = false;
72 
73  void addtrack(const track & t)
74  {
75  tracks.push_back(t);
76  }
77 
78  void addvertex(const vertex & v)
79  {
80  vertices.push_back(v);
81  }
82 
83  void addhit(const hit & h)
84  {
85  hits.push_back(h);
86 
87  // I don't want to use any art services unless it's really necessary, so
88  // autodetect when we are in the FD. This should fail very very rarely
89  // since the FD is noisy.
90  if(!fdlike && (h.cell >= 3 * 32 || h.plane >= 8 * 24 + 22)) fdlike = true;
91 
92  if(h.tdc < mintick) current_mintick = user_mintick = mintick = h.tdc;
93  if(h.tdc > maxtick) current_maxtick = user_maxtick = maxtick = h.tdc;
94  }
95 };
Definition: event.h:34
short posz
Definition: event.h:36
int32_t stopz
Definition: event.h:25
uint32_t nsubrun
Definition: event.h:45
uint16_t plane
Definition: event.h:2
void addhit(const hit &h)
Definition: event.h:83
int32_t tdc
Definition: event.h:5
uint16_t plane
Definition: event.h:11
Definition: event.h:41
uint16_t cell
Definition: event.h:2
Definition: event.h:19
float tns
Definition: event.h:38
float tns
Definition: event.h:6
void addvertex(const vertex &v)
Definition: event.h:78
float fplane
Definition: event.h:16
bool good_tns
Definition: event.h:4
int16_t adc
Definition: event.h:3
std::vector< hit > hits
Definition: event.h:30
Int_t nevent
Definition: macro.C:10
int32_t time
Definition: event.h:27
float tns
Definition: event.h:28
Definition: structs.h:12
float t
Definition: structs.h:17
Definition: event.h:9
std::vector< hit > hits
Definition: event.h:42
void addtrack(const track &t)
Definition: event.h:73
int32_t time
Definition: event.h:37
std::vector< track > tracks
Definition: event.h:43
int16_t stopy
Definition: event.h:21
std::vector< vertex > vertices
Definition: event.h:44