20 #ifndef CLASSIC_TBeamline_HH
21 #define CLASSIC_TBeamline_HH
131 virtual void append(
const T &);
164 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
165 relativePositions_m(false)
175 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
176 relativePositions_m(false)
185 itsOrigin_m(rhs.itsOrigin_m),
186 itsCoordTrafoTo_m(rhs.itsCoordTrafoTo_m),
187 relativePositions_m(rhs.relativePositions_m)
205 for(
typename std::list<T>::const_reverse_iterator op = this->rbegin();
206 op != this->rend(); ++op) {
210 for(
typename std::list<T>::const_iterator op = this->
begin();
211 op != this->
end(); ++op) {
222 for(
typename std::list<T>::const_iterator op = this->
begin();
223 op != this->
end(); ++op) {
226 newObj.setElement(op->getElement()->clone());
245 for(
typename std::list<T>::const_iterator iter = this->
begin();
246 iter != this->
end(); ++iter) {
249 newObj.setElement(iter->getElement()->copyStructure());
262 template <
class T>
inline
266 for(
typename std::list<T>::const_iterator iter = this->
begin();
267 iter != this->
end(); ++iter) {
268 iter->getElement()->makeSharable();
273 template <
class T>
inline
279 template <
class T>
inline
289 for(
typename std::list<T>::const_iterator iter = this->
begin();
290 iter != this->
end(); ++iter) {
291 length += iter->getElement()->getArcLength();
302 for(
typename std::list<T>::const_iterator iter = this->
begin();
303 iter != this->
end(); ++iter) {
304 length += iter->getElement()->getElementLength();
313 return (getArcLength() / 2.0);
319 return (- getOrigin());
325 return (getArcLength() / 2.0);
334 double s1 = getEntrance();
335 typename std::list<T>::const_iterator iter = this->
begin();
337 while(iter != this->
end() && s1 <= toS) {
343 double s0 = (s1 + s2) / 2.0;
344 double arc1 =
std::max(s1, fromS) - s0;
345 double arc2 =
std::min(s2, toS) - s0;
353 double s1 = getExit();
354 typename std::list<T>::const_reverse_iterator iter = this->rbegin();
356 while(iter != this->rend() && s1 >= toS) {
362 double s0 = (s1 + s2) / 2.0;
363 double arc1 =
std::min(s1, fromS) - s0;
364 double arc2 =
std::max(s2, toS) - s0;
381 for(
typename std::list<T>::const_iterator iter = this->
begin();
382 iter != this->
end(); ++iter) {
383 transform.
dotBy(iter->getElement()->getTotalTransform());
392 return getTransform(0.0, s);
398 return getTransform(0.0, getEntrance());
404 return getTransform(0.0, getExit());
408 template <
class T>
inline
414 template <
class T>
inline
416 this->push_back(obj);
420 template <
class T>
inline
422 this->push_front(obj);
425 template <
class T>
inline
430 template <
class T>
inline
435 template <
class T>
inline
437 itsCoordTrafoTo_m = trafoTo;
440 template <
class T>
inline
442 return itsCoordTrafoTo_m;
445 template <
class T>
inline
447 relativePositions_m = flag;
450 template <
class T>
inline
452 return relativePositions_m;
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.
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.
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 ElementBase::ElementType getType() const
Get beamline type.
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.