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.

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


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.

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


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