Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

Public Member Functions

 JEvent ()
 Default constructor. More...
 
template<class T >
 JEvent (const int counter, const int id, T __begin, T __end)
 Constructor. More...
 
virtual ~JEvent ()
 Virtual destructor. 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, 1)
 
 ClassDefNV (JCounter, 1)
 

Protected Attributes

int counter
 
int overlays
 
int id
 

Friends

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

Detailed Description

Acoustic event.

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

Constructor & Destructor Documentation

JACOUSTICS::JEvent::JEvent ( )
inline

Default constructor.

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

38  :
39  JCounter(),
40  overlays(0),
41  id (-1)
42  {}
JCounter()
Default constructor.
template<class T >
JACOUSTICS::JEvent::JEvent ( 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
countercounter
ididentifier
__beginbegin of data
__endend of data

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

59  :
61  overlays(0),
62  id (id)
63  {
64  using namespace std;
65 
66  for (T i = __begin; i != __end; ++i) {
67  push_back(*i);
68  }
69 
70  sort(this->begin(), this->end());
71  }
JCounter()
Default constructor.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
virtual JACOUSTICS::JEvent::~JEvent ( )
inlinevirtual

Virtual destructor.

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

78  {}

Member Function Documentation

int JACOUSTICS::JEvent::getCounter ( ) const
inline

Get counter.

Returns
counter

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

87  {
88  return counter;
89  }
int JACOUSTICS::JEvent::getOverlays ( ) const
inline

Get overlays.

Returns
overlays

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

98  {
99  return overlays;
100  }
int JACOUSTICS::JEvent::getID ( ) const
inline

Get identifier.

Returns
identifier

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

109  {
110  return id;
111  }
void JACOUSTICS::JEvent::merge ( const JEvent event)
inline

Merge event.

Parameters
eventevent

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

120  {
121  using namespace std;
122 
123  vector<JTransmission> buffer;
124 
125  const_iterator __hit1 = this ->begin();
126  const_iterator __end1 = this ->end();
127 
128  const_iterator __hit2 = event.begin();
129  const_iterator __end2 = event.end();
130 
131  buffer.resize(this->size() + event.size());
132 
133  iterator out = buffer.begin();
134 
135  while (__hit1 != __end1 && __hit2 != __end2) {
136 
137  if (*__hit1 < *__hit2) {
138 
139  *out = *__hit1;
140  ++__hit1;
141 
142  } else if (*__hit2 < *__hit1) {
143 
144  *out = *__hit2;
145  ++__hit2;
146 
147  } else {
148 
149  *out = *__hit1;
150 
151  ++__hit1;
152  ++__hit2;
153  }
154 
155  ++out;
156  }
157 
158  // append remaining hits from either set
159 
160  out = copy(__hit1, __end1, out);
161  out = copy(__hit2, __end2, out);
162 
163  buffer.resize(distance(buffer.begin(), out));
164 
165  this->swap(buffer);
166 
167  ++overlays;
168  }
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:153
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 178 of file JAcoustics/JEvent.hh.

179  {
180  using namespace std;
181 
182  out << setw(8) << event.getCounter() << endl;
183  out << setw(2) << event.getOverlays() << endl;
184  out << setw(3) << event.getID() << endl;
185 
186  for (const_iterator i = event.begin(); i != event.end(); ++i) {
187 
188  out << setw(10) << i->getID() << ' '
189  << fixed << setw(9) << setprecision(3) << i->getToA() << ' '
190  << fixed << setw(9) << setprecision(3) << i->getToE() << ' '
191  << fixed << setw(6) << setprecision(0) << i->getQ() << endl;
192  }
193 
194  return out;
195  }

Member Data Documentation

int JACOUSTICS::JEvent::counter
protected

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

int JACOUSTICS::JEvent::overlays
protected

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

int JACOUSTICS::JEvent::id
protected

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


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