Public Member Functions | Private Attributes | List of all members
sim::ProtoDUNEbeamsim Class Reference

#include <ProtoDUNEbeamsim.h>

Public Member Functions

 ProtoDUNEbeamsim ()
 
 ~ProtoDUNEbeamsim ()
 
void AddInstrument (ProtoDUNEBeamInstrument newInst)
 
ProtoDUNEBeamInstrument GetInstrument (std::string name) const
 
unsigned short NInstruments () const
 

Private Attributes

std::vector< ProtoDUNEBeamInstrumentfAllInstruments
 

Detailed Description

Definition at line 30 of file ProtoDUNEbeamsim.h.

Constructor & Destructor Documentation

sim::ProtoDUNEbeamsim::ProtoDUNEbeamsim ( )

Definition at line 24 of file ProtoDUNEbeamsim.cxx.

24 {}
sim::ProtoDUNEbeamsim::~ProtoDUNEbeamsim ( )

Definition at line 27 of file ProtoDUNEbeamsim.cxx.

27 { }

Member Function Documentation

void sim::ProtoDUNEbeamsim::AddInstrument ( ProtoDUNEBeamInstrument  newInst)

Definition at line 31 of file ProtoDUNEbeamsim.cxx.

31  {
32 
33  bool alreadyExists = false;
34  for(auto const &inst : fAllInstruments){
35  if(newInst.GetInstrumentName() == inst.GetInstrumentName()){
36  alreadyExists = true;
37  break;
38  }
39  }
40 
41  if(!alreadyExists){
42  fAllInstruments.push_back(newInst);
43  }
44  else{
45  mf::LogError("ProtoDUNEbeamsim") << "Beam Instrument " << newInst.GetInstrumentName() << " already exists." << std::endl;
46  }
47 
48  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< ProtoDUNEBeamInstrument > fAllInstruments
QTextStream & endl(QTextStream &s)
ProtoDUNEBeamInstrument sim::ProtoDUNEbeamsim::GetInstrument ( std::string  name) const

Definition at line 50 of file ProtoDUNEbeamsim.cxx.

50  {
51  ProtoDUNEBeamInstrument temp;
52  bool found = false;
53  for(auto const inst : fAllInstruments){
54  if(name == inst.GetInstrumentName()){
55  temp = inst;
56  found = true;
57  break;
58  }
59  }
60 
61  if(!found){
62  mf::LogWarning("ProtoDUNEbeamsim") << "Beam Instrument " << name << " not found, returning empty object." << std::endl;
63  }
64 
65  return temp;
66  }
static QCString name
Definition: declinfo.cpp:673
std::vector< ProtoDUNEBeamInstrument > fAllInstruments
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
QTextStream & endl(QTextStream &s)
unsigned short sim::ProtoDUNEbeamsim::NInstruments ( ) const
inline

Definition at line 48 of file ProtoDUNEbeamsim.h.

48 {return fAllInstruments.size();};
std::vector< ProtoDUNEBeamInstrument > fAllInstruments

Member Data Documentation

std::vector<ProtoDUNEBeamInstrument> sim::ProtoDUNEbeamsim::fAllInstruments
private

Definition at line 42 of file ProtoDUNEbeamsim.h.


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