30 std::string s(
"Could not find the end of the beamline.");
31 throw std::runtime_error(s);
38 return std::fabs(zpos) > be->zabspos();
102 (void)std::find_if(nextElement,
120 for (iter = nextElement; iter!=
m_elements.end(); ++iter) {
121 (*iter)->calibrate(particle);
122 if (particle.isOutOfAperture())
break;
128 std::ostringstream s;
129 s<<
"Calibration particle did not reach end of beamline\n"<<particle<<
'\n';
130 s<<
"Particle stopped at beam element "<<**iter<<
'\n';
131 throw std::runtime_error(s.str());
140 std::string s =
label;
141 std::size_t tsize = 30 -
label.size();
142 if (tsize>0){ s += std::string(tsize,
' ');}
149 (*m_ost)<<
"\n\n--Beamline--\n";
152 (*m_ost)<<
fixLabel(ib->label())<<
" "<<ib->side()<<
" "<<ib->frontFace()<<
" "<<ib->rearFace()<<
'\n';
156 std::shared_ptr< std::stringstream >
m_ost;
164 os<<bl.
str()<<std::endl;
IBeamElement::Container_t m_elements
void swap(Beamline &other)
void calibrate(IParticle &)
Beamline & operator=(Beamline)
void track(IParticle &) const
std::shared_ptr< const IBeamElement > ConstPtr_t
Container_t::iterator Iter_t
List_t::iterator ListIter_t
std::vector< Ptr_t > Container_t
Container_t::const_iterator ConstIter_t
bool operator()(const IBeamElement::ConstPtr_t &be)
ParticleTracker(IParticle &particle)
void operator()(const IBeamElement::ConstPtr_t &ib)
std::shared_ptr< std::stringstream > m_ost
bool operator()(const IBeamElement::ConstPtr_t &be, double zpos)
std::string label(const std::string &format, int i)
IBeamElement::Iter_t findBeamLineEnd(IBeamElement::Container_t &container)
bool isEndMarker(const IBeamElement::ConstPtr_t &p)
std::ostream & operator<<(std::ostream &os, const Beamline &bl)
std::string fixLabel(const std::string &label)