Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "F04GlobalField.hh"
|
||||
|
||||
#include "F04SimpleSolenoid.hh"
|
||||
|
||||
F04SimpleSolenoid::F04SimpleSolenoid(G4double Bz, G4double fz,
|
||||
G4LogicalVolume* lv,
|
||||
G4ThreeVector c) : F04ElementField(c,lv)
|
||||
{
|
||||
Bfield = Bz;
|
||||
fringeZ = fz;
|
||||
|
||||
fieldLength = 2.*((G4Tubs*)lvolume->GetSolid())->GetZHalfLength()+fringeZ;
|
||||
fieldRadius = ((G4Tubs*)lvolume->GetSolid())->GetOuterRadius();
|
||||
}
|
||||
|
||||
void F04SimpleSolenoid::addFieldValue(const G4double point[4],
|
||||
G4double field[6]) const
|
||||
{
|
||||
G4ThreeVector global(point[0],point[1],point[2]);
|
||||
G4ThreeVector local;
|
||||
|
||||
local = global2local.TransformPoint(global);
|
||||
|
||||
if (isOutside(local)) return;
|
||||
|
||||
G4ThreeVector B(0.0,0.0,Bfield);
|
||||
|
||||
B = global2local.Inverse().TransformAxis(B);
|
||||
|
||||
field[0] += B[0];
|
||||
field[1] += B[1];
|
||||
field[2] += B[2];
|
||||
}
|
||||
|
||||
G4bool F04SimpleSolenoid::isOutside(G4ThreeVector& local) const
|
||||
{
|
||||
// EInside inside = tubs->Inside(local);
|
||||
// return (inside == kOutside);
|
||||
G4double r = std::sqrt(local.x()*local.x()+local.y()*local.y());
|
||||
return (r > fieldRadius || std::fabs(local.z()) > fieldLength/2.0);
|
||||
}
|
||||
|
||||
G4bool F04SimpleSolenoid::isWithin(G4ThreeVector& local) const
|
||||
{
|
||||
// EInside inside = tubs->Inside(local);
|
||||
// return (inside == kInside);
|
||||
G4double r = std::sqrt(local.x()*local.x()+local.y()*local.y());
|
||||
return (r < fieldRadius && std::fabs(local.z()) < fieldLength/2.0);
|
||||
}
|
||||
Reference in New Issue
Block a user