Public Member Functions | |
LiLensField (G4double _radius, G4double _length, G4double _current, G4RotationMatrix *rot, G4ThreeVector &pos) | |
void | addFieldValue (const G4double point[4], G4double field[6]) const |
Private Attributes | |
BLCoordinateTransform | global2local |
G4RotationMatrix | rotation |
G4double | radius |
G4double | length |
G4double | current |
LiLensField::LiLensField | ( | G4double | _radius, | |
G4double | _length, | |||
G4double | _current, | |||
G4RotationMatrix * | rot, | |||
G4ThreeVector & | pos | |||
) |
References BLGlobalField::addElementField(), current, BLGlobalField::getObject(), BLCoordinateTransform::getRotation(), global2local, BLCoordinateTransform::isRotated(), length, radius, and rotation.
00244 : global2local(rot,pos), rotation(*rot) 00245 { 00246 radius = _radius; 00247 length = _length; 00248 current = _current; 00249 00250 if(global2local.isRotated()) { 00251 rotation = global2local.getRotation(); 00252 rotation.invert(); 00253 } 00254 00255 // keep default infinite bounding box 00256 00257 BLGlobalField::getObject()->addElementField(this); 00258 }
void LiLensField::addFieldValue | ( | const G4double | point[4], | |
G4double | field[6] | |||
) | const [virtual] |
Implements BLElementField.
References B, current, BLCoordinateTransform::getLocal(), global2local, length, radius, and rotation.
00261 { 00262 G4double local[4], thisField[6]; 00263 00264 global2local.getLocal(local,point); 00265 if(fabs(local[2]) > length/2.0) return; 00266 00267 double r=sqrt(local[0]*local[0]+local[1]*local[1]); 00268 double phi=atan2(local[1],local[0]); 00269 00270 // A current of 1 A at a radius 1 mm has a field 0.00019999 T. 00271 // For current along +z and x>0, B is in the +y direction. 00272 double Bmax = 0.00019999*tesla*current/(radius/mm); 00273 G4ThreeVector B(0.0,0.0,0.0); 00274 if(r < radius) 00275 B[1] = Bmax * r / radius; 00276 else 00277 B[1] = Bmax * radius / r; 00278 00279 B[0] = -B[1] * sin(phi); 00280 B[1] = B[1] * cos(phi); 00281 00282 if(!rotation.isIdentity()) B = rotation * B; 00283 00284 field[0] += B[0]; 00285 field[1] += B[1]; 00286 field[2] += B[2]; 00287 }
Referenced by addFieldValue(), and LiLensField().
G4RotationMatrix LiLensField::rotation [private] |
Referenced by addFieldValue(), and LiLensField().
G4double LiLensField::radius [private] |
Referenced by addFieldValue(), and LiLensField().
G4double LiLensField::length [private] |
Referenced by addFieldValue(), and LiLensField().
G4double LiLensField::current [private] |
Referenced by addFieldValue(), and LiLensField().