IdealSectorBendField Class Reference

Inheritance diagram for IdealSectorBendField:

BLElementField

List of all members.


Detailed Description

IdealSectorBendField represents one placement of a ideal sector bending magnet.

Public Member Functions

 IdealSectorBendField (BLCoordinateTransform &_global2local, BLCMDidealsectorbend *bend)
 constructor.
void addFieldValue (const G4double point[4], G4double field[6]) const
 addFieldValue() adds the field for this solenoid into field[]. point[] is in global coordinates.

Private Attributes

BLCoordinateTransform global2local
G4double * By
G4RotationMatrix rotation
G4double r2min
G4double r2max
G4double halfheight
G4double tanangle

Constructor & Destructor Documentation

IdealSectorBendField::IdealSectorBendField ( BLCoordinateTransform _global2local,
BLCMDidealsectorbend bend 
)

constructor.

References BLCMDidealsectorbend::angle, BLCMDidealsectorbend::By, By, BLCMDidealsectorbend::fieldHeight, BLCMDidealsectorbend::fieldInnerRadius, BLCMDidealsectorbend::fieldOuterRadius, BLCoordinateTransform::getRotation(), global2local, halfheight, r2max, r2min, rotation, and tanangle.

00352                        : BLElementField(), global2local(), rotation()
00353 {
00354         global2local = _global2local;
00355         By = &bend->By;
00356         rotation = global2local.getRotation().inverse();
00357         r2min = bend->fieldInnerRadius;
00358         r2max = bend->fieldOuterRadius;
00359         r2min *= r2min;
00360         r2max *= r2max;
00361         halfheight = bend->fieldHeight/2.0;
00362         tanangle = tan(bend->angle);
00363 
00364         // too complicated to figure out the bounding box, for now...
00365 }


Member Function Documentation

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

addFieldValue() adds the field for this solenoid into field[]. point[] is in global coordinates.

Implements BLElementField.

References B, By, BLCoordinateTransform::getLocal(), global2local, halfheight, BLCoordinateTransform::isRotated(), r2max, rotation, and tanangle.

00368 {
00369         G4ThreeVector global(point[0],point[1],point[2]);
00370         G4ThreeVector local;
00371 
00372         global2local.getLocal(local,global);
00373         G4double r2 = local[0]*local[0] + local[2]*local[2];
00374         if(fabs(local[1]) > halfheight || r2 < r2min || r2 > r2max)
00375                 return;
00376         if(tanangle > 0.0) {
00377                 if(local[0] > 0.0 || local[2] < 0.0 || 
00378                    local[2] > -local[0]*tanangle)
00379                         return;
00380         } else {
00381                 if(local[0] < 0.0 || local[2] < 0.0 || 
00382                    local[2] > -local[0]*tanangle)
00383                         return;
00384         }
00385 
00386         G4ThreeVector B(0.0,*By,0.0);
00387         if(global2local.isRotated())
00388                 B = rotation * B;
00389         field[0] += B[0];
00390         field[1] += B[1];
00391         field[2] += B[2];
00392 }


Member Data Documentation

G4double* IdealSectorBendField::By [private]

G4RotationMatrix IdealSectorBendField::rotation [private]

G4double IdealSectorBendField::r2min [private]

Referenced by IdealSectorBendField().

G4double IdealSectorBendField::r2max [private]

G4double IdealSectorBendField::tanangle [private]


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