1 #ifndef CLASSIC_TBeamline_HH
2 #define CLASSIC_TBeamline_HH
103 virtual double getExit()
const;
143 virtual void append(
const T &);
176 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
177 relativePositions_m(false)
187 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
188 relativePositions_m(false)
197 itsOrigin_m(rhs.itsOrigin_m),
198 itsCoordTrafoTo_m(rhs.itsCoordTrafoTo_m),
199 relativePositions_m(rhs.relativePositions_m)
217 for(
typename std::list<T>::const_reverse_iterator op = this->rbegin();
218 op != this->rend(); ++op) {
222 for(
typename std::list<T>::const_iterator op = this->begin();
223 op != this->end(); ++op) {
234 for(
typename std::list<T>::const_iterator op = this->begin();
235 op != this->end(); ++op) {
238 newObj.setElement(op->getElement()->clone());
257 for(
typename std::list<T>::const_iterator iter = this->begin();
258 iter != this->end(); ++iter) {
261 newObj.setElement(iter->getElement()->copyStructure());
274 template <
class T>
inline
278 for(
typename std::list<T>::const_iterator iter = this->begin();
279 iter != this->end(); ++iter) {
280 iter->getElement()->makeSharable();
285 template <
class T>
inline
291 template <
class T>
inline
301 for(
typename std::list<T>::const_iterator iter = this->begin();
302 iter != this->end(); ++iter) {
303 length += iter->getElement()->getArcLength();
314 for(
typename std::list<T>::const_iterator iter = this->begin();
315 iter != this->end(); ++iter) {
316 length += iter->getElement()->getElementLength();
325 return (getArcLength() / 2.0);
331 return (- getOrigin());
337 return (getArcLength() / 2.0);
346 double s1 = getEntrance();
347 typename std::list<T>::const_iterator iter = this->begin();
349 while(iter != this->end() && s1 <= toS) {
355 double s0 = (s1 + s2) / 2.0;
356 double arc1 =
std::max(s1, fromS) - s0;
357 double arc2 =
std::min(s2, toS) - s0;
365 double s1 = getExit();
366 typename std::list<T>::const_reverse_iterator iter = this->rbegin();
368 while(iter != this->rend() && s1 >= toS) {
374 double s0 = (s1 + s2) / 2.0;
375 double arc1 =
std::min(s1, fromS) - s0;
376 double arc2 =
std::max(s2, toS) - s0;
393 for(
typename std::list<T>::const_iterator iter = this->begin();
394 iter != this->end(); ++iter) {
395 transform.
dotBy(iter->getElement()->getTotalTransform());
404 return getTransform(0.0, s);
410 return getTransform(0.0, getEntrance());
416 return getTransform(0.0, getExit());
420 template <
class T>
inline
427 template <
class T>
inline
433 template <
class T>
inline
435 this->push_back(obj);
439 template <
class T>
inline
441 this->push_front(obj);
444 template <
class T>
inline
449 template <
class T>
inline
454 template <
class T>
inline
456 itsCoordTrafoTo_m = trafoTo;
459 template <
class T>
inline
461 return itsCoordTrafoTo_m;
464 template <
class T>
inline
466 relativePositions_m = flag;
469 template <
class T>
inline
471 return relativePositions_m;
473 #endif // CLASSIC_TBeamline_HH
virtual TBeamline< T > * clone() const
Make clone.
virtual double getArcLength() const
Get arc length.
Interface for basic beam line object.
bool getRelativeFlag() const
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
virtual double getOrigin() const
Get origin position.
void setRelativeFlag(bool flag)
virtual ElementBase::ElementType getType() const
Get beamline type.
virtual double getElementLength() const
Get design length.
Implements the composite geometry of a beam line.
virtual Euclid3D getEntranceFrame() const
Get transform.
virtual void makeSharable()
Set sharable flag.
Vector_t getOrigin3D() const
Template class for beam lines.
virtual double getEntrance() const
Get entrance position.
void setOrigin3D(const Vector_t &ori)
void setInitialDirection(const Quaternion &rot)
const Euclid3D & dotBy(const Euclid3D &rhs)
Dot product with assign.
virtual Euclid3D getExitFrame() const
Get transform.
virtual Euclid3D getTotalTransform() const
Get transform.
Displacement and rotation in space.
virtual void iterate(BeamlineVisitor &, bool r2l) const
Apply visitor to all elements of the line.
virtual void accept(BeamlineVisitor &) const
Apply BeamlineVisitor to this line.
An abstract sequence of beam line components.
virtual BeamlineGeometry & getGeometry()
Get geometry.
virtual double getArcLength() const
Get arc length.
virtual void visitBeamline(const Beamline &)=0
Apply the algorithm to a Beamline.
Quaternion itsCoordTrafoTo_m
virtual void append(const T &)
Append a T object.
Quaternion getInitialDirection() const
BeamlineGeometry itsGeometry
The beamline geometry.
virtual TBeamline< T > * copyStructure()
Make structure copy.
virtual void prepend(const T &)
Prepend a T object.
TBeamline()
Default constructor.
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
virtual ElementImage * getImage() const
Construct an image.
virtual double getExit() const
Get exit position.