Jpp  16.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
19 namespace JTRIGGER {}
20 namespace JPP { using namespace JTRIGGER; }
21 
22 namespace 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
JDAQHitToTSelector(const JTOT_t tot_min, const JTOT_t tot_max)
Constructor.
friend std::istream & operator>>(std::istream &in, JDAQHitToTSelector &selector)
Read selector from input.
JDAQHitToTSelector()
Default constructor.
JTOT_t getToT() const
Get time-over-threshold.
Definition: JDAQHit.hh:97
friend std::ostream & operator<<(std::ostream &out, const JDAQHitToTSelector &selector)
Write selector to output.
unsigned char JTOT_t
time over threshold [ns]
Definition: JDAQHit.hh:40
Hit data structure.
Definition: JDAQHit.hh:34
Template class for object cloning.
Definition: JClonable.hh:20
JTOOLS::JRange< JTOT_t > range_type
Range of values.
Definition: JRange.hh:38
virtual bool operator()(const JDAQHit &hit) const override
DAQ hit selection.
Auxiliary class to define a range between two values.
Auxiliary class to select DAQ hits based on time-over-treshold value.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42