20#ifndef CLASSIC_TBeamline_HH
21#define CLASSIC_TBeamline_HH
131 virtual void append(
const T &);
166 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
167 relativePositions_m(false)
177 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
178 relativePositions_m(false)
187 itsOrigin_m(rhs.itsOrigin_m),
188 itsCoordTrafoTo_m(rhs.itsCoordTrafoTo_m),
189 relativePositions_m(rhs.relativePositions_m)
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();
315 return (getArcLength() / 2.0);
321 return (- getOrigin());
327 return (getArcLength() / 2.0);
336 double s1 = getEntrance();
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;
355 double s1 = getExit();
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());
394 return getTransform(0.0, s);
400 return getTransform(0.0, getEntrance());
406 return getTransform(0.0, getExit());
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
439 itsCoordTrafoTo_m = trafoTo;
442template <
class T>
inline
444 return itsCoordTrafoTo_m;
447template <
class T>
inline
449 relativePositions_m = flag;
452template <
class T>
inline
454 return relativePositions_m;
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)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
virtual void visitBeamline(const Beamline &)=0
Apply the algorithm to a beam line.
virtual double getArcLength() const
Get arc length.
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
Displacement and rotation in space.
const Euclid3D & dotBy(const Euclid3D &rhs)
Dot product with assign.
An abstract sequence of beam line components.
Implements the composite geometry of a beam line.
bool getRelativeFlag() const
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 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 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.
virtual double getExit() const
Get exit position.
virtual void iterate(BeamlineVisitor &, bool r2l) const
Apply visitor to all elements of the line.
BeamlineGeometry itsGeometry
The beamline geometry.