FieldExprPlacement Class Reference

Inheritance diagram for FieldExprPlacement:

BLElementField

List of all members.

Public Member Functions

 FieldExprPlacement (BLFieldMap *_map, G4RotationMatrix *rot, G4ThreeVector &pos, G4double &_factorB, G4double &_factorE, G4double _timeOffset)
void addFieldValue (const G4double point[4], G4double field[6]) const

Private Attributes

BLCoordinateTransform global2local
G4RotationMatrix rotation
G4double * factorB
G4double * factorE
G4double timeOffset
BLFieldMapmap


Constructor & Destructor Documentation

FieldExprPlacement::FieldExprPlacement ( BLFieldMap _map,
G4RotationMatrix *  rot,
G4ThreeVector &  pos,
G4double &  _factorB,
G4double &  _factorE,
G4double  _timeOffset 
)

References factorB, factorE, BLFieldMap::getBoundingPoint(), BLCoordinateTransform::getGlobal(), BLCoordinateTransform::getRotation(), global2local, BLCoordinateTransform::isRotated(), map, rotation, BLElementField::setGlobalPoint(), and timeOffset.

00448                         : global2local(rot,pos), rotation() 
00449 {
00450         factorB = &_factorB;
00451         factorE = &_factorE;
00452         timeOffset = _timeOffset;
00453         map = _map;
00454 
00455         if(global2local.isRotated()) {
00456                 rotation = global2local.getRotation();
00457                 rotation.invert();
00458         }
00459 
00460         // set global bounding box
00461         G4double local[4], global[4];
00462         local[3] = 0.0;
00463         for(int i=0; i<8; ++i) {
00464                 map->getBoundingPoint(i,local);
00465                 global2local.getGlobal(local,global);
00466                 setGlobalPoint(global);
00467         }
00468 }


Member Function Documentation

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

Implements BLElementField.

References B, E, factorB, factorE, BLFieldMap::getFieldValue(), BLCoordinateTransform::getLocal(), global2local, BLFieldMap::hasB(), BLFieldMap::hasE(), map, rotation, and timeOffset.

00472 {
00473         G4double local[4], thisField[6];
00474 
00475         global2local.getLocal(local,point);
00476 
00477         local[3] -= timeOffset;
00478 
00479         map->getFieldValue(local,thisField,*factorB,*factorE);
00480 
00481         if(map->hasB()) {
00482                 if(!rotation.isIdentity()) {
00483                         G4ThreeVector B(thisField[0],thisField[1],thisField[2]);
00484                         B = rotation * B;
00485                         field[0] += B[0];
00486                         field[1] += B[1];
00487                         field[2] += B[2];
00488                 } else {
00489                         field[0] += thisField[0];
00490                         field[1] += thisField[1];
00491                         field[2] += thisField[2];
00492                 }
00493         }
00494 
00495         if(map->hasE()) {
00496                 if(!rotation.isIdentity()) {
00497                         G4ThreeVector E(thisField[3],thisField[4],thisField[5]);
00498                         E = rotation * E;
00499                         field[3] += E[0];
00500                         field[4] += E[1];
00501                         field[5] += E[2];
00502                 } else {
00503                         field[3] += thisField[3];
00504                         field[4] += thisField[4];
00505                         field[5] += thisField[5];
00506                 }
00507         }
00508 }


Member Data Documentation

G4RotationMatrix FieldExprPlacement::rotation [private]

G4double* FieldExprPlacement::factorB [private]

G4double* FieldExprPlacement::factorE [private]

G4double FieldExprPlacement::timeOffset [private]


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