|
|
|||
File indexing completed on 2026-09-15 08:28:41
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file F04SimpleSolenoid.cc 0027 /// \brief Implementation of the F04SimpleSolenoid class 0028 0029 #include "F04SimpleSolenoid.hh" 0030 0031 #include "F04GlobalField.hh" 0032 0033 #include "G4GeometryManager.hh" 0034 #include "globals.hh" 0035 0036 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0037 0038 F04SimpleSolenoid::F04SimpleSolenoid(G4double Bz, G4double fz, G4LogicalVolume* lv, G4ThreeVector c) 0039 : F04ElementField(c, lv), 0040 fBfield(Bz), 0041 fFringeZ(fz), 0042 fFieldLength(2. * ((G4Tubs*)fVolume->GetSolid())->GetZHalfLength() + fFringeZ), 0043 fFieldRadius(((G4Tubs*)fVolume->GetSolid())->GetOuterRadius()) 0044 {} 0045 0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0047 0048 void F04SimpleSolenoid::AddFieldValue(const G4double point[4], G4double field[6]) const 0049 { 0050 G4ThreeVector global(point[0], point[1], point[2]); 0051 G4ThreeVector local; 0052 0053 local = fGlobal2local.TransformPoint(global); 0054 0055 if (IsOutside(local)) return; 0056 0057 G4ThreeVector B(0.0, 0.0, fBfield); 0058 0059 B = fGlobal2local.Inverse().TransformAxis(B); 0060 0061 field[0] += B[0]; 0062 field[1] += B[1]; 0063 field[2] += B[2]; 0064 } 0065 0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0067 0068 G4bool F04SimpleSolenoid::IsOutside(G4ThreeVector& local) const 0069 { 0070 // EInside inside = tubs->Inside(local); 0071 // return (inside == kOutside); 0072 G4double r = std::sqrt(local.x() * local.x() + local.y() * local.y()); 0073 return (r > fFieldRadius || std::fabs(local.z()) > fFieldLength / 2.0); 0074 } 0075 0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0077 0078 G4bool F04SimpleSolenoid::IsWithin(G4ThreeVector& local) const 0079 { 0080 // EInside inside = tubs->Inside(local); 0081 // return (inside == kInside); 0082 G4double r = std::sqrt(local.x() * local.x() + local.y() * local.y()); 0083 return (r < fFieldRadius && std::fabs(local.z()) < fFieldLength / 2.0); 0084 }
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|