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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 
 39 class G4ChargeState
 40 {
 41    public:
 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 
 52      void SetChargeSpinMoments(G4double charge,
 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      // 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 
118 inline G4ChargeState::G4ChargeState(G4double charge,
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 
131 inline G4ChargeState::G4ChargeState( const G4ChargeState& right )
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 
140 inline G4ChargeState& G4ChargeState::operator = ( const G4ChargeState& right )
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 
153 inline void G4ChargeState::SetChargeMdm(G4double charge, G4double mdipole_mom)
154 { 
155    SetCharge( charge ); 
156    SetMagneticDipoleMoment( mdipole_mom ); 
157 } 
158 
159 inline void G4ChargeState::SetChargeMdmSpin(G4double charge,
160                                             G4double magDipoleMoment,
161                                             G4double pdgSpin)
162 {
163    SetChargeMdm( charge, magDipoleMoment ); 
164    SetPDGSpin( pdgSpin ); 
165 }
166 
167 inline void G4ChargeState::SetChargeSpin(G4double charge,
168                                          G4double pdgSpin)
169 {
170    SetCharge( charge ); 
171    SetPDGSpin( pdgSpin ); 
172 }
173 
174 inline void 
175 G4ChargeState::SetChargeDipoleMoments(G4double charge,
176                                       G4double magneticDM,
177                                       G4double electricDM)
178 {
179    SetChargeMdm( charge, magneticDM ); 
180    SetElectricDipoleMoment( electricDM ); 
181 }
182 
183 inline void 
184 G4ChargeState::SetChargesAndMoments(G4double charge,
185                                     G4double magneticDM,
186                                     G4double electricDM,
187                                     G4double magnetic_charge )
188 {
189    SetChargeDipoleMoments( charge, magneticDM, electricDM); 
190    SetMagneticCharge( magnetic_charge ); 
191 }
192 #endif
193