Jpp  debug
the software that should make you happy
JParameters.hh
Go to the documentation of this file.
1 #ifndef __JCALIBRATE_JPARAMETERS__
2 #define __JCALIBRATE_JPARAMETERS__
3 
4 #include <istream>
5 #include <ostream>
6 
7 /**
8  * \author acreusot
9  */
10 
11 
12 namespace JCALIBRATE {}
13 namespace JPP { using namespace JCALIBRATE; }
14 
15 
16 namespace JCALIBRATE {
17 
18  /**
19  * Auxiliary class for PMT parameters including threshold
20  */
21  struct JParameters {
22 
23  /**
24  * Write parameters to output stream.
25  *
26  * \param out output stream
27  * \param parameters parameters
28  * \return output stream
29  */
30  friend inline std::ostream& operator<<(std::ostream& out, const JParameters& parameters)
31  {
32  return out << parameters.runId << ' '
33  << parameters.domId << ' '
34  << parameters.pmtId << ' '
35  << parameters.threshold << ' '
36  << parameters.noise << ' '
37  << parameters.signal << ' '
38  << parameters.badChannel;
39  }
40 
41 
42  /**
43  * Read parameters from input stream.
44  *
45  * \param in input stream
46  * \param parameters parameters
47  * \return input stream
48  */
49  friend inline std::istream& operator>>(std::istream& in, JParameters& parameters)
50  {
51  return in >> parameters.runId
52  >> parameters.domId
53  >> parameters.pmtId
54  >> parameters.threshold
55  >> parameters.noise
56  >> parameters.signal
57  >> parameters.badChannel;
58  }
59 
60 
61  /**
62  * Less-than operator.
63  *
64  * \param parameters parameters
65  * \return true if perameters less than given parameters; else false
66  */
67  inline bool operator<(const JParameters& parameters) const
68  {
69  if (domId < parameters.domId) {
70  return true;
71  } else if (domId == parameters.domId) {
72  if (pmtId < parameters.pmtId) {
73  return true;
74  } else if (pmtId == parameters.pmtId) {
75  if (threshold < parameters.threshold) {
76  return true;
77  }
78  }
79  }
80 
81  return false;
82  }
83 
84 
85  /**
86  * Default constructor.
87  */
89  runId(0),
90  domId(0),
91  pmtId(0),
92  threshold(0),
93  noise(0),
94  signal(0),
95  badChannel(false)
96  {}
97 
98 
99  /**
100  * Constructor.
101  *
102  * \param runId run number
103  * \param domId module identifier
104  * \param pmtId PMT number
105  * \param threshold threshold
106  * \param noise noise
107  * \param signal signal
108  * \param badChannel badness of channel
109  */
111  int domId,
112  int pmtId,
113  double threshold,
114  double noise,
115  double signal,
116  bool badChannel) :
117  runId(runId),
118  domId(domId),
119  pmtId(pmtId),
121  noise(noise),
122  signal(signal),
124  {}
125 
126  int runId;
127  int domId;
128  int pmtId;
129  double threshold;
130  double noise;
131  double signal;
133  };
134 }
135 
136 #endif
137 
138 
139 
Auxiliary classes and methods for PMT calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for PMT parameters including threshold.
Definition: JParameters.hh:21
friend std::istream & operator>>(std::istream &in, JParameters &parameters)
Read parameters from input stream.
Definition: JParameters.hh:49
JParameters(int runId, int domId, int pmtId, double threshold, double noise, double signal, bool badChannel)
Constructor.
Definition: JParameters.hh:110
bool operator<(const JParameters &parameters) const
Less-than operator.
Definition: JParameters.hh:67
friend std::ostream & operator<<(std::ostream &out, const JParameters &parameters)
Write parameters to output stream.
Definition: JParameters.hh:30
JParameters()
Default constructor.
Definition: JParameters.hh:88