Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

BLElement Class Reference

#include <BLElement.hh>

Inheritance diagram for BLElement:

BLCommand BLCMDcorner BLCMDfieldexpr BLCMDfieldmap BLCMDgenericbend BLCMDgenericquad BLCMDhelicaldipole BLCMDidealsectorbend BLCMDmultipole BLCMDparticlefilter BLCMDpillbox BLCMDpillbox2 BLCMDsolenoid BLCMDtrackerplane BLCMDvirtualdetector BLGroupElement List of all members.

Detailed Description

class BLElement - interface class for all g4beamline Elements

BLElement defines elements to be placed into the geometry of g4beamline.

Normally an element implementation will derive a class from this one, and if it has an EM field, also derives from BLElementField. Usually all are in a single file named for the element command class. The default constructor of the derived class is used to implement the element command (see BLCommand), and the copy constructor is used by the element command to create instances of the element.

Note the constructor of the derived class must contain enough information so the size of the element is determined (getLength(), etc.). Or at least these must be known before the element command returns.

A non-default instance of this class represents a specific type of the element, complete with all argument values; it is created by the element command of the derived class. This instance can be placed multiple times by the place command and by place commands applied to groups in which the instance has been placed. After the command file has been read (i.e. all elements have been created and placed), then the World group is constructed, and that results in a traversal of the placement tree and the construction of all elements. Thus a single instance of this class can appear multiple times at multiple locations within the overall geometry.

When element argments are given on the place command, clone() is used to copy the element, and then defineNamedArgs() is called for each element argument. Then the cloned element is placed.

NOTE: Derived classes MUST use the copy constructor, not the default constructor! ONLY the default object should use the default constructor.


Public Member Functions

 BLElement ()
 Default constructor.

virtual ~BLElement ()
 Destructor.

 BLElement (const BLElement &r)
 Copy constructor.

virtual BLElementclone ()=0
 clone() will clone a copy of an element. Used when element arguments are given in a place command.

virtual G4String getName () const
 getName() returns the element's name; do not confuse this with commandName(). Not used by the default instance.

virtual void setName (G4String _name)
 setName() sets the element's name; Adds the BLElement to mapElement. Used by instances of the derived class representing real elements; not used by the default instance. virtual so derived base classes can keep a list of their elements.

virtual void construct (G4RotationMatrix *relativeRotation, G4ThreeVector relativePosition, G4LogicalVolume *parent, G4String parentName, G4RotationMatrix *parentRotation, G4ThreeVector parentPosition)=0
 construct() will construct a physical implementation of this element at a specific location within the overall geometry. The name of the implementation should be parentName plus the name of the element; the physical volume should be linked into the parent in the usual way. relativeRotation is an active rotation of this element wrt the parent's coordinate axes, and relativePosition is in the parent's coords as usual (if the parent is the world, the centerline coordinate transform is included) -- the rotation for G4VPlacement is relativeRotation->inverse(). parentRotation and parentPosition are the rotation and position of the parent, expressed in global coordinates -- most elements can ignore them, as they are normally used to construct a BLCoordinateTransform from global coordinates to the element's local coordinates (e.g. for GlobalField).

virtual G4double getLength ()=0
 getLength() returns this element's Length along the Z axis.

virtual G4double getWidth ()=0
 getWidth() returns this element's Width along the X axis. For asymmetric elements, the width is twice the element's futhest point from X=0.

virtual G4double getHeight ()=0
 getHeight() returns this element's height along the Y axis. For asymmetric elements, the width is twice the element's futhest point from Y=0.

virtual G4bool isOK ()=0
 isOK() returns true iff this element is ready to process beam. It is queried AFTER the reference particle is tracked, so it can reflect the status of tuning performed by the reference particle.

virtual G4bool isGroupElement ()
 isGroupElement() returns true if this is a BLGroupElement. That is, if this element can be the parent of other elements.

bool getPlacedFlag ()
 getPlacedFlag() returns true if this element has been placed.

void setPlacedFlag (bool flag=true)
 setPlacedFlag() sets the flag for placing this element.

virtual void generatePoints (int npoints, std::vector< G4ThreeVector > &v)=0
 generatePoints() will generate points for the testGeometry() function (of BLGroupElement) for this element. It generates however many points are necessary to test extremes of its surface, plus randomly distributed ones on the surface, up to npoints total. Each point is in the local coordinates of the element.

virtual G4bool isOutside (G4ThreeVector &local, G4double tolerance)=0
 isOutside() returns true if the point is outside this element, or is within tolerance of being outside. local[] is the point in local coordinates of this element.

void generateBox (unsigned int npoints, G4double width, G4double height, G4double length, std::vector< G4ThreeVector > &v)
 generateBox() generates geometry test points for a Box (a convenience method for derived classes to use)

void generateTubs (unsigned int npoints, G4double innerRadius, G4double outerRadius, G4double initialPhi, G4double finalPhi, G4double length, std::vector< G4ThreeVector > &v)
 generateTubs() generates geometry test points for a Tubs (a convenience method for derived classes to use)


Static Public Member Functions

BLElementfind (G4String name)
 find() finds the BLElement with a given name.

G4bool allOK ()
 allOK() returns true iff all elements are ready to process beam.


Private Attributes

G4String name
bool placed

Static Private Attributes

std::map< G4String, BLElement * > mapElement


Constructor & Destructor Documentation

BLElement::BLElement  )  [inline]
 

Default constructor.

virtual BLElement::~BLElement  )  [inline, virtual]
 

Destructor.

BLElement::BLElement const BLElement r  )  [inline]
 

Copy constructor.


Member Function Documentation

virtual BLElement* BLElement::clone  )  [pure virtual]
 

clone() will clone a copy of an element. Used when element arguments are given in a place command.

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

virtual G4String BLElement::getName  )  const [inline, virtual]
 

getName() returns the element's name; do not confuse this with commandName(). Not used by the default instance.

Reimplemented from BLCommand.

void BLElement::setName G4String  _name  )  [virtual]
 

setName() sets the element's name; Adds the BLElement to mapElement. Used by instances of the derived class representing real elements; not used by the default instance. virtual so derived base classes can keep a list of their elements.

Reimplemented in BLGroupElement.

BLElement * BLElement::find G4String  name  )  [static]
 

find() finds the BLElement with a given name.

Reimplemented in BLGroupElement.

G4bool BLElement::allOK  )  [static]
 

allOK() returns true iff all elements are ready to process beam.

virtual void BLElement::construct G4RotationMatrix *  relativeRotation,
G4ThreeVector  relativePosition,
G4LogicalVolume *  parent,
G4String  parentName,
G4RotationMatrix *  parentRotation,
G4ThreeVector  parentPosition
[pure virtual]
 

construct() will construct a physical implementation of this element at a specific location within the overall geometry. The name of the implementation should be parentName plus the name of the element; the physical volume should be linked into the parent in the usual way. relativeRotation is an active rotation of this element wrt the parent's coordinate axes, and relativePosition is in the parent's coords as usual (if the parent is the world, the centerline coordinate transform is included) -- the rotation for G4VPlacement is relativeRotation->inverse(). parentRotation and parentPosition are the rotation and position of the parent, expressed in global coordinates -- most elements can ignore them, as they are normally used to construct a BLCoordinateTransform from global coordinates to the element's local coordinates (e.g. for GlobalField).

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

virtual G4double BLElement::getLength  )  [pure virtual]
 

getLength() returns this element's Length along the Z axis.

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

virtual G4double BLElement::getWidth  )  [pure virtual]
 

getWidth() returns this element's Width along the X axis. For asymmetric elements, the width is twice the element's futhest point from X=0.

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

virtual G4double BLElement::getHeight  )  [pure virtual]
 

getHeight() returns this element's height along the Y axis. For asymmetric elements, the width is twice the element's futhest point from Y=0.

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

virtual G4bool BLElement::isOK  )  [pure virtual]
 

isOK() returns true iff this element is ready to process beam. It is queried AFTER the reference particle is tracked, so it can reflect the status of tuning performed by the reference particle.

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

virtual G4bool BLElement::isGroupElement  )  [inline, virtual]
 

isGroupElement() returns true if this is a BLGroupElement. That is, if this element can be the parent of other elements.

Reimplemented in BLGroupElement.

bool BLElement::getPlacedFlag  )  [inline]
 

getPlacedFlag() returns true if this element has been placed.

void BLElement::setPlacedFlag bool  flag = true  )  [inline]
 

setPlacedFlag() sets the flag for placing this element.

virtual void BLElement::generatePoints int  npoints,
std::vector< G4ThreeVector > &  v
[pure virtual]
 

generatePoints() will generate points for the testGeometry() function (of BLGroupElement) for this element. It generates however many points are necessary to test extremes of its surface, plus randomly distributed ones on the surface, up to npoints total. Each point is in the local coordinates of the element.

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

virtual G4bool BLElement::isOutside G4ThreeVector &  local,
G4double  tolerance
[pure virtual]
 

isOutside() returns true if the point is outside this element, or is within tolerance of being outside. local[] is the point in local coordinates of this element.

Implemented in BLGroup, BLCMDabsorber, BLCMDbox, BLCMDcorner, BLCMDextrusion, BLCMDfieldexpr, BLCMDfieldmap, BLCMDgenericbend, BLCMDgenericquad, BLCMDhelicaldipole, BLCMDidealsectorbend, BLCMDmultipole, BLCMDparticlefilter, BLCMDpillbox, BLCMDpillbox2, BLCMDpolycone, BLCMDsolenoid, BLCMDsphere, BLCMDtrackerplane, BLCMDtrap, BLCMDtubs, and BLCMDvirtualdetector.

void BLElement::generateBox unsigned int  npoints,
G4double  width,
G4double  height,
G4double  length,
std::vector< G4ThreeVector > &  v
 

generateBox() generates geometry test points for a Box (a convenience method for derived classes to use)

void BLElement::generateTubs unsigned int  npoints,
G4double  innerRadius,
G4double  outerRadius,
G4double  initialPhi,
G4double  finalPhi,
G4double  length,
std::vector< G4ThreeVector > &  v
 

generateTubs() generates geometry test points for a Tubs (a convenience method for derived classes to use)


Member Data Documentation

std::map< G4String, BLElement * > BLElement::mapElement [static, private]
 

G4String BLElement::name [private]
 

bool BLElement::placed [private]
 


The documentation for this class was generated from the following files:
g4beamline