Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ChargeState.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4ChargeState
27//
28// Class description:
29//
30// Container for magnetic charge and moments.
31
32// Authors: J.Apostolakis, P.Gumplinger - 10 April 2013
33// -------------------------------------------------------------------
34#ifndef G4CHARGESTATE_HH
35#define G4CHARGESTATE_HH
36
37#include "globals.hh"
38
39class G4ChargeState // Charge & moments
40{
41 public: // without description
42
43 inline G4ChargeState(G4double charge,
44 G4double magnetic_dipole_moment,
45 G4double pdgSpin,
46 G4double electric_dipole_moment = 0.0,
47 G4double magnetic_charge = 0.0);
48
49 inline G4ChargeState( const G4ChargeState& right );
50 inline G4ChargeState& operator = ( const G4ChargeState& right );
51
53 G4double pdgSpin,
54 G4double magnetic_dipole_moment= DBL_MAX,
55 G4double electric_dipole_moment= DBL_MAX,
56 G4double magnetic_charge= DBL_MAX );
57 // Revise the charge, pdgSpin, and optionally both moments
58 // and magnetic charge
59
60 void SetCharge(G4double charge){ fCharge = charge; }
61 G4double GetCharge() const { return fCharge; }
62 // Revise the charge (in units of the positron charge)
63
64
65 // Basic Get / Set methods
66
67 void SetPDGSpin(G4double spin){ fSpin = spin; }
68 G4double GetPDGSpin() const { return fSpin; }
69
70 void SetMagneticDipoleMoment(G4double moment){ fMagn_dipole = moment; }
71 G4double GetMagneticDipoleMoment() const { return fMagn_dipole; }
72
73 void SetElectricDipoleMoment(G4double moment){ fElec_dipole = moment; }
74 G4double ElectricDipoleMoment() const { return fElec_dipole; }
75
76 void SetMagneticCharge(G4double charge){ fMagneticCharge=charge; }
77 G4double MagneticCharge() const { return fMagneticCharge; }
78
79 // Auxiliary methods to set several properties at once
80
81 inline void SetChargeMdm(G4double charge, G4double mag_dipole_moment);
82 // SetCharge and Magnetic Dipole Moment
83
84 inline void SetChargeMdmSpin(G4double charge,
85 G4double magnetic_dipole_moment,
86 G4double pdgSpin);
87
88 inline void SetChargeSpin(G4double charge,
89 G4double pdgSpin);
90
91 // Revise the charge, spin and all both moments
92
93 inline void SetChargeDipoleMoments(G4double charge,
94 G4double magnetic_dipole_moment,
95 G4double electric_dipole_moment);
96
97 inline void SetChargesAndMoments(G4double charge,
98 G4double magnetic_dipole_moment,
99 G4double electric_dipole_moment,
100 G4double magnetic_charge );
101
102 public: // Obsolete
103
104 inline void SetSpin(G4double spin){ SetPDGSpin( spin); }
105 inline G4double GetSpin() const { return GetPDGSpin(); }
106
107 private:
108
109 G4double fCharge;
110 G4double fSpin;
111 G4double fMagn_dipole;
112 G4double fElec_dipole;
113 G4double fMagneticCharge; // for magnetic monopole
114};
115
116// Inline methods implementation
117
119 G4double magnetic_dipole_moment,
120 G4double spin,
121 G4double electric_dipole_moment,
122 G4double magnetic_charge)
123{
124 fCharge = charge;
125 fSpin = spin;
126 fMagn_dipole = magnetic_dipole_moment;
127 fElec_dipole = electric_dipole_moment;
128 fMagneticCharge = magnetic_charge;
129}
130
132{
133 fCharge = right.fCharge;
134 fSpin = right.fSpin;
135 fMagn_dipole = right.fMagn_dipole;
136 fElec_dipole = right.fElec_dipole;
137 fMagneticCharge = right.fMagneticCharge;
138}
139
141{
142 if (&right == this) return *this;
143
144 fCharge = right.fCharge;
145 fSpin = right.fSpin;
146 fMagn_dipole = right.fMagn_dipole;
147 fElec_dipole = right.fElec_dipole;
148 fMagneticCharge = right.fMagneticCharge;
149
150 return *this;
151}
152
153inline void G4ChargeState::SetChargeMdm(G4double charge, G4double mdipole_mom)
154{
155 SetCharge( charge );
156 SetMagneticDipoleMoment( mdipole_mom );
157}
158
160 G4double magDipoleMoment,
161 G4double pdgSpin)
162{
163 SetChargeMdm( charge, magDipoleMoment );
164 SetPDGSpin( pdgSpin );
165}
166
168 G4double pdgSpin)
169{
170 SetCharge( charge );
171 SetPDGSpin( pdgSpin );
172}
173
174inline void
176 G4double magneticDM,
177 G4double electricDM)
178{
179 SetChargeMdm( charge, magneticDM );
180 SetElectricDipoleMoment( electricDM );
181}
182
183inline void
185 G4double magneticDM,
186 G4double electricDM,
187 G4double magnetic_charge )
188{
189 SetChargeDipoleMoments( charge, magneticDM, electricDM);
190 SetMagneticCharge( magnetic_charge );
191}
192#endif
double G4double
Definition: G4Types.hh:83
G4ChargeState & operator=(const G4ChargeState &right)
void SetMagneticCharge(G4double charge)
G4ChargeState(G4double charge, G4double magnetic_dipole_moment, G4double pdgSpin, G4double electric_dipole_moment=0.0, G4double magnetic_charge=0.0)
void SetSpin(G4double spin)
void SetChargeSpinMoments(G4double charge, G4double pdgSpin, G4double magnetic_dipole_moment=DBL_MAX, G4double electric_dipole_moment=DBL_MAX, G4double magnetic_charge=DBL_MAX)
void SetChargesAndMoments(G4double charge, G4double magnetic_dipole_moment, G4double electric_dipole_moment, G4double magnetic_charge)
void SetChargeSpin(G4double charge, G4double pdgSpin)
G4double GetCharge() const
void SetPDGSpin(G4double spin)
G4double ElectricDipoleMoment() const
void SetChargeMdm(G4double charge, G4double mag_dipole_moment)
void SetElectricDipoleMoment(G4double moment)
G4double GetMagneticDipoleMoment() const
void SetChargeMdmSpin(G4double charge, G4double magnetic_dipole_moment, G4double pdgSpin)
G4double GetPDGSpin() const
G4double GetSpin() const
void SetChargeDipoleMoments(G4double charge, G4double magnetic_dipole_moment, G4double electric_dipole_moment)
G4double MagneticCharge() const
void SetCharge(G4double charge)
void SetMagneticDipoleMoment(G4double moment)
#define DBL_MAX
Definition: templates.hh:62