Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:17

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 //
0027 /// \file field/field04/include/F04SimpleSolenoid.hh
0028 /// \brief Definition of the F04SimpleSolenoid class
0029 //
0030 
0031 #ifndef F04SimpleSolenoid_h
0032 #define F04SimpleSolenoid_h 1
0033 
0034 #include "F04ElementField.hh"
0035 #include "F04GlobalField.hh"
0036 
0037 #include "G4LogicalVolume.hh"
0038 #include "G4Tubs.hh"
0039 
0040 //  F04SimpleSolenoid implements a solenoid magnet with a constant
0041 //  cylindrical magnetic field in z-direction
0042 
0043 class F04SimpleSolenoid : public F04ElementField
0044 {
0045   public:
0046     ///  Default constructor.
0047     F04SimpleSolenoid(G4double, G4double, G4LogicalVolume*, G4ThreeVector);
0048 
0049     ///  Destructor.
0050     ~F04SimpleSolenoid() override = default;
0051 
0052     ///  GetLength() returns the length of the solenoid
0053     G4double GetLength() override { return fFieldLength; }
0054 
0055     ///  GetWidth() returns the solenoid diameter
0056     G4double GetWidth() override { return fFieldRadius * 2.0; }
0057 
0058     ///  GetHeight() returns the solenoid diameter
0059     G4double GetHeight() override { return fFieldRadius * 2.0; }
0060 
0061     /// SetFringeZ(G4double) sets the solenoid fringe field z-length
0062     void SetFringeZ(G4double z) { fFringeZ = z; }
0063 
0064     /// GetFringeZ() returns the solenoid fringe field z-length
0065     G4double GetFringeZ() { return fFringeZ; }
0066 
0067     ///  IsOutside() returns true when outside the solenoid
0068     G4bool IsOutside(G4ThreeVector& local) const;
0069 
0070     /// IsWithin() returns true when inside the solenoid
0071     G4bool IsWithin(G4ThreeVector& local) const;
0072 
0073     ///  AddFieldValue() adds the field for this solenoid into field[].
0074     ///  point[] is in global coordinates.
0075     void AddFieldValue(const G4double point[4], G4double field[6]) const override;
0076 
0077   private:
0078     G4double fBfield = 0.;
0079 
0080     G4double fFringeZ = 0.;
0081 
0082     G4double fFieldLength = 0.;
0083     G4double fFieldRadius = 0.;
0084 };
0085 
0086 #endif