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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 ]

Diff markup

Differences between /track/include/G4ParticleChangeForLoss.hh (Version 11.3.0) and /track/include/G4ParticleChangeForLoss.hh (Version 9.0.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4ParticleChangeForLoss                     << 
 27 //                                                 26 //
 28 // Class description:                          <<  27 // $Id: G4ParticleChangeForLoss.hh,v 1.19 2006/08/28 16:10:06 vnivanch Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-08-03-patch-01 $
 29 //                                                 29 //
 30 // Concrete class for ParticleChange for Energ <<  30 //
 31                                                <<  31 // ------------------------------------------------------------
 32 // Author: Hisaya Kurashige, 23 March 1998     <<  32 //  GEANT 4 class header file
 33 // Revision: Vladimir Ivantchenko, 16 January  <<  33 //
 34 //                                 24 August 2 <<  34 //
 35 // ------------------------------------------- <<  35 // ------------------------------------------------------------
 36 #ifndef G4ParticleChangeForLoss_hh             <<  36 //   Implemented for the new scheme                 23 Mar. 1998  H.Kurahige
 37 #define G4ParticleChangeForLoss_hh 1           <<  37 //
                                                   >>  38 //   Modified:
                                                   >>  39 //   16.01.04 V.Ivanchenko update for model variant of energy loss
                                                   >>  40 //   15.04.05 V.Ivanchenko inline update methods
                                                   >>  41 //   30.01.06 V.Ivanchenko add ProposedMomentumDirection for AlongStep
                                                   >>  42 //                         and ProposeWeight for PostStep
                                                   >>  43 //   07.06.06 V.Ivanchenko RemoveProposedMomentumDirection from AlongStep
                                                   >>  44 //   28.08.06 V.Ivanchenko Add access to current track and polarizaion
                                                   >>  45 //
                                                   >>  46 // ------------------------------------------------------------
                                                   >>  47 //
                                                   >>  48 //  Class Description
                                                   >>  49 //  This class is a concrete class for ParticleChange for EnergyLoss
                                                   >>  50 //
                                                   >>  51 #ifndef G4ParticleChangeForLoss_h
                                                   >>  52 #define G4ParticleChangeForLoss_h 1
 38                                                    53 
                                                   >>  54 #include "globals.hh"
                                                   >>  55 #include "G4ios.hh"
 39 #include "G4VParticleChange.hh"                    56 #include "G4VParticleChange.hh"
 40 #include "G4DynamicParticle.hh"                << 
 41                                                    57 
 42 class G4ParticleChangeForLoss final : public G <<  58 class G4DynamicParticle;
                                                   >>  59 
                                                   >>  60 class G4ParticleChangeForLoss: public G4VParticleChange
 43 {                                                  61 {
 44 public:                                            62 public:
 45                                                <<  63   // default constructor
 46   G4ParticleChangeForLoss();                       64   G4ParticleChangeForLoss();
 47                                                    65 
 48   ~G4ParticleChangeForLoss() override = defaul <<  66   // destructor
 49                                                <<  67   virtual ~G4ParticleChangeForLoss();
 50   G4ParticleChangeForLoss(const G4ParticleChan << 
 51   G4ParticleChangeForLoss& operator=(const G4P << 
 52                                                    68 
                                                   >>  69   // with description
                                                   >>  70   // ----------------------------------------------------
 53   // --- the following methods are for updatin     71   // --- the following methods are for updating G4Step -----
 54                                                    72 
 55   G4Step* UpdateStepForAlongStep(G4Step* step) <<  73   G4Step* UpdateStepForAlongStep(G4Step* Step);
 56   G4Step* UpdateStepForPostStep(G4Step* step)  <<  74   G4Step* UpdateStepForPostStep(G4Step* Step);
 57                                                <<  75   // A physics process gives the final state of the particle
 58   // Initialize all used properties            <<  76   // based on information of G4Track
 59   inline void InitializeForAlongStep(const G4T <<  77 
 60   inline void InitializeForPostStep(const G4Tr <<  78   void InitializeForAlongStep(const G4Track&);
 61                                                <<  79   void InitializeForPostStep(const G4Track&);
 62   // Get/Set dynamic charge                    <<  80   //Initialize all propoerties by using G4Track information
 63   inline G4double GetProposedCharge() const;   <<  81 
 64   inline void SetProposedCharge(G4double theCh <<  82   void AddSecondary(G4DynamicParticle* aParticle);
 65                                                <<  83   // Add next secondary
 66   // Get/Set the final kinetic energy of the c <<  84 
 67   inline G4double GetProposedKineticEnergy() c <<  85   G4double GetProposedCharge() const;
 68   inline void SetProposedKineticEnergy(G4doubl <<  86   void SetProposedCharge(G4double theCharge);
 69                                                <<  87   //   Get/Set theCharge
 70   // Get/Propose the MomentumDirection vector: <<  88 
 71   // direction                                 <<  89   G4double GetCharge() const;
 72   inline const G4ThreeVector& GetProposedMomen <<  90   void ProposeCharge(G4double finalCharge);
 73   inline void SetProposedMomentumDirection(con <<  91   //   Get/Propose the final dynamical Charge in G4DynamicParticle
 74   inline void ProposeMomentumDirection(const G <<  92 
 75                                                <<  93   G4double GetProposedKineticEnergy() const;
 76   inline const G4ThreeVector& GetProposedPolar <<  94   void SetProposedKineticEnergy(G4double proposedKinEnergy);
 77   inline void ProposePolarization(const G4Thre <<  95   // Get/Set the final kinetic energy of the current particle.
 78   inline void ProposePolarization(G4double Px, <<  96 
 79                                                <<  97   const G4ThreeVector& GetProposedMomentumDirection() const;
 80   void DumpInfo() const final;                 <<  98   void SetProposedMomentumDirection(const G4ThreeVector& dir);
                                                   >>  99   const G4ThreeVector& GetMomentumDirection() const;
                                                   >> 100   void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz);
                                                   >> 101   void ProposeMomentumDirection(const G4ThreeVector& Pfinal);
                                                   >> 102   // Get/Propose the MomentumDirection vector: it is the final momentum direction.
                                                   >> 103 
                                                   >> 104   const G4ThreeVector& GetProposedPolarization() const;
                                                   >> 105   void ProposePolarization(const G4ThreeVector& dir);
                                                   >> 106   void ProposePolarization(G4double Px, G4double Py, G4double Pz);
                                                   >> 107 
                                                   >> 108   const G4Track* GetCurrentTrack() const;
                                                   >> 109 
                                                   >> 110   virtual void DumpInfo() const;
                                                   >> 111 
                                                   >> 112   // for Debug
                                                   >> 113   virtual G4bool CheckIt(const G4Track&);
                                                   >> 114 
                                                   >> 115 protected:
                                                   >> 116   // hide copy constructor and assignment operaor as protected
                                                   >> 117   G4ParticleChangeForLoss(const G4ParticleChangeForLoss &right);
                                                   >> 118   G4ParticleChangeForLoss & operator=(const G4ParticleChangeForLoss &right);
 81                                                   119 
 82 private:                                          120 private:
 83                                                   121 
 84   G4double proposedKinEnergy = 0.0;            << 122   const G4Track* currentTrack;
 85   // The final kinetic energy of the current p << 123   // The pointer to G4Track
 86                                                   124 
 87   G4double currentCharge = 0.0;                << 125   G4double proposedKinEnergy;
 88       // The final charge of the current parti << 126   //  The final kinetic energy of the current particle.
                                                   >> 127 
                                                   >> 128   G4double currentCharge;
                                                   >> 129   //  The final charge of the current particle.
 89                                                   130 
 90   G4ThreeVector proposedMomentumDirection;        131   G4ThreeVector proposedMomentumDirection;
 91   // The final momentum direction of the curre << 132   //  The final momentum direction of the current particle.
 92                                                   133 
 93   G4ThreeVector proposedPolarization;             134   G4ThreeVector proposedPolarization;
 94   // The final polarization of the current par << 135   //  The final polarization of the current particle.
 95 };                                                136 };
 96                                                   137 
 97 // ----------------------                      << 138 // ------------------------------------------------------------
 98 // Inline methods                              << 
 99 // ----------------------                      << 
100                                                   139 
101 inline                                         << 140 inline G4double G4ParticleChangeForLoss::GetProposedKineticEnergy() const
102 G4double G4ParticleChangeForLoss::GetProposedK << 
103 {                                                 141 {
104   return proposedKinEnergy;                       142   return proposedKinEnergy;
105 }                                                 143 }
106                                                   144 
107 inline                                         << 145 inline void G4ParticleChangeForLoss::SetProposedKineticEnergy(G4double energy)
108 void G4ParticleChangeForLoss::SetProposedKinet << 
109 {                                                 146 {
110   proposedKinEnergy = energy;                     147   proposedKinEnergy = energy;
111 }                                                 148 }
112                                                   149 
113 inline G4double G4ParticleChangeForLoss::GetPr    150 inline G4double G4ParticleChangeForLoss::GetProposedCharge() const
114 {                                                 151 {
115   return currentCharge;                           152   return currentCharge;
116 }                                                 153 }
117                                                   154 
118 inline                                         << 155 inline G4double G4ParticleChangeForLoss::GetCharge() const
119 void G4ParticleChangeForLoss::SetProposedCharg << 156 {
                                                   >> 157   return currentCharge;
                                                   >> 158 }
                                                   >> 159 
                                                   >> 160 inline void G4ParticleChangeForLoss::SetProposedCharge(G4double theCharge)
                                                   >> 161 {
                                                   >> 162   currentCharge = theCharge;
                                                   >> 163 }
                                                   >> 164 
                                                   >> 165 inline void G4ParticleChangeForLoss::ProposeCharge(G4double theCharge)
120 {                                                 166 {
121   currentCharge = theCharge;                      167   currentCharge = theCharge;
122 }                                                 168 }
123                                                   169 
124 inline                                            170 inline
125 const G4ThreeVector&                           << 171  const G4ThreeVector& G4ParticleChangeForLoss::GetProposedMomentumDirection() const
126 G4ParticleChangeForLoss::GetProposedMomentumDi << 
127 {                                                 172 {
128   return proposedMomentumDirection;               173   return proposedMomentumDirection;
129 }                                                 174 }
130                                                   175 
131 inline                                            176 inline
132 void G4ParticleChangeForLoss::ProposeMomentumD << 177  const G4ThreeVector& G4ParticleChangeForLoss::GetMomentumDirection() const
                                                   >> 178 {
                                                   >> 179   return proposedMomentumDirection;
                                                   >> 180 }
                                                   >> 181 
                                                   >> 182 inline
                                                   >> 183  void G4ParticleChangeForLoss::ProposeMomentumDirection(const G4ThreeVector& dir)
133 {                                                 184 {
134   proposedMomentumDirection = dir;                185   proposedMomentumDirection = dir;
135 }                                                 186 }
136                                                   187 
137 inline                                            188 inline
138 void                                           << 189  void G4ParticleChangeForLoss::SetProposedMomentumDirection(const G4ThreeVector& dir)
139 G4ParticleChangeForLoss::SetProposedMomentumDi << 
140 {                                                 190 {
141   proposedMomentumDirection = dir;                191   proposedMomentumDirection = dir;
142 }                                                 192 }
143                                                   193 
144 inline                                            194 inline
145 const G4ThreeVector& G4ParticleChangeForLoss:: << 195  void G4ParticleChangeForLoss::ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
                                                   >> 196 {
                                                   >> 197   proposedMomentumDirection.setX(Px);
                                                   >> 198   proposedMomentumDirection.setY(Py);
                                                   >> 199   proposedMomentumDirection.setZ(Pz);
                                                   >> 200 }
                                                   >> 201 
                                                   >> 202 inline const G4Track* G4ParticleChangeForLoss::GetCurrentTrack() const
                                                   >> 203 {
                                                   >> 204   return currentTrack;
                                                   >> 205 }
                                                   >> 206 
                                                   >> 207 inline
                                                   >> 208  const G4ThreeVector& G4ParticleChangeForLoss::GetProposedPolarization() const
146 {                                                 209 {
147   return proposedPolarization;                    210   return proposedPolarization;
148 }                                                 211 }
149                                                   212 
150 inline                                            213 inline
151 void G4ParticleChangeForLoss::ProposePolarizat << 214  void G4ParticleChangeForLoss::ProposePolarization(const G4ThreeVector& dir)
152 {                                                 215 {
153   proposedPolarization = dir;                     216   proposedPolarization = dir;
154 }                                                 217 }
155                                                   218 
156 inline void G4ParticleChangeForLoss::ProposePo << 219 inline
157                                                << 220  void G4ParticleChangeForLoss::ProposePolarization(G4double Px, G4double Py, G4double Pz)
158                                                << 
159 {                                                 221 {
160   proposedPolarization.set(Px, Py, Pz);        << 222   proposedPolarization.setX(Px);
                                                   >> 223   proposedPolarization.setY(Py);
                                                   >> 224   proposedPolarization.setZ(Pz);
161 }                                                 225 }
162                                                   226 
163 inline                                         << 227 inline void G4ParticleChangeForLoss::InitializeForAlongStep(const G4Track& track)
164 void G4ParticleChangeForLoss::InitializeForAlo << 
165 {                                                 228 {
166   InitializeSecondaries();                     << 229   theStatusChange = track.GetTrackStatus();
167   InitializeLocalEnergyDeposit();              << 230   theLocalEnergyDeposit = 0.0;
168   InitializeParentWeight(track);               << 231   InitializeSecondaries(track);
169   InitializeStatusChange(track);               << 232   theParentWeight = track.GetWeight();
170   proposedKinEnergy = track.GetKineticEnergy()    233   proposedKinEnergy = track.GetKineticEnergy();
171   currentCharge = track.GetDynamicParticle()->    234   currentCharge = track.GetDynamicParticle()->GetCharge();
172 }                                                 235 }
173                                                   236 
174 inline                                         << 237 inline void G4ParticleChangeForLoss::InitializeForPostStep(const G4Track& track)
175 void G4ParticleChangeForLoss::InitializeForPos << 
176 {                                                 238 {
177   InitializeForAlongStep(track);               << 239   theStatusChange = track.GetTrackStatus();
                                                   >> 240   theLocalEnergyDeposit = 0.0;
                                                   >> 241   InitializeSecondaries(track);
                                                   >> 242   theParentWeight = track.GetWeight();
                                                   >> 243   proposedKinEnergy = track.GetKineticEnergy();
                                                   >> 244   currentCharge = track.GetDynamicParticle()->GetCharge();
178   proposedMomentumDirection = track.GetMomentu    245   proposedMomentumDirection = track.GetMomentumDirection();
179   proposedPolarization = track.GetPolarization    246   proposedPolarization = track.GetPolarization();
                                                   >> 247   currentTrack = &track;
                                                   >> 248 }
                                                   >> 249 
                                                   >> 250 //----------------------------------------------------------------
                                                   >> 251 // methods for updating G4Step
                                                   >> 252 //
                                                   >> 253 
                                                   >> 254 inline G4Step* G4ParticleChangeForLoss::UpdateStepForAlongStep(G4Step* pStep)
                                                   >> 255 {
                                                   >> 256   G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
                                                   >> 257 
                                                   >> 258   // accumulate change of the kinetic energy
                                                   >> 259   G4double kinEnergy = pPostStepPoint->GetKineticEnergy() +
                                                   >> 260     (proposedKinEnergy - pStep->GetPreStepPoint()->GetKineticEnergy());
                                                   >> 261 
                                                   >> 262   // update kinetic energy and charge
                                                   >> 263   if (kinEnergy < DBL_MIN) {
                                                   >> 264     theLocalEnergyDeposit += kinEnergy;
                                                   >> 265     kinEnergy = 0.0;
                                                   >> 266   } else {
                                                   >> 267     pPostStepPoint->SetCharge( currentCharge );
                                                   >> 268   }
                                                   >> 269   pPostStepPoint->SetKineticEnergy( kinEnergy );
                                                   >> 270 
                                                   >> 271   // update weight 
                                                   >> 272   // this feature is commented out, it should be overwritten in case
                                                   >> 273   // if energy loss processes will use biasing
                                                   >> 274   //  G4double newWeight = theParentWeight*(pPostStepPoint->GetWeight())
                                                   >> 275   //  /(pPreStepPoint->GetWeight());
                                                   >> 276   // pPostStepPoint->SetWeight( newWeight );
                                                   >> 277   pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
                                                   >> 278   return pStep;
                                                   >> 279 }
                                                   >> 280 
                                                   >> 281 inline G4Step* G4ParticleChangeForLoss::UpdateStepForPostStep(G4Step* pStep)
                                                   >> 282 {
                                                   >> 283   G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
                                                   >> 284   pPostStepPoint->SetCharge( currentCharge );
                                                   >> 285   pPostStepPoint->SetMomentumDirection( proposedMomentumDirection );
                                                   >> 286   pPostStepPoint->SetKineticEnergy( proposedKinEnergy );
                                                   >> 287   pPostStepPoint->SetPolarization( proposedPolarization );
                                                   >> 288   // update weight if process cannot do that
                                                   >> 289   if (!fSetParentWeightByProcess)
                                                   >> 290     pPostStepPoint->SetWeight( theParentWeight );
                                                   >> 291 
                                                   >> 292   pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
                                                   >> 293   return pStep;
                                                   >> 294 }
                                                   >> 295 
                                                   >> 296 inline void G4ParticleChangeForLoss::AddSecondary(G4DynamicParticle* aParticle)
                                                   >> 297 {
                                                   >> 298   //  create track
                                                   >> 299   G4Track* aTrack = new G4Track(aParticle, currentTrack->GetGlobalTime(),
                                                   >> 300                                            currentTrack->GetPosition());
                                                   >> 301 
                                                   >> 302   //   Touchable handle is copied to keep the pointer
                                                   >> 303   aTrack->SetTouchableHandle(currentTrack->GetTouchableHandle());
                                                   >> 304 
                                                   >> 305   //  add a secondary
                                                   >> 306   G4VParticleChange::AddSecondary(aTrack);
180 }                                                 307 }
181                                                   308 
182 #endif                                            309 #endif
                                                   >> 310 
183                                                   311