Jpp  16.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Attributes | Friends | List of all members
JACOUSTICS::JEvent Struct Reference

Acoustic event. More...

#include <JEvent.hh>

Inheritance diagram for JACOUSTICS::JEvent:
JACOUSTICS::JCounter std::vector< JTransmission > TObject

Classes

struct  JEvaluator
 Auxiliary class to determine value of acoustic events. More...
 

Public Member Functions

 JEvent ()
 Default constructor. More...
 
template<class T >
 JEvent (const std::string &oid, const int counter, const int id, T __begin, T __end)
 Constructor. More...
 
virtual ~JEvent ()
 Virtual destructor. More...
 
const std::string & getOID () const
 Get detector identifier. More...
 
int getCounter () const
 Get counter. More...
 
int getOverlays () const
 Get overlays. More...
 
int getID () const
 Get identifier. More...
 
void merge (const JEvent &event)
 Merge event. More...
 
void remove (const size_t ns, const double stdev)
 Remove outliers. More...
 
 ClassDef (JEvent, 2)
 
 ClassDefNV (JCounter, 1)
 

Protected Attributes

std::string oid
 
int overlays
 
int id
 
int counter
 

Friends

std::ostream & operator<< (std::ostream &out, const JEvent &event)
 Write event to output stream. More...
 

Detailed Description

Acoustic event.

Definition at line 34 of file JAcoustics/JEvent.hh.

Constructor & Destructor Documentation

JACOUSTICS::JEvent::JEvent ( )
inline

Default constructor.

Definition at line 67 of file JAcoustics/JEvent.hh.

67  :
68  JCounter(),
69  overlays(0),
70  id (-1)
71  {}
JCounter()
Default constructor.
template<class T >
JACOUSTICS::JEvent::JEvent ( const std::string &  oid,
const int  counter,
const int  id,
T  __begin,
T  __end 
)
inline

Constructor.

The transmissions will be sorted to ensure proper functioning of method JEvent::merge and class JEventOverlap.

Parameters
oiddetector identifier
countercounter
ididentifier
__beginbegin of data
__endend of data

Definition at line 86 of file JAcoustics/JEvent.hh.

90  :
92  oid (oid),
93  overlays(0),
94  id (id)
95  {
96  using namespace std;
97 
98  for (T i = __begin; i != __end; ++i) {
99  push_back(*i);
100  }
101 
102  sort(this->begin(), this->end());
103  }
JCounter()
Default constructor.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
virtual JACOUSTICS::JEvent::~JEvent ( )
inlinevirtual

Virtual destructor.

Definition at line 109 of file JAcoustics/JEvent.hh.

110  {}

Member Function Documentation

const std::string& JACOUSTICS::JEvent::getOID ( ) const
inline

Get detector identifier.

Returns
detector identifier.

Definition at line 118 of file JAcoustics/JEvent.hh.

119  {
120  return oid;
121  }
int JACOUSTICS::JEvent::getCounter ( ) const
inline

Get counter.

Returns
counter

Definition at line 129 of file JAcoustics/JEvent.hh.

130  {
131  return counter;
132  }
int JACOUSTICS::JEvent::getOverlays ( ) const
inline

Get overlays.

Returns
overlays

Definition at line 140 of file JAcoustics/JEvent.hh.

141  {
142  return overlays;
143  }
int JACOUSTICS::JEvent::getID ( ) const
inline

Get identifier.

Returns
identifier

Definition at line 151 of file JAcoustics/JEvent.hh.

152  {
153  return id;
154  }
void JACOUSTICS::JEvent::merge ( const JEvent event)
inline

Merge event.

It is assumed that the transmissions in both events are ordered according the default less-than operator.

Parameters
eventevent

Definition at line 165 of file JAcoustics/JEvent.hh.

166  {
167  using namespace std;
168 
169  vector<JTransmission> buffer;
170 
171  const_iterator __hit1 = this ->begin();
172  const_iterator __end1 = this ->end();
173 
174  const_iterator __hit2 = event.begin();
175  const_iterator __end2 = event.end();
176 
177  buffer.resize(this->size() + event.size());
178 
179  iterator out = buffer.begin();
180 
181  while (__hit1 != __end1 && __hit2 != __end2) {
182 
183  if (*__hit1 < *__hit2) {
184 
185  *out = *__hit1;
186  ++__hit1;
187 
188  } else if (*__hit2 < *__hit1) {
189 
190  *out = *__hit2;
191  ++__hit2;
192 
193  } else {
194 
195  *out = *__hit1;
196 
197  ++__hit1;
198  ++__hit2;
199  }
200 
201  ++out;
202  }
203 
204  // append remaining hits from either set
205 
206  out = copy(__hit1, __end1, out);
207  out = copy(__hit2, __end2, out);
208 
209  buffer.resize(distance(buffer.begin(), out));
210 
211  this->swap(buffer);
212 
213  ++overlays;
214  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:139
void JACOUSTICS::JEvent::remove ( const size_t  ns,
const double  stdev 
)
inline

Remove outliers.

First, the transmissions are sorted according to their time-of-emission. The mean and standard deviation of the times of emission is then determined, excluding the first and last possible number of outliers from either side. From the excluded transmissions, the ones with a time-of-emission less than the given number of standard deviations away from the mean are retained.

Parameters
nsnumber of outliers
stdevnumber of standard deviations

Definition at line 229 of file JAcoustics/JEvent.hh.

230  {
231  using namespace std;
232  using namespace JPP;
233 
234  if (ns > 0 && 2*ns < this->size()) {
235 
236  sort(this->begin(), this->end());
237 
238  iterator p = this->begin();
239  reverse_iterator q = this->rbegin();
240 
241  advance(p, ns);
242  advance(q, ns);
243 
244  JQuantile Q;
245 
246  for (const_iterator i = p; i != q.base(); ++i) {
247  Q.put(i->getToE());
248  }
249 
250  const double t1 = Q.getMean() - stdev * Q.getSTDev();
251  const double t2 = Q.getMean() + stdev * Q.getSTDev();
252 
253  for (size_t i = ns; i != 0 && p->getToE() >= t1; --i, --p) {}
254  for (size_t i = ns; i != 0 && q->getToE() <= t2; --i, --q) {}
255 
256  vector<JTransmission> buffer(p, q.base());
257 
258  this->swap(buffer);
259  }
260  }
Q(UTCMax_s-UTCMin_s)-livetime_s
stdev
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
JACOUSTICS::JEvent::ClassDef ( JEvent  ,
 
)
JACOUSTICS::JCounter::ClassDefNV ( JCounter  ,
 
)
inherited

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const JEvent event 
)
friend

Write event to output stream.

Parameters
outoutput stream
eventevent
Returns
output stream

Definition at line 270 of file JAcoustics/JEvent.hh.

271  {
272  using namespace std;
273 
274  out << event.getOID() << endl;
275  out << setw(8) << event.getCounter() << endl;
276  out << setw(2) << event.getOverlays() << endl;
277  out << setw(3) << event.getID() << endl;
278 
279  for (const_iterator i = event.begin(); i != event.end(); ++i) {
280 
281  out << setw(10) << i->getID() << ' '
282  << setw(10) << i->getRunNumber() << ' '
283  << fixed << setw(12) << setprecision(6) << i->getToA() << ' '
284  << fixed << setw(12) << setprecision(6) << i->getToE() << ' '
285  << fixed << setw(8) << setprecision(0) << i->getQ() << endl;
286  }
287 
288  return out;
289  }

Member Data Documentation

std::string JACOUSTICS::JEvent::oid
protected

Definition at line 294 of file JAcoustics/JEvent.hh.

int JACOUSTICS::JEvent::overlays
protected

Definition at line 295 of file JAcoustics/JEvent.hh.

int JACOUSTICS::JEvent::id
protected

Definition at line 296 of file JAcoustics/JEvent.hh.

int JACOUSTICS::JCounter::counter
protectedinherited

Definition at line 54 of file JAcoustics/JCounter.hh.


The documentation for this struct was generated from the following file: