SolenoidField Class Reference

Inheritance diagram for SolenoidField:

BLElementField

List of all members.


Detailed Description

SolenoidField represents one placement of a solenoid.

Public Member Functions

 SolenoidField (BLCoordinateTransform &_global2local, BLCoil *_coil, G4double _current)
 constructor. _zmin/max are global coordinates.
void addFieldValue (const G4double point[4], G4double field[6]) const
 addFieldValue() adds the field for this solenoid into field[]. Calls coil->addField() after converting to relative coords. point[] is in global coordinates.

Private Attributes

BLCoilcoil
G4double current
BLCoordinateTransform global2local
G4RotationMatrix * rotation

Constructor & Destructor Documentation

SolenoidField::SolenoidField ( BLCoordinateTransform _global2local,
BLCoil _coil,
G4double  _current 
)

constructor. _zmin/max are global coordinates.

References coil, current, BLCoordinateTransform::getGlobal(), BLCoordinateTransform::getRotation(), global2local, BLCoordinateTransform::isRotated(), BLCoil::maxR, BLCoil::maxZ, BLCoil::minZ, rotation, and BLElementField::setGlobalPoint().

00259                                                   : BLElementField() 
00260 {
00261         coil = _coil;
00262         current = _current;
00263         global2local = _global2local;
00264         rotation = 0;
00265 
00266         if(global2local.isRotated()) {
00267                 rotation = new G4RotationMatrix(global2local.getRotation());
00268                 rotation->invert();
00269         }
00270 
00271         // set global bounding box
00272         G4double local[4], global[4];
00273         local[3] = 0.0;
00274         for(int i=0; i<2; ++i) {
00275                 local[0] = (i==0 ? -1.0 : 1.0) * coil->maxR;
00276                 for(int j=0; j<2; ++j) {
00277                         local[1] = (j==0 ? -1.0 : 1.0) * coil->maxR;
00278                         for(int k=0; k<2; ++k) {
00279                                 local[2] = (k==0 ? coil->minZ : coil->maxZ);
00280                                 global2local.getGlobal(local,global);
00281                                 setGlobalPoint(global);
00282                         }
00283                 }
00284         }
00285 }


Member Function Documentation

void SolenoidField::addFieldValue ( const G4double  point[4],
G4double  field[6] 
) const [virtual]

addFieldValue() adds the field for this solenoid into field[]. Calls coil->addField() after converting to relative coords. point[] is in global coordinates.

Implements BLElementField.

References BLCoil::addField(), B, coil, current, BLCoordinateTransform::getLocal(), global2local, and rotation.

00288 {
00289         G4double relPoint[4];
00290         global2local.getLocal(relPoint,point);
00291         if(rotation) {
00292                 G4double f[6];
00293                 f[0] = f[1] = f[2] = f[3] = f[4] = f[5] = 0.0;
00294                 coil->addField(relPoint,f,current);
00295                 G4ThreeVector B(f[0],f[1],f[2]);
00296                 B = *rotation * B;
00297                 field[0] += B[0];
00298                 field[1] += B[1];
00299                 field[2] += B[2];
00300         } else {
00301                 coil->addField(relPoint,field,current);
00302         }
00303 }


Member Data Documentation

Referenced by addFieldValue(), and SolenoidField().

G4double SolenoidField::current [private]

Referenced by addFieldValue(), and SolenoidField().

G4RotationMatrix* SolenoidField::rotation [private]

Referenced by addFieldValue(), and SolenoidField().


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