20#ifndef CLASSIC_TBeamline_HH
21#define CLASSIC_TBeamline_HH
207 for(
typename std::list<T>::const_reverse_iterator op = this->rbegin();
208 op != this->rend(); ++op) {
212 for(
typename std::list<T>::const_iterator op = this->
begin();
213 op != this->
end(); ++op) {
224 for(
typename std::list<T>::const_iterator op = this->
begin();
225 op != this->
end(); ++op) {
228 newObj.setElement(op->getElement()->clone());
247 for(
typename std::list<T>::const_iterator iter = this->
begin();
248 iter != this->
end(); ++iter) {
251 newObj.setElement(iter->getElement()->copyStructure());
264template <
class T>
inline
268 for(
typename std::list<T>::const_iterator iter = this->
begin();
269 iter != this->
end(); ++iter) {
270 iter->getElement()->makeSharable();
275template <
class T>
inline
281template <
class T>
inline
291 for(
typename std::list<T>::const_iterator iter = this->
begin();
292 iter != this->
end(); ++iter) {
293 length += iter->getElement()->getArcLength();
304 for(
typename std::list<T>::const_iterator iter = this->
begin();
305 iter != this->
end(); ++iter) {
306 length += iter->getElement()->getElementLength();
337 typename std::list<T>::const_iterator iter = this->
begin();
339 while(iter != this->
end() && s1 <= toS) {
345 double s0 = (s1 + s2) / 2.0;
346 double arc1 = std::max(s1, fromS) - s0;
347 double arc2 = std::min(s2, toS) - s0;
356 typename std::list<T>::const_reverse_iterator iter = this->rbegin();
358 while(iter != this->rend() && s1 >= toS) {
364 double s0 = (s1 + s2) / 2.0;
365 double arc1 = std::min(s1, fromS) - s0;
366 double arc2 = std::max(s2, toS) - s0;
383 for(
typename std::list<T>::const_iterator iter = this->
begin();
384 iter != this->
end(); ++iter) {
385 transform.
dotBy(iter->getElement()->getTotalTransform());
410template <
class T>
inline
416template <
class T>
inline
418 this->push_back(obj);
422template <
class T>
inline
424 this->push_front(obj);
427template <
class T>
inline
432template <
class T>
inline
437template <
class T>
inline
442template <
class T>
inline
447template <
class T>
inline
452template <
class T>
inline
460 for(
typename std::list<T>::const_iterator iter = this->
begin();
461 iter != this->
end(); ++iter) {
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
virtual void visitBeamline(const Beamline &)=0
Apply the algorithm to a beam line.
virtual const std::string & getName() const
Get element name.
virtual double getArcLength() const
Get arc length.
ElementBase(const std::string &name)
Constructor with given name.
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
bool isSharable() const
Test if the element can be shared.
Displacement and rotation in space.
const Euclid3D & dotBy(const Euclid3D &rhs)
Dot product with assign.
Beamline(const std::string &name)
Constructor with given name.
Implements the composite geometry of a beam line.
bool getRelativeFlag() const
TBeamline(const TBeamline< T > &right)
Quaternion getInitialDirection() const
virtual Euclid3D getEntranceFrame() const
Get transform.
void setRelativeFlag(bool flag)
virtual double getArcLength() const
Get arc length.
virtual TBeamline< T > * clone() const
Make clone.
virtual double getEntrance() const
Get entrance position.
size_t size() const
Get the number of elements in the TBeamline.
virtual const BeamlineGeometry & getGeometry() const
Get geometry.
virtual TBeamline< T > * copyStructure()
Make structure copy.
virtual Euclid3D getTotalTransform() const
Get transform.
virtual Euclid3D getExitFrame() const
Get transform.
virtual void prepend(const T &)
Prepend a T object.
virtual Euclid3D getTransform(double s) const
Get transform.
virtual void makeSharable()
Set sharable flag.
virtual double getOrigin() const
Get origin position.
TBeamline()
Default constructor.
void setOrigin3D(const Vector_t &ori)
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
void setInitialDirection(const Quaternion &rot)
virtual void append(const T &)
Append a T object.
virtual ElementType getType() const
Get beamline type.
Quaternion itsCoordTrafoTo_m
virtual double getElementLength() const
Get design length.
Vector_t getOrigin3D() const
virtual BeamlineGeometry & getGeometry()
Get geometry.
virtual void accept(BeamlineVisitor &) const
Apply BeamlineVisitor to this line.
TBeamline(const std::string &name)
Constructor with given name.
virtual double getExit() const
Get exit position.
virtual void iterate(BeamlineVisitor &, bool r2l) const
Apply visitor to all elements of the line.
BeamlineGeometry itsGeometry
Vektor< double, 3 > Vector_t