Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JDAQHitToTSelector.hh
Go to the documentation of this file.
1#ifndef __JTRIGGER__JDAQHITTOTSELECTOR__
2#define __JTRIGGER__JDAQHITTOTSELECTOR__
3
4#include <limits>
5#include <istream>
6#include <ostream>
7
9
11
12#include "JTools/JRange.hh"
13
14
15/**
16 * \author mdejong
17 */
18
19namespace JTRIGGER {}
20namespace JPP { using namespace JTRIGGER; }
21
22namespace JTRIGGER {
23
24 using JTOOLS::JRange;
25
26
27 /**
28 * Auxiliary class to select DAQ hits based on time-over-treshold value.
29 */
31 public JClonable<JDAQHitSelector, JDAQHitToTSelector>,
32 public JRange<JDAQHit::JTOT_t>
33 {
36
37
38 /**
39 * Default constructor.
40 */
42 range_type(0, std::numeric_limits<JTOT_t>::max())
43 {}
44
45
46 /**
47 * Constructor.
48 *
49 * \param tot_min minimal time-over-threshold
50 * \param tot_max maximal time-over-threshold
51 */
52 JDAQHitToTSelector(const JTOT_t tot_min, const JTOT_t tot_max) :
53 range_type(tot_min, tot_max)
54 {}
55
56
57 /**
58 * DAQ hit selection.
59 *
60 * \param hit DAQ hit
61 * \return true to select; else false
62 */
63 virtual bool operator()(const JDAQHit& hit) const override
64 {
65 return static_cast<const range_type&>(*this)(hit.getToT());
66 }
67
68
69
70 /**
71 * Read selector from input.
72 *
73 * \param in
74 * \param selector selector
75 * \return reader
76 */
77 friend inline std::istream& operator>>(std::istream& in, JDAQHitToTSelector& selector)
78 {
79 int first, second;
80
81 in >> first;
82 in >> second;
83
84 selector.first = static_cast<char>(first );
85 selector.second = static_cast<char>(second);
86
87 return in;
88 }
89
90
91 /**
92 * Write selector to output.
93 *
94 * \param out writer
95 * \param selector selector
96 * \return writer
97 */
98 friend inline std::ostream& operator<<(std::ostream& out, const JDAQHitToTSelector& selector)
99 {
100 out << static_cast<int>(selector.first);
101 out << " ";
102 out << static_cast<int>(selector.second);
103
104 return out;
105 }
106 };
107}
108
109#endif
Auxiliary class to define a range between two values.
Range of values.
Definition JRange.hh:42
Hit data structure.
Definition JDAQHit.hh:35
unsigned char JTOT_t
time over threshold [ns]
Definition JDAQHit.hh:40
JTOT_t getToT() const
Get time-over-threshold.
Definition JDAQHit.hh:97
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for triggering.
Template class for object cloning.
Definition JClonable.hh:59
Auxiliary class to select DAQ hits based on time-over-treshold value.
friend std::ostream & operator<<(std::ostream &out, const JDAQHitToTSelector &selector)
Write selector to output.
friend std::istream & operator>>(std::istream &in, JDAQHitToTSelector &selector)
Read selector from input.
virtual bool operator()(const JDAQHit &hit) const override
DAQ hit selection.
JDAQHitToTSelector(const JTOT_t tot_min, const JTOT_t tot_max)
Constructor.
JTOOLS::JRange< JTOT_t > range_type
JDAQHitToTSelector()
Default constructor.