Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAcoustics/JHit.hh
Go to the documentation of this file.
1 #ifndef __JACOUSTICS__JHIT__
2 #define __JACOUSTICS__JHIT__
3 
4 #include <ostream>
5 
6 #include "JDetector/JLocation.hh"
7 #include "JLang/JManip.hh"
8 
9 #include "JAcoustics/JEmitter.hh"
10 #include "JAcoustics/JCounter.hh"
11 #include "JAcoustics/JEKey.hh"
12 
13 
14 /**
15  * \file
16  *
17  * Acoustic hit.
18  * \author mdejong
19  */
20 namespace JACOUSTICS {}
21 namespace JPP { using namespace JACOUSTICS; }
22 
23 namespace JACOUSTICS {
24 
27 
28  /**
29  * Acoustics hit.
30  */
31  struct JHit :
32  public JEmitter,
33  public JCounter,
34  public JLocation
35  {
36  /**
37  * Default constructor.
38  */
39  JHit()
40  {}
41 
42 
43  /**
44  * Constructor.
45  *
46  * \param emitter emitter
47  * \param counter counter
48  * \param location receiver location
49  * \param toa_s time-of-arrival [s]
50  * \param sigma_s resolution [s]
51  * \param weight weight
52  */
53  JHit(const JEmitter& emitter,
54  const JCounter& counter,
55  const JLocation& location,
56  const double toa_s,
57  const double sigma_s,
58  const double weight) :
59  JEmitter(emitter),
60  JCounter(counter),
61  JLocation(location),
62  toa(toa_s),
63  sigma(sigma_s),
64  weight(weight)
65  {}
66 
67 
68  /**
69  * Get emitter hash key of this hit.
70  *
71  * \return hash key
72  */
73  JEKey getEKey() const
74  {
75  return JEKey(getID(), getCounter());
76  }
77 
78 
79  /**
80  * Get expectation value of time-of-arrival.
81  *
82  * \return time-of-arrival [s]
83  */
84  double getValue() const
85  {
86  return toa;
87  }
88 
89 
90  /**
91  * Get resolution of time-of-arrival.
92  *
93  * \return resulution [s]
94  */
95  double getSigma() const
96  {
97  return sigma;
98  }
99 
100 
101  /**
102  * Get weight.
103  *
104  * \return weight
105  */
106  double getWeight() const
107  {
108  return weight;
109  }
110 
111 
112  /**
113  * Write hit to output stream.
114  *
115  * \param out output stream
116  * \param hit hit
117  * \return output stream
118  */
119  friend inline std::ostream& operator<<(std::ostream& out, const JHit& hit)
120  {
121  using namespace std;
122  using namespace JPP;
123 
124  out << setw(3) << hit.getID() << ' '
125  << setw(3) << hit.getCounter() << ' '
126  << getLabel(hit.getLocation())
127  << FIXED(20,5) << hit.getValue() << ' '
128  << FIXED(9,6) << hit.getSigma() << ' '
129  << FIXED(6,2) << hit.getWeight();
130 
131  return out;
132  }
133 
134 
135  protected:
136  double toa;
137  double sigma;
138  double weight;
139  };
140 }
141 
142 #endif
Acoustic counter.
Acoustic counter.
JHit(const JEmitter &emitter, const JCounter &counter, const JLocation &location, const double toa_s, const double sigma_s, const double weight)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JHit &hit)
Write hit to output stream.
double getWeight() const
Get weight.
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
Definition: JLocation.hh:246
int getCounter() const
Get counter.
JEKey getEKey() const
Get emitter hash key of this hit.
double getValue() const
Get expectation value of time-of-arrival.
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
Acoustic emitter.
Acoustics hit.
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
Acoustic emitter.
Definition: JEmitter.hh:27
Logical location of module.
Definition: JLocation.hh:37
const JLocation & getLocation() const
Get location.
Definition: JLocation.hh:69
int getID() const
Get identifier.
Definition: JObjectID.hh:50
Logical location of module.
I/O manipulators.
Emitter hash key.
then $DIR JKatoomba a $DETECTOR o $WORKDIR katoomba root T $TRIPOD n sigma_s
Emitter key.
Definition: JEKey.hh:32
JHit()
Default constructor.
double getSigma() const
Get resolution of time-of-arrival.