Public Member Functions | Private Attributes | List of all members
daq2raw::BeamlineEvents Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-09-26/DAQ2RawDigit/testbeam/BeamlineUnpack.h"

Public Member Functions

 BeamlineEvents ()
 
 BeamlineEvents (unsigned int numEvents)
 
 ~BeamlineEvents ()
 
void AddEvent (BeamlineEvent *event)
 
void AddEvents (std::vector< BeamlineEvent * > events)
 
void FilterGoodEvents ()
 
BeamlineEventFindEvent (unsigned int event)
 
BeamlineEventFindEvent (unsigned long long nova_timestamp)
 
unsigned int NumEvents () const
 
std::vector< BeamlineEvent * > GetEvents () const
 
BeamlineEventGetNextEvent ()
 
bool IsNextEvent () const
 

Private Attributes

unsigned int fEventIt
 
std::vector< BeamlineEvent * > fEvents
 
std::map< unsigned long long, BeamlineEvent * > fEvents_TDUIndex
 

Detailed Description

Definition at line 157 of file BeamlineUnpack.h.

Constructor & Destructor Documentation

daq2raw::BeamlineEvents::BeamlineEvents ( )

Definition at line 206 of file BeamlineUnpack.cxx.

206  {
207  fEventIt = -1;
208 }
daq2raw::BeamlineEvents::BeamlineEvents ( unsigned int  numEvents)

Definition at line 211 of file BeamlineUnpack.cxx.

211  {
212  fEventIt = -1;
213  for (size_t eventIt = 0; eventIt < numEvents; ++eventIt)
214  fEvents.emplace_back(new BeamlineEvent(eventIt));
215 }
std::vector< BeamlineEvent * > fEvents
daq2raw::BeamlineEvents::~BeamlineEvents ( )

Definition at line 218 of file BeamlineUnpack.cxx.

218  {
219  for (std::vector<BeamlineEvent*>::iterator eventIt = fEvents.begin();
220  eventIt != fEvents.end(); ++eventIt) {
221  if (*eventIt)
222  delete *eventIt;
223  *eventIt = nullptr;
224  }
225 }
std::vector< BeamlineEvent * > fEvents

Member Function Documentation

void daq2raw::BeamlineEvents::AddEvent ( BeamlineEvent event)

Definition at line 228 of file BeamlineUnpack.cxx.

228  {
229  fEvents.push_back(event);
230  fEvents_TDUIndex[event->GetTDUTime()] = event;
231  return;
232 }
std::map< unsigned long long, BeamlineEvent * > fEvents_TDUIndex
std::vector< BeamlineEvent * > fEvents
void daq2raw::BeamlineEvents::AddEvents ( std::vector< BeamlineEvent * >  events)

Definition at line 235 of file BeamlineUnpack.cxx.

235  {
236  fEvents.insert(fEvents.end(), events.begin(), events.end());
237  return;
238 }
std::vector< BeamlineEvent * > fEvents
void events(int which)
Definition: Cana.C:52
void daq2raw::BeamlineEvents::FilterGoodEvents ( )

Definition at line 241 of file BeamlineUnpack.cxx.

References e.

Referenced by daq2raw::BeamlineRawInputDriver::makeSpill().

241  {
242  fEvents.erase(std::remove_if(fEvents.begin(),
243  fEvents.end(),
244  [](const BeamlineEvent* e) { return !e->GoodEvent(); }),
245  fEvents.end());
246  return;
247 }
std::vector< BeamlineEvent * > fEvents
Float_t e
Definition: plot.C:35
daq2raw::BeamlineEvent * daq2raw::BeamlineEvents::FindEvent ( unsigned int  event)

Definition at line 250 of file BeamlineUnpack.cxx.

References allTimeWatchdog::endl.

Referenced by daq2raw::TestBeamRawInputDriver::loadBeamlineEvent(), daq2raw::TestBeamRawInputDriver::readBeamline(), daq2raw::BeamlineUnpack::UnpackConfig(), daq2raw::BeamlineUnpack::UnpackDigits(), daq2raw::BeamlineUnpack::UnpackTrigger(), and daq2raw::BeamlineUnpack::UnpackWC().

250  {
251  if (eventNum >= fEvents.size())
252  throw cet::exception("BeamlineUnpack")
253  << "Requested event " << eventNum << " does not exist" << std::endl;
254  return fEvents[eventNum];
255 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::vector< BeamlineEvent * > fEvents
daq2raw::BeamlineEvent * daq2raw::BeamlineEvents::FindEvent ( unsigned long long  nova_timestamp)

Definition at line 258 of file BeamlineUnpack.cxx.

References allTimeWatchdog::endl.

258  {
259  if (fEvents_TDUIndex.count(nova_timestamp))
260  return fEvents_TDUIndex[nova_timestamp];
261  else
262  mf::LogWarning("BeamlineEvents::FindEvent")
263  << "Requested event with timestamp " << nova_timestamp << " does not exist" << std::endl;
264  return nullptr;
265 }
std::map< unsigned long long, BeamlineEvent * > fEvents_TDUIndex
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< daq2raw::BeamlineEvent * > daq2raw::BeamlineEvents::GetEvents ( ) const

Definition at line 273 of file BeamlineUnpack.cxx.

273  {
274  return fEvents;
275 }
std::vector< BeamlineEvent * > fEvents
daq2raw::BeamlineEvent * daq2raw::BeamlineEvents::GetNextEvent ( )

Definition at line 278 of file BeamlineUnpack.cxx.

References allTimeWatchdog::endl.

Referenced by daq2raw::BeamlineRawInputDriver::makeEvent().

278  {
279  ++fEventIt;
280  if (fEventIt >= fEvents.size())
281  throw cet::exception("BeamlineUnpack")
282  << "Next requested event (" << fEventIt << ") does not exist." << std::endl;
283  return fEvents.at(fEventIt);
284 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::vector< BeamlineEvent * > fEvents
bool daq2raw::BeamlineEvents::IsNextEvent ( ) const

Definition at line 287 of file BeamlineUnpack.cxx.

Referenced by daq2raw::BeamlineRawInputDriver::readNext().

287  {
288  return fEventIt+1 < fEvents.size();
289 }
std::vector< BeamlineEvent * > fEvents
unsigned int daq2raw::BeamlineEvents::NumEvents ( ) const

Definition at line 268 of file BeamlineUnpack.cxx.

Referenced by daq2raw::BeamlineRawInputDriver::makeSpill(), daq2raw::TestBeamRawInputDriver::readBeamline(), and daq2raw::BeamlineUnpack::UnpackConfig().

268  {
269  return fEvents.size();
270 }
std::vector< BeamlineEvent * > fEvents

Member Data Documentation

unsigned int daq2raw::BeamlineEvents::fEventIt
private

Definition at line 177 of file BeamlineUnpack.h.

std::vector<BeamlineEvent*> daq2raw::BeamlineEvents::fEvents
private

Definition at line 178 of file BeamlineUnpack.h.

std::map<unsigned long long, BeamlineEvent*> daq2raw::BeamlineEvents::fEvents_TDUIndex
private

Definition at line 179 of file BeamlineUnpack.h.


The documentation for this class was generated from the following files: