Jpp  17.0.0-rc.1
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...
 
 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 31 of file JAcoustics/JEvent.hh.

Constructor & Destructor Documentation

JACOUSTICS::JEvent::JEvent ( )
inline

Default constructor.

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

64  :
65  JCounter(),
66  overlays(0),
67  id (-1)
68  {}
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 83 of file JAcoustics/JEvent.hh.

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

Virtual destructor.

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

107  {}

Member Function Documentation

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

Get detector identifier.

Returns
detector identifier.

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

116  {
117  return oid;
118  }
int JACOUSTICS::JEvent::getCounter ( ) const
inline

Get counter.

Returns
counter

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

127  {
128  return counter;
129  }
int JACOUSTICS::JEvent::getOverlays ( ) const
inline

Get overlays.

Returns
overlays

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

138  {
139  return overlays;
140  }
int JACOUSTICS::JEvent::getID ( ) const
inline

Get identifier.

Returns
identifier

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

149  {
150  return id;
151  }
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 162 of file JAcoustics/JEvent.hh.

163  {
164  using namespace std;
165 
166  vector<JTransmission> buffer;
167 
168  const_iterator __hit1 = this ->begin();
169  const_iterator __end1 = this ->end();
170 
171  const_iterator __hit2 = event.begin();
172  const_iterator __end2 = event.end();
173 
174  buffer.resize(this->size() + event.size());
175 
176  iterator out = buffer.begin();
177 
178  while (__hit1 != __end1 && __hit2 != __end2) {
179 
180  if (*__hit1 < *__hit2) {
181 
182  *out = *__hit1;
183  ++__hit1;
184 
185  } else if (*__hit2 < *__hit1) {
186 
187  *out = *__hit2;
188  ++__hit2;
189 
190  } else {
191 
192  *out = *__hit1;
193 
194  ++__hit1;
195  ++__hit2;
196  }
197 
198  ++out;
199  }
200 
201  // append remaining hits from either set
202 
203  out = copy(__hit1, __end1, out);
204  out = copy(__hit2, __end2, out);
205 
206  buffer.resize(distance(buffer.begin(), out));
207 
208  this->swap(buffer);
209 
210  ++overlays;
211  }
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
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 221 of file JAcoustics/JEvent.hh.

222  {
223  using namespace std;
224 
225  out << event.getOID() << endl;
226  out << setw(8) << event.getCounter() << endl;
227  out << setw(2) << event.getOverlays() << endl;
228  out << setw(3) << event.getID() << endl;
229 
230  for (const_iterator i = event.begin(); i != event.end(); ++i) {
231 
232  out << setw(10) << i->getID() << ' '
233  << setw(10) << i->getRunNumber() << ' '
234  << fixed << setw(12) << setprecision(6) << i->getToA() << ' '
235  << fixed << setw(12) << setprecision(6) << i->getToE() << ' '
236  << fixed << setw(8) << setprecision(0) << i->getQ() << endl;
237  }
238 
239  return out;
240  }

Member Data Documentation

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

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

int JACOUSTICS::JEvent::overlays
protected

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

int JACOUSTICS::JEvent::id
protected

Definition at line 247 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: