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.

00435                         : global2local(rot,pos), rotation() 
00436 {
00437         factorB = &_factorB;
00438         factorE = &_factorE;
00439         timeOffset = _timeOffset;
00440         map = _map;
00441 
00442         if(global2local.isRotated()) {
00443                 rotation = global2local.getRotation();
00444                 rotation.invert();
00445         }
00446 
00447         // set global bounding box
00448         G4double local[4], global[4];
00449         local[3] = 0.0;
00450         for(int i=0; i<8; ++i) {
00451                 map->getBoundingPoint(i,local);
00452                 global2local.getGlobal(local,global);
00453                 setGlobalPoint(global);
00454         }
00455 }


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.

00459 {
00460         G4double local[4], thisField[6];
00461 
00462         global2local.getLocal(local,point);
00463 
00464         local[3] -= timeOffset;
00465 
00466         map->getFieldValue(local,thisField,*factorB,*factorE);
00467 
00468         if(map->hasB()) {
00469                 if(!rotation.isIdentity()) {
00470                         G4ThreeVector B(thisField[0],thisField[1],thisField[2]);
00471                         B = rotation * B;
00472                         field[0] += B[0];
00473                         field[1] += B[1];
00474                         field[2] += B[2];
00475                 } else {
00476                         field[0] += thisField[0];
00477                         field[1] += thisField[1];
00478                         field[2] += thisField[2];
00479                 }
00480         }
00481 
00482         if(map->hasE()) {
00483                 if(!rotation.isIdentity()) {
00484                         G4ThreeVector E(thisField[3],thisField[4],thisField[5]);
00485                         E = rotation * E;
00486                         field[3] += E[0];
00487                         field[4] += E[1];
00488                         field[5] += E[2];
00489                 } else {
00490                         field[3] += thisField[3];
00491                         field[4] += thisField[4];
00492                         field[5] += thisField[5];
00493                 }
00494         }
00495 }


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