Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:01

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 // G4ChargeState
0027 //
0028 // Class description:
0029 //
0030 // Container for magnetic charge and moments.
0031 
0032 // Authors: J.Apostolakis, P.Gumplinger - 10 April 2013  
0033 // -------------------------------------------------------------------
0034 #ifndef G4CHARGESTATE_HH
0035 #define G4CHARGESTATE_HH
0036 
0037 #include "globals.hh"
0038 
0039 class G4ChargeState
0040 {
0041    public:
0042 
0043      inline G4ChargeState(G4double charge,
0044                           G4double magnetic_dipole_moment,
0045                           G4double pdgSpin, 
0046                           G4double electric_dipole_moment = 0.0,
0047                           G4double magnetic_charge = 0.0);
0048 
0049      inline G4ChargeState( const G4ChargeState& right );
0050      inline G4ChargeState& operator = ( const G4ChargeState& right );
0051 
0052      void SetChargeSpinMoments(G4double charge,
0053                                G4double pdgSpin,  
0054                                G4double magnetic_dipole_moment= DBL_MAX,
0055                                G4double electric_dipole_moment= DBL_MAX,
0056                                G4double magnetic_charge= DBL_MAX );
0057        // Revise the charge, pdgSpin, and optionally both moments
0058        // and magnetic charge 
0059 
0060      void SetCharge(G4double charge){ fCharge = charge; }
0061      G4double GetCharge() const { return fCharge; }
0062        // Revise the charge (in units of the positron charge)
0063 
0064 
0065      // Basic Get / Set methods 
0066 
0067      void     SetPDGSpin(G4double spin){ fSpin = spin; }
0068      G4double GetPDGSpin() const { return fSpin; }
0069 
0070      void     SetMagneticDipoleMoment(G4double moment){ fMagn_dipole = moment; }
0071      G4double GetMagneticDipoleMoment() const { return fMagn_dipole; }
0072 
0073      void     SetElectricDipoleMoment(G4double moment){ fElec_dipole = moment; }
0074      G4double ElectricDipoleMoment() const { return fElec_dipole; }
0075 
0076      void     SetMagneticCharge(G4double charge){ fMagneticCharge=charge; }
0077      G4double MagneticCharge() const { return fMagneticCharge; }
0078 
0079      // Auxiliary methods to set several properties at once 
0080 
0081      inline void SetChargeMdm(G4double charge, G4double mag_dipole_moment);
0082        // SetCharge and Magnetic Dipole Moment
0083 
0084      inline void SetChargeMdmSpin(G4double charge,
0085                                   G4double magnetic_dipole_moment,
0086                                   G4double pdgSpin); 
0087 
0088      inline void SetChargeSpin(G4double charge,
0089                                G4double pdgSpin); 
0090 
0091      // Revise the charge, spin and all both moments
0092 
0093      inline void SetChargeDipoleMoments(G4double charge,
0094                                  G4double magnetic_dipole_moment,
0095                                  G4double electric_dipole_moment); 
0096 
0097      inline void SetChargesAndMoments(G4double charge,
0098                                G4double magnetic_dipole_moment, 
0099                                G4double electric_dipole_moment,
0100                                G4double magnetic_charge );
0101    
0102      // Obsolete
0103      //
0104      inline void     SetSpin(G4double spin){ SetPDGSpin( spin); } 
0105      inline G4double GetSpin() const { return GetPDGSpin(); }
0106 
0107    private:
0108 
0109      G4double fCharge;
0110      G4double fSpin;
0111      G4double fMagn_dipole;
0112      G4double fElec_dipole;
0113      G4double fMagneticCharge;  // for magnetic monopole
0114 };
0115 
0116 // Inline methods implementation
0117 
0118 inline G4ChargeState::G4ChargeState(G4double charge,
0119                                     G4double magnetic_dipole_moment,
0120                                     G4double spin,
0121                                     G4double electric_dipole_moment,
0122                                     G4double magnetic_charge)
0123 {
0124    fCharge         = charge;
0125    fSpin           = spin;
0126    fMagn_dipole    = magnetic_dipole_moment;
0127    fElec_dipole    = electric_dipole_moment;
0128    fMagneticCharge = magnetic_charge;
0129 }
0130 
0131 inline G4ChargeState::G4ChargeState( const G4ChargeState& right )
0132 {
0133   fCharge         = right.fCharge;
0134   fSpin           = right.fSpin;
0135   fMagn_dipole    = right.fMagn_dipole;
0136   fElec_dipole    = right.fElec_dipole;
0137   fMagneticCharge = right.fMagneticCharge;
0138 }
0139 
0140 inline G4ChargeState& G4ChargeState::operator = ( const G4ChargeState& right )
0141 {
0142   if (&right == this) { return *this; }
0143 
0144   fCharge         = right.fCharge;
0145   fSpin           = right.fSpin;
0146   fMagn_dipole    = right.fMagn_dipole;
0147   fElec_dipole    = right.fElec_dipole;
0148   fMagneticCharge = right.fMagneticCharge;
0149 
0150   return *this;
0151 }
0152 
0153 inline void G4ChargeState::SetChargeMdm(G4double charge, G4double mdipole_mom)
0154 { 
0155    SetCharge( charge ); 
0156    SetMagneticDipoleMoment( mdipole_mom ); 
0157 } 
0158 
0159 inline void G4ChargeState::SetChargeMdmSpin(G4double charge,
0160                                             G4double magDipoleMoment,
0161                                             G4double pdgSpin)
0162 {
0163    SetChargeMdm( charge, magDipoleMoment ); 
0164    SetPDGSpin( pdgSpin ); 
0165 }
0166 
0167 inline void G4ChargeState::SetChargeSpin(G4double charge,
0168                                          G4double pdgSpin)
0169 {
0170    SetCharge( charge ); 
0171    SetPDGSpin( pdgSpin ); 
0172 }
0173 
0174 inline void 
0175 G4ChargeState::SetChargeDipoleMoments(G4double charge,
0176                                       G4double magneticDM,
0177                                       G4double electricDM)
0178 {
0179    SetChargeMdm( charge, magneticDM ); 
0180    SetElectricDipoleMoment( electricDM ); 
0181 }
0182 
0183 inline void 
0184 G4ChargeState::SetChargesAndMoments(G4double charge,
0185                                     G4double magneticDM,
0186                                     G4double electricDM,
0187                                     G4double magnetic_charge )
0188 {
0189    SetChargeDipoleMoments( charge, magneticDM, electricDM); 
0190    SetMagneticCharge( magnetic_charge ); 
0191 }
0192 #endif