Jpp  15.0.1-rc.1-highQE
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 32 of file JAcoustics/JEvent.hh.

Constructor & Destructor Documentation

JACOUSTICS::JEvent::JEvent ( )
inline

Default constructor.

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

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

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

Virtual destructor.

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

108  {}

Member Function Documentation

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

Get detector identifier.

Returns
detector identifier.

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

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

Get counter.

Returns
counter

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

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

Get overlays.

Returns
overlays

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

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

Get identifier.

Returns
identifier

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

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

Merge event.

Parameters
eventevent

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

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

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

Member Data Documentation

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

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

int JACOUSTICS::JEvent::overlays
protected

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

int JACOUSTICS::JEvent::id
protected

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