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.

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


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.

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


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