BLGroup Class Reference

#include <BLGroup.hh>

Inheritance diagram for BLGroup:

BLGroupElement BLElement BLCommand

List of all members.


Detailed Description

BLGroup - define one group (container for BLElement-s).

NOTE: the class for the group command is BLGroup, not BLCMDgroup. This class is too intertwinded between command and infrastructure, so a single class was used.

Implements the group command, which begins defining the contents of the group; the endgroup command ends the group's definition, and computes the size of the group (if it wasn't specified via arguments). The group expands to hold its contents, unless its size is specified in arguments to the group command. The World is a expandable group.

If radius is set to 0, uses a Tubs with radius equal to the larger of the widest or highest element placed into the group; if radius is set >0 that is the fixed radius of the Tubs. If radius is not set then uses a Box.

Public Member Functions

 BLGroup ()
 Default Constructor. registers the command and provides help text.
 BLGroup (BLGroup &r)
 Copy Constructor for a real BLGroup.
 ~BLGroup ()
 Destructor.
BLElementclone ()
 clone() - invalid.
virtual G4String commandName ()
 commandName() returns "group";
int command (BLArgumentVector &argv, BLArgumentMap &namedArgs)
 command() implements the group command.
void defineNamedArgs ()
 defineNamedArgs() defines the arguments to the command.
virtual void construct (G4RotationMatrix *relativeRotation, G4ThreeVector relativePosition, G4LogicalVolume *parent, G4String parentName, G4RotationMatrix *parentRotation, G4ThreeVector parentPosition)
 construct() will construct an instance of this group, and construct its contents recursively.
G4double getLength ()
 getLength() returns this group's Length along the Z axis.
G4double getWidth ()
 getWidth() returns this group's Width along the X axis.
G4double getHeight ()
 getHeight() returns this group's height along the Y axis.
void setMinWidth (G4double minWidth)
 setMinWidth() will increase the width, if necessary.
void setMinHeight (G4double minHeight)
 setMinHeight() will increase the height, if necessary.
void setMinLength (G4double minLength)
 setMinLength() will increase the length, if necessary.
void setMaterial (G4String mat)
 setMaterial() sets the name of the group's material.
G4bool isOK ()
 isOK() returns true; individual elements are responsible for their own status.
bool isOutside (G4ThreeVector &local, G4double tolerance)
 isOutside() from BLElement.
void generatePoints (int npoints, std::vector< G4ThreeVector > &v)
 generatePoints from BLElement.
bool isWithin (G4ThreeVector &local, G4double tolerance)
 isWithin() from BLGroupElement.
virtual void placeElement (BLElement *element, G4RotationMatrix *rot, G4ThreeVector &offset, G4String rename, G4bool global=false)
 placeElement() will place an element within this group. With a rotation, an offset must be given, and the length of the group must have been specified via an argument. Called by the place command. The object being placed is rotated wrt the fixed axes of the group's local coordinates. global=true means use global coordinates for the world group, not centerline coords.
virtual void placeElement (BLElement *element, G4ThreeVector &offset, G4String rename, G4bool global=false)
 placeElement() will place an element within this group. With an offset, the length of the group must have been specified via an argument. Called by the place command.
virtual void placeElement (BLElement *element, G4String rename, G4bool global=false)
 placeElement() will place an element within this group. With no offset, this element is placed immediately downstream of the previous element. If necessary, the endgroup command will compute the size of the group and readjust offsets so they are relative to the center of the group. Called by the place command.
void end ()
 end() will compute the size of the group, if necessary, and pop the current group.
G4ThreeVector & getOffset ()
 getOffset() returns the offset for the place command.
void setOffset (G4ThreeVector &offset)
 setOffset() sets the offset for the place command.

Static Public Member Functions

static BLGroupgetCurrent ()
 getCurrent() returns a pointer to the current group (innermost active group command). Creates current and world if necessary. Used by the place command.
static BLGroupgetWorld ()
 getWorld() returns a pointer to the World group. Creates current and world if necessary.
static G4VPhysicalVolume * constructWorld ()
 constructWorld() constructs the beamline and returns a pointer to its world PhysicalVolume.

Private Member Functions

BLGroupoperator= (const BLGroup &)

Private Attributes

BLGroupprevCurrent
G4double highZ
G4double lastZ
G4double length
G4double width
G4double height
G4double radius
G4String material
G4String color
G4double maxStep
G4bool fixedLength
G4bool fixedWidth
G4bool fixedHeight
G4ThreeVector offset

Static Private Attributes

static BLGroupcurrent = 0
static BLGroupworld = 0
static G4VPhysicalVolume * worldPhysVol = 0

Friends

class BLCMDendgroup

Classes

struct  Child


Constructor & Destructor Documentation

BLGroup::BLGroup (  ) 

Default Constructor. registers the command and provides help text.

References BLCMDTYPE_CONTROL, color, fixedHeight, fixedLength, fixedWidth, height, highZ, lastZ, length, material, maxStep, prevCurrent, radius, BLCommand::registerCommand(), BLCommand::setDescription(), BLCommand::setSynopsis(), and width.

Referenced by command(), and getWorld().

00036                  : BLGroupElement(), offset(0,0,0)
00037 {
00038         registerCommand(BLCMDTYPE_CONTROL);
00039         setSynopsis("begins definition of a group.");
00040         setDescription("A group is a collection of elements that can be placed\n"
00041                 "together, preserving their relative positions. The group\n"
00042                 "is a LogicalVolume in the geant4 geometry -- this means that "
00043                 "a group cannot overlap any other group or object, even if the "
00044                 "overlapping portion of the group is empty. If you need to "
00045                 "permit overlaps, consider using a macro instead (the define "
00046                 "command).\n\n"
00047                 "If the group is\n"
00048                 "given a length, then children can be placed at specific\n"
00049                 "z offsets relative to the center of the group. If the group\n"
00050                 "is not given a length, then children can only be placed\n"
00051                 "sequentially along z, and the length will be computed by\n"
00052                 "the endgroup command. Width and height are computed\n"
00053                 "from the largest child or the argument.\n"
00054                 "If radius is set to 0, the group will be a cylinder with\n"
00055                 "radius determined by the largest width or height placed\n"
00056                 "into it; if >0 then that is the fixed radius. If radius\n"
00057                 "is not set then a box is used.");
00058 
00059         prevCurrent = 0;
00060         highZ = 0.0;
00061         lastZ = 0.0;
00062         length = 0.0;
00063         width = 0.0;
00064         height = 0.0;
00065         radius = -1.0;
00066         material = "Vacuum";
00067         color = "";
00068         maxStep = -1.0;
00069         fixedLength = false;
00070         fixedWidth = false;
00071         fixedHeight = false;
00072 }

BLGroup::BLGroup ( BLGroup r  )  [inline]

Copy Constructor for a real BLGroup.

References color, fixedHeight, fixedLength, fixedWidth, height, highZ, lastZ, length, material, maxStep, prevCurrent, radius, and width.

00072                             : BLGroupElement(r), offset(0,0,0)
00073                 { prevCurrent=0; highZ=0.0; lastZ=0.0; length=r.length;
00074                   width=r.width; height=r.height; material=r.material;
00075                   radius=r.radius; color = r.color; maxStep = r.maxStep; 
00076                   fixedLength = r.fixedLength;
00077                   fixedWidth = r.fixedWidth;
00078                   fixedHeight = r.fixedHeight; }

BLGroup::~BLGroup (  ) 

Destructor.

00075 {
00076 }


Member Function Documentation

BLElement* BLGroup::clone (  )  [inline, virtual]

clone() - invalid.

Implements BLElement.

00084 { return 0; }

virtual G4String BLGroup::commandName (  )  [inline, virtual]

commandName() returns "group";

Implements BLCommand.

00087 { return "group"; }

int BLGroup::command ( BLArgumentVector argv,
BLArgumentMap namedArgs 
) [virtual]

command() implements the group command.

Implements BLCommand.

References BLGroup(), current, fixedHeight, fixedLength, fixedWidth, getCurrent(), BLParam::getDouble(), BLCommand::getMaterial(), BLCommand::handleNamedArgs(), height, highZ, lastZ, length, material, maxStep, Param, prevCurrent, BLCommand::print(), BLCommand::printError(), radius, BLGroupElement::setName(), and width.

00079 {
00080         if(argv.size() != 1) {
00081                 printError("invalid group command -- requires name");
00082                 argv.clear();
00083                 argv.push_back("UnnamedGroup");
00084         }
00085 
00086         BLGroup *c = new BLGroup(defaultGroup);
00087         c->setName(argv[0]);
00088         c->handleNamedArgs(namedArgs);
00089         if(c->length > 0.0)
00090                 c->lastZ = c->highZ = -c->length/2.0;
00091 
00092         if(c->maxStep < 0.0) c->maxStep = Param.getDouble("maxStep");
00093 
00094         if(c->radius > 0.0)
00095                 c->width = c->height = 2.0*c->radius;
00096         c->fixedLength = (c->length > 0.0);
00097         c->fixedWidth = (c->width > 0.0);
00098         c->fixedHeight = (c->height > 0.0);
00099 
00100         c->prevCurrent = getCurrent();  // (current could be 0)
00101         current = c;
00102 
00103         // check material exists
00104         if(c->material.size() > 0) getMaterial(c->material,false);
00105 
00106         c->print(argv[0]);
00107 
00108         return 0;
00109 }

void BLGroup::defineNamedArgs (  )  [virtual]

defineNamedArgs() defines the arguments to the command.

Reimplemented from BLCommand.

References BLCommand::argDouble(), BLCommand::argString(), color, height, length, material, maxStep, radius, and width.

00112 {
00113         argDouble(length,"length","Overall group length along z (mm)",mm,"",false);
00114         argDouble(width,"width","Overall group width (mm)",mm,"",false);
00115         argDouble(height,"height","Overall group height (mm)",mm,"",false);
00116         argDouble(radius,"radius","Radius for a cylindrical group (mm)",mm,"",false);
00117         argString(material,"material","Material of the volume outside children");
00118         argString(color,"color","Color of the volume of the group");
00119         argDouble(maxStep,"maxStep","The maximum stepsize in the volume (mm)");
00120 }

void BLGroup::construct ( G4RotationMatrix *  relativeRotation,
G4ThreeVector  relativePosition,
G4LogicalVolume *  parent,
G4String  parentName,
G4RotationMatrix *  parentRotation,
G4ThreeVector  parentPosition 
) [virtual]

construct() will construct an instance of this group, and construct its contents recursively.

Implements BLElement.

References color, BLGroupElement::constructChildren(), BLParam::getDouble(), getHeight(), getLength(), BLCommand::getMaterial(), BLElement::getName(), BLCommand::getVisAttrib(), getWidth(), height, length, material, maxStep, Param, radius, width, world, and worldPhysVol.

Referenced by constructWorld().

00128 {
00129         if(radius == 0.0) radius = std::max<double>(width,height)/2.0;
00130         bool silent = (getName() == "World");
00131         if(radius > 0.0 && !silent)
00132             printf("BLGroup::Construct %s parent=%s relZ=%.1f globZ=%.1f length=%.1f\n"
00133                         "\tzmin=%.1f zmax=%.1f radius=%.1f\n",
00134                 getName().c_str(),parentName.c_str(),relativePosition[2],
00135                 parentPosition[2],getLength(),
00136                 parentPosition.z()-getLength()/2.0,
00137                 parentPosition.z()+getLength()/2.0,
00138                 radius);
00139         else if(!silent)
00140             printf("BLGroup::Construct %s parent=%s relZ=%.1f globZ=%.1f length=%.1f\n"
00141                         "\tzmin=%.1f zmax=%.1f width=%.1f Height=%.1f\n",
00142                 getName().c_str(),parentName.c_str(),relativePosition[2],
00143                 parentPosition[2],getLength(),
00144                 parentPosition.z()-getLength()/2.0,
00145                 parentPosition.z()+getLength()/2.0,
00146                 getWidth(),getHeight());
00147         
00148         if(maxStep <= 0.0) maxStep = Param.getDouble("maxStep");
00149 
00150         // add safety region to the world volume, so steps are guaranteed
00151         // to remain inside the world volume. Double it to be sure.
00152         G4double safety = 0.0;
00153         if(this == world) safety = maxStep * 2.0;
00154 
00155         G4VSolid *solid=0;
00156         if(radius > 0.0)
00157                 solid = new G4Tubs(getName()+"Tubs", 0.0, radius+safety,
00158                         length/2.0+safety, 0.0, 2.0*pi);
00159         else
00160                 solid = new G4Box(getName()+"Box",getWidth()/2.0+safety,
00161                                 getHeight()/2.0+safety,getLength()/2.0+safety);
00162         G4Material *mat = getMaterial(material);
00163         G4LogicalVolume *lv = new G4LogicalVolume(solid,mat,getName()+"LogVol");
00164         lv->SetVisAttributes(getVisAttrib(color));
00165         lv->SetUserLimits(new G4UserLimits(maxStep));
00166 
00167         // geant4 rotation convention is backwards from g4beamline
00168         G4RotationMatrix *g4rot = 0;
00169         if(relativeRotation)
00170                 g4rot = new G4RotationMatrix(relativeRotation->inverse());
00171 
00172         G4VPhysicalVolume *phys = new G4PVPlacement(g4rot, relativePosition,lv,
00173                                         parentName+getName(),parent, false,0);
00174 
00175         G4String xname = parentName + getName();
00176         if(this == world) {
00177                 worldPhysVol = phys;
00178                 xname = "";     // omit "World" from the start of every name
00179         }
00180 
00181         // get globalRotation and globalPosition
00182         G4RotationMatrix *globalRotation = 0;
00183         if(relativeRotation && parentRotation) {
00184                 globalRotation = 
00185                     new G4RotationMatrix(*parentRotation * *relativeRotation);
00186         } else if(relativeRotation) {
00187                 globalRotation = relativeRotation;
00188         } else if(parentRotation) {
00189                 globalRotation = parentRotation;
00190         }
00191         G4ThreeVector globalPosition(relativePosition + parentPosition);
00192         if(parentRotation)
00193                 globalPosition = *parentRotation * relativePosition +
00194                                 parentPosition;
00195 
00196         if(!silent) printf("\tParent pos=%.1f,%.1f,%.1f Relative pos=%.1f,%.1f,%.1f Global pos=%.1f,%.1f,%.1f\n",
00197                 parentPosition[0],parentPosition[1],parentPosition[2],
00198                 relativePosition[0],relativePosition[1],relativePosition[2],
00199                 globalPosition[0],globalPosition[1],globalPosition[2]);
00200 
00201         constructChildren(lv,xname,globalRotation,globalPosition);
00202 }

G4double BLGroup::getLength (  )  [inline, virtual]

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

Implements BLElement.

References length.

Referenced by construct().

00105 { return length; }

G4double BLGroup::getWidth (  )  [inline, virtual]

getWidth() returns this group's Width along the X axis.

Implements BLElement.

References width.

Referenced by construct().

00108 { return width; }

G4double BLGroup::getHeight (  )  [inline, virtual]

getHeight() returns this group's height along the Y axis.

Implements BLElement.

References height.

Referenced by construct().

00111 { return height; }

void BLGroup::setMinWidth ( G4double  minWidth  )  [inline]

setMinWidth() will increase the width, if necessary.

References width.

Referenced by BLCMDreference::command(), BLCMDcosmicraybeam::command(), BLCMDbeam::command(), and placeElement().

00115                 { if(width < minWidth) width = minWidth; }

void BLGroup::setMinHeight ( G4double  minHeight  )  [inline]

setMinHeight() will increase the height, if necessary.

References height.

Referenced by BLCMDreference::command(), BLCMDcosmicraybeam::command(), BLCMDbeam::command(), and placeElement().

00119                 { if(height < minHeight) height = minHeight; }

void BLGroup::setMinLength ( G4double  minLength  )  [inline]

setMinLength() will increase the length, if necessary.

References highZ.

Referenced by BLCMDreference::command(), BLCMDcosmicraybeam::command(), BLCMDbeam::command(), and placeElement().

00123                 { if(highZ < minLength) highZ = minLength; }

void BLGroup::setMaterial ( G4String  mat  )  [inline]

setMaterial() sets the name of the group's material.

References material.

Referenced by main().

00126 { material = mat; }

G4bool BLGroup::isOK (  )  [inline, virtual]

isOK() returns true; individual elements are responsible for their own status.

Implements BLElement.

00130 { return true; }

G4bool BLGroup::isOutside ( G4ThreeVector &  local,
G4double  tolerance 
) [virtual]

isOutside() from BLElement.

Implements BLElement.

References height, length, radius, and width.

00189 {
00190         if(radius > 0.0)
00191                 return sqrt(local[0]*local[0]+local[1]*local[1]) > radius-tolerance ||
00192                         fabs(local[2]) > length/2.0-tolerance;
00193         else
00194                 return fabs(local[0]) > width/2.0-tolerance ||
00195                         fabs(local[1]) > height/2.0-tolerance ||
00196                         fabs(local[2]) > length/2.0-tolerance;
00197 }

void BLGroup::generatePoints ( int  npoints,
std::vector< G4ThreeVector > &  v 
) [virtual]

generatePoints from BLElement.

Implements BLElement.

References BLElement::generateBox(), BLElement::generateTubs(), height, length, radius, and width.

00200 {
00201         if(radius > 0.0)
00202                 generateTubs(npoints, 0.0, radius, 0.0, 2.0*pi, length, v);
00203         else
00204                 generateBox(npoints,width,height,length,v);
00205 }

G4bool BLGroup::isWithin ( G4ThreeVector &  local,
G4double  tolerance 
) [virtual]

isWithin() from BLGroupElement.

Implements BLGroupElement.

References height, length, radius, and width.

00208 {
00209         if(radius > 0.0)
00210                 return sqrt(local[0]*local[0]+local[1]*local[1]) < radius+tolerance ||
00211                         fabs(local[2]) < length/2.0+tolerance;
00212         else
00213                 return fabs(local[0]) < width/2.0+tolerance &&
00214                         fabs(local[1]) < height/2.0+tolerance &&
00215                         fabs(local[2]) < length/2.0+tolerance;
00216 }

void BLGroup::placeElement ( BLElement element,
G4RotationMatrix *  rot,
G4ThreeVector &  offset,
G4String  rename,
G4bool  global = false 
) [virtual]

placeElement() will place an element within this group. With a rotation, an offset must be given, and the length of the group must have been specified via an argument. Called by the place command. The object being placed is rotated wrt the fixed axes of the group's local coordinates. global=true means use global coordinates for the world group, not centerline coords.

References BLGroupElement::child, BLGroupElement::Child::element, fixedHeight, fixedLength, fixedWidth, BLCoordinates::getCurrentGlobal(), BLCoordinates::getCurrentRotation(), BLElement::getHeight(), BLElement::getLength(), BLElement::getName(), BLElement::getWidth(), height, highZ, lastZ, length, NO_RENAME(), BLGroupElement::Child::offset, Param, BLCommand::printError(), BLGroupElement::Child::rename, BLGroupElement::Child::rot, setMinHeight(), setMinLength(), setMinWidth(), BLParam::setParam(), width, and world.

Referenced by BLCMDplace::command(), BLCMDcorner::command(), and placeElement().

00042 {
00043         BLGroupElement::Child c;
00044         c.element = element;
00045         c.rename = rename;
00046 
00047         // convert centerline coordinates to global coordinates, if world
00048         if(this == world && !global) {
00049                 BLCoordinates::getCurrentGlobal(offset,c.offset);
00050                 if(rot)
00051                         c.rot = *BLCoordinates::getCurrentRotation() * *rot;
00052                 else
00053                         c.rot = *BLCoordinates::getCurrentRotation();
00054         } else {
00055                 if(rot) c.rot = *rot;
00056                 c.offset = offset;
00057         }
00058 
00059         // add this child
00060         child.push_back(c);
00061 
00062         // handle renamme
00063         if(rename == NO_RENAME)
00064                 c.rename = element->getName();
00065         else if(rename.find('+') == 0)
00066                 c.rename = getName()+rename.substr(1);
00067 
00068         // expand group to element's size.
00069         G4ThreeVector corner(element->getWidth()/2.0,element->getHeight()/2.0,
00070                                                 element->getLength()/2.0);
00071         G4ThreeVector parent;
00072         // loop over all 8 corners of the bounding box of the element.
00073         for(int i=0; i<2; ++i) {
00074             corner[0] = -corner[0];
00075             for(int j=0; j<2; ++j) {
00076                 corner[1] = -corner[1];
00077                 for(int k=0; k<2; ++k) {
00078                         corner[2] = -corner[2];
00079                         if(rot)
00080                                 parent = *rot * corner;
00081                         else
00082                                 parent = corner;
00083                         G4double x = offset[0]+parent[0];
00084                         if(!fixedWidth)
00085                                 setMinWidth(2.0*fabs(x));
00086                         else if(fabs(x) > width/2.0)
00087                             printError("Element '%s' extends outside '%s' in x",
00088                                 c.rename.c_str(),getName().c_str());
00089                         G4double y = offset[1]+parent[1];
00090                         if(!fixedHeight)
00091                                 setMinHeight(2.0*fabs(y));
00092                         else if(fabs(y) > height/2.0)
00093                             printError("Element '%s' extends outside '%s' in y",
00094                                 c.rename.c_str(),getName().c_str());
00095                         G4double z = offset[2]+parent[2];
00096                         if(!fixedLength)
00097                                 setMinLength(this==world ? fabs(z) : z);
00098                         else if(fabs(z) > length/2.0)
00099                             printError("Element '%s' extends outside '%s' in z",
00100                                 c.rename.c_str(),getName().c_str());
00101                         if(i+j+k == 0 || z > lastZ)
00102                                 lastZ = z;
00103                         if(this == world && !global) {
00104                                 G4ThreeVector gp;
00105                                 BLCoordinates::getCurrentGlobal(offset+parent,gp);
00106                                 setMinWidth(2.0*fabs(gp[0]));
00107                                 setMinHeight(2.0*fabs(gp[1]));
00108                                 setMinLength(gp[2]);
00109                         }
00110                 }
00111             }
00112         }
00113 
00114         // update z positions used
00115         if(lastZ > highZ)
00116                 highZ = lastZ;
00117         if(this == world && !global)
00118                 Param.setParam("Zcl",lastZ);
00119 }

void BLGroup::placeElement ( BLElement element,
G4ThreeVector &  offset,
G4String  rename,
G4bool  global = false 
) [virtual]

placeElement() will place an element within this group. With an offset, the length of the group must have been specified via an argument. Called by the place command.

References placeElement().

00123 {
00124         placeElement(element,0,offset,rename,global);
00125 }

void BLGroup::placeElement ( BLElement element,
G4String  rename,
G4bool  global = false 
) [virtual]

placeElement() will place an element within this group. With no offset, this element is placed immediately downstream of the previous element. If necessary, the endgroup command will compute the size of the group and readjust offsets so they are relative to the center of the group. Called by the place command.

References BLElement::getLength(), lastZ, offset, and placeElement().

00128 {
00129         G4double l = element->getLength();
00130         G4ThreeVector offset(0.0,0.0,lastZ + l/2.0);
00131         placeElement(element,0,offset,rename,global);
00132 }

void BLGroup::end (  ) 

end() will compute the size of the group, if necessary, and pop the current group.

References BLGroupElement::child, current, height, highZ, length, prevCurrent, width, and world.

Referenced by BLCMDendgroup::command(), and main().

00135 {
00136         // compute length if not set by argument, and adjust child offsets
00137         if(length == 0.0) {
00138                 if(this == world) {
00139                         // z=0 is center
00140                         length = highZ * 2.0;
00141                 } else {
00142                         // z=0 is where we started
00143                         length = highZ;
00144                         std::vector<BLGroupElement::Child>::iterator i;
00145                         for(i=child.begin(); i!=child.end(); ++i) {
00146                                 i->offset[2] -= length/2.0;
00147                         }
00148                 }
00149         }
00150 
00151         // expand world by 20.1357 cm
00152         if(this == world) {
00153                 printf("\nWorld size (before incrementing by 201.357 mm): "
00154                     "%.1f H  %.1f W  %.1f L\n",height/mm,width/mm,length/mm);
00155                 width += 20.1357*cm;
00156                 height += 20.1357*cm;
00157                 length += 20.1357*cm;
00158         }
00159 
00160         // pop current group
00161         if(current != world && prevCurrent != 0)
00162                 current = prevCurrent;
00163         prevCurrent = 0;
00164 }

G4ThreeVector& BLGroup::getOffset (  )  [inline]

getOffset() returns the offset for the place command.

References offset.

Referenced by BLCMDplace::command().

00173 { return offset; }

void BLGroup::setOffset ( G4ThreeVector &  offset  )  [inline]

setOffset() sets the offset for the place command.

Referenced by BLCMDplace::command().

00176 { this->offset = offset; }

BLGroup * BLGroup::getCurrent (  )  [static]

getCurrent() returns a pointer to the current group (innermost active group command). Creates current and world if necessary. Used by the place command.

References current, and getWorld().

Referenced by BLCMDplace::command(), command(), BLCMDendgroup::command(), BLCMDcornerarc::command(), and BLCMDcorner::command().

00167 {
00168         if(!current) current = getWorld();
00169         return current;
00170 }

BLGroup * BLGroup::getWorld (  )  [static]

getWorld() returns a pointer to the World group. Creates current and world if necessary.

References BLGroup(), BLGroupElement::setName(), and world.

Referenced by BLCMDgeometry::callback(), BLCMDreference::command(), BLCMDplace::command(), BLCMDendgroup::command(), BLCMDcosmicraybeam::command(), BLCMDcornerarc::command(), BLCMDcorner::command(), BLCMDbeam::command(), constructWorld(), getCurrent(), and main().

00173 {
00174         if(!world) {
00175                 world = new BLGroup(defaultGroup);
00176                 world->setName("World");
00177         }
00178         return world;
00179 }

G4VPhysicalVolume * BLGroup::constructWorld (  )  [static]

constructWorld() constructs the beamline and returns a pointer to its world PhysicalVolume.

References construct(), getWorld(), and worldPhysVol.

Referenced by BLManager::Construct().

00182 {
00183         G4ThreeVector abs;
00184         getWorld()->construct(0,abs,0,"",0,abs);
00185         return worldPhysVol;
00186 }

BLGroup& BLGroup::operator= ( const BLGroup  )  [private]


Friends And Related Function Documentation

friend class BLCMDendgroup [friend]


Member Data Documentation

BLGroup * BLGroup::current = 0 [static, private]

Referenced by command(), end(), and getCurrent().

BLGroup * BLGroup::world = 0 [static, private]

Referenced by construct(), end(), getWorld(), and placeElement().

G4VPhysicalVolume * BLGroup::worldPhysVol = 0 [static, private]

Referenced by construct(), and constructWorld().

Referenced by BLGroup(), command(), and end().

G4double BLGroup::highZ [private]

G4double BLGroup::lastZ [private]

Referenced by BLGroup(), command(), and placeElement().

G4double BLGroup::length [private]

G4double BLGroup::width [private]

G4double BLGroup::height [private]

G4double BLGroup::radius [private]

G4String BLGroup::material [private]

G4String BLGroup::color [private]

Referenced by BLGroup(), construct(), and defineNamedArgs().

G4double BLGroup::maxStep [private]

G4bool BLGroup::fixedLength [private]

Referenced by BLGroup(), command(), and placeElement().

G4bool BLGroup::fixedWidth [private]

Referenced by BLGroup(), command(), and placeElement().

G4bool BLGroup::fixedHeight [private]

Referenced by BLGroup(), command(), and placeElement().

G4ThreeVector BLGroup::offset [private]

Referenced by getOffset(), and placeElement().


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