Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/parameterisation/src/G4FastStep.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 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 /processes/parameterisation/src/G4FastStep.cc (Version 11.3.0) and /processes/parameterisation/src/G4FastStep.cc (Version 9.6.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 //                                                 26 //
                                                   >>  27 // $Id$
 27 //                                                 28 //
 28 //--------------------------------------------     29 //---------------------------------------------------------------
 29 //                                                 30 //
 30 //  G4FastStep.cc                                  31 //  G4FastStep.cc
 31 //                                                 32 //
 32 //  Description:                                   33 //  Description:
 33 //    Encapsulates a G4ParticleChange and insu     34 //    Encapsulates a G4ParticleChange and insure friendly interface
 34 //    methods to manage the primary/secondarie <<  35 //    methods to manage the primary/secondaries final state for 
 35 //    Fast Simulation Models.                      36 //    Fast Simulation Models.
 36 //                                                 37 //
 37 //  History:                                       38 //  History:
 38 //    Oct 97: Verderi && MoraDeFreitas - First     39 //    Oct 97: Verderi && MoraDeFreitas - First Implementation.
 39 //    Apr 98: MoraDeFreitas - G4FastStep becom     40 //    Apr 98: MoraDeFreitas - G4FastStep becomes the G4ParticleChange
 40 //                      for the Fast Simulatio     41 //                      for the Fast Simulation Process.
 41 //                                                 42 //
 42 //--------------------------------------------     43 //---------------------------------------------------------------
 43                                                    44 
 44 #include "G4FastStep.hh"                           45 #include "G4FastStep.hh"
 45                                                    46 
 46 #include "G4DynamicParticle.hh"                << 
 47 #include "G4Step.hh"                           << 
 48 #include "G4SystemOfUnits.hh"                      47 #include "G4SystemOfUnits.hh"
 49 #include "G4Track.hh"                              48 #include "G4Track.hh"
                                                   >>  49 #include "G4Step.hh"
 50 #include "G4TrackFastVector.hh"                    50 #include "G4TrackFastVector.hh"
 51 #include "G4UnitsTable.hh"                     <<  51 #include "G4DynamicParticle.hh"
 52                                                    52 
 53 void G4FastStep::Initialize(const G4FastTrack&     53 void G4FastStep::Initialize(const G4FastTrack& fastTrack)
 54 {                                                  54 {
 55   // keeps the fastTrack reference                 55   // keeps the fastTrack reference
 56   fFastTrack = &fastTrack;                     <<  56   fFastTrack=&fastTrack;
 57                                                    57 
 58   // currentTrack will be used to Initialize t     58   // currentTrack will be used to Initialize the other data members
 59   const G4Track& currentTrack = *(fFastTrack->     59   const G4Track& currentTrack = *(fFastTrack->GetPrimaryTrack());
 60                                                    60 
 61   // use base class's method at first              61   // use base class's method at first
 62   G4VParticleChange::Initialize(currentTrack);     62   G4VParticleChange::Initialize(currentTrack);
 63                                                    63 
 64   // set Energy/Momentum etc. equal to those o     64   // set Energy/Momentum etc. equal to those of the parent particle
 65   const G4DynamicParticle* pParticle = current <<  65   const G4DynamicParticle*  pParticle = currentTrack.GetDynamicParticle();
 66   theEnergyChange = pParticle->GetKineticEnerg <<  66   theEnergyChange          = pParticle->GetKineticEnergy();
 67   theMomentumChange = pParticle->GetMomentumDi <<  67   theMomentumChange        = pParticle->GetMomentumDirection();
 68   thePolarizationChange = pParticle->GetPolari <<  68   thePolarizationChange    = pParticle->GetPolarization();
 69   theProperTimeChange = pParticle->GetProperTi <<  69   theProperTimeChange      = pParticle->GetProperTime();
 70                                                    70 
 71   // set Position/Time etc. equal to those of      71   // set Position/Time etc. equal to those of the parent track
 72   thePositionChange = currentTrack.GetPosition <<  72   thePositionChange      = currentTrack.GetPosition();
 73   theTimeChange = currentTrack.GetGlobalTime() <<  73   theTimeChange          = currentTrack.GetGlobalTime();
 74                                                    74 
 75   // switch off stepping hit invokation by def     75   // switch off stepping hit invokation by default:
 76   theSteppingControlFlag = AvoidHitInvocation;     76   theSteppingControlFlag = AvoidHitInvocation;
 77                                                    77 
 78   // event biasing weigth:                         78   // event biasing weigth:
 79   theWeightChange = currentTrack.GetWeight();  <<  79   theWeightChange        = currentTrack.GetWeight();
 80 }                                              <<  80 }  
 81                                                    81 
 82 //----------------------------------------         82 //----------------------------------------
 83 // -- Set the StopAndKilled signal                 83 // -- Set the StopAndKilled signal
 84 // -- and put kinetic energy to 0.0. in the        84 // -- and put kinetic energy to 0.0. in the
 85 // -- G4ParticleChange.                            85 // -- G4ParticleChange.
 86 //----------------------------------------         86 //----------------------------------------
 87 void G4FastStep::KillPrimaryTrack()                87 void G4FastStep::KillPrimaryTrack()
 88 {                                                  88 {
 89   ProposePrimaryTrackFinalKineticEnergy(0.);   <<  89   SetPrimaryTrackFinalKineticEnergy(0.) ;
 90   ProposeTrackStatus(fStopAndKill);            <<  90   ProposeTrackStatus(fStopAndKill) ;
 91 }                                                  91 }
 92                                                    92 
 93 //--------------------                             93 //--------------------
 94 //                                                 94 //
 95 //--------------------                             95 //--------------------
 96 void G4FastStep::ProposePrimaryTrackFinalPosit <<  96 void 
 97                                                <<  97 G4FastStep::
                                                   >>  98 ProposePrimaryTrackFinalPosition(const G4ThreeVector &position,
                                                   >>  99                                  G4bool localCoordinates)
 98 {                                                 100 {
 99   // Compute the position coordinate in global    101   // Compute the position coordinate in global
100   // reference system if needed ...               102   // reference system if needed ...
101   G4ThreeVector globalPosition = position;        103   G4ThreeVector globalPosition = position;
102   if (localCoordinates)                        << 104   if (localCoordinates) 
103     globalPosition = fFastTrack->GetInverseAff << 105     globalPosition = fFastTrack->GetInverseAffineTransformation()->
                                                   >> 106       TransformPoint(position);
104   // ...and feed the globalPosition:              107   // ...and feed the globalPosition:
105   thePositionChange = globalPosition;             108   thePositionChange = globalPosition;
106 }                                                 109 }
107                                                   110 
108 void G4FastStep::SetPrimaryTrackFinalPosition( << 111 void 
109                                                << 112 G4FastStep::
                                                   >> 113 SetPrimaryTrackFinalPosition(const G4ThreeVector &position,
                                                   >> 114                              G4bool localCoordinates)
110 {                                                 115 {
111   ProposePrimaryTrackFinalPosition(position, l    116   ProposePrimaryTrackFinalPosition(position, localCoordinates);
112 }                                                 117 }
113                                                   118 
114 //--------------------                            119 //--------------------
115 //                                                120 //
116 //--------------------                            121 //--------------------
117 void G4FastStep::ProposePrimaryTrackFinalMomen << 122 void 
118                                                << 123 G4FastStep::
                                                   >> 124 ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector &momentum,
                                                   >> 125                                           G4bool localCoordinates)
119 {                                                 126 {
120   // Compute the momentum in global reference     127   // Compute the momentum in global reference
121   // system if needed ...                         128   // system if needed ...
122   G4ThreeVector globalMomentum = momentum;        129   G4ThreeVector globalMomentum = momentum;
123   if (localCoordinates)                           130   if (localCoordinates)
124     globalMomentum = fFastTrack->GetInverseAff << 131     globalMomentum = fFastTrack->GetInverseAffineTransformation()->
                                                   >> 132       TransformAxis(momentum);
125   // ...and feed the globalMomentum (ensuring     133   // ...and feed the globalMomentum (ensuring unitarity)
126   SetMomentumChange(globalMomentum.unit());       134   SetMomentumChange(globalMomentum.unit());
127 }                                                 135 }
128                                                   136 
129 void G4FastStep::SetPrimaryTrackFinalMomentum( << 137 void 
130                                                << 138 G4FastStep::
                                                   >> 139 SetPrimaryTrackFinalMomentum(const G4ThreeVector &momentum,
                                                   >> 140                              G4bool localCoordinates)
131 {                                                 141 {
132   ProposePrimaryTrackFinalMomentumDirection(mo    142   ProposePrimaryTrackFinalMomentumDirection(momentum, localCoordinates);
133 }                                                 143 }
134                                                   144 
135 //--------------------                            145 //--------------------
136 //                                                146 //
137 //--------------------                            147 //--------------------
138 void G4FastStep::ProposePrimaryTrackFinalKinet << 148 void 
139                                                << 149 G4FastStep::
140                                                << 150 ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
                                                   >> 151                                                   const G4ThreeVector &direction,
                                                   >> 152                                                   G4bool localCoordinates)
141 {                                                 153 {
142   // Compute global direction if needed...        154   // Compute global direction if needed...
143   G4ThreeVector globalDirection = direction;      155   G4ThreeVector globalDirection = direction;
144   if (localCoordinates)                           156   if (localCoordinates)
145     globalDirection = fFastTrack->GetInverseAf << 157     globalDirection =fFastTrack->GetInverseAffineTransformation()-> 
                                                   >> 158       TransformAxis(direction);
146   // ...and feed the globalMomentum (ensuring     159   // ...and feed the globalMomentum (ensuring unitarity)
147   SetMomentumChange(globalDirection.unit());      160   SetMomentumChange(globalDirection.unit());
148   ProposePrimaryTrackFinalKineticEnergy(kineti << 161   SetPrimaryTrackFinalKineticEnergy(kineticEnergy);
149 }                                                 162 }
150                                                   163 
151 void G4FastStep::SetPrimaryTrackFinalKineticEn << 164 void 
152                                                << 165 G4FastStep::
153                                                << 166 SetPrimaryTrackFinalKineticEnergyAndDirection(G4double kineticEnergy,
                                                   >> 167                                               const G4ThreeVector &direction,
                                                   >> 168                                               G4bool localCoordinates)
154 {                                                 169 {
155   ProposePrimaryTrackFinalKineticEnergyAndDire    170   ProposePrimaryTrackFinalKineticEnergyAndDirection(kineticEnergy, direction, localCoordinates);
156 }                                                 171 }
157                                                   172 
158 //--------------------                            173 //--------------------
159 //                                                174 //
160 //--------------------                            175 //--------------------
161 void G4FastStep::ProposePrimaryTrackFinalPolar << 176 void 
162                                                << 177 G4FastStep::
                                                   >> 178 ProposePrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
                                                   >> 179                                      G4bool localCoordinates)
163 {                                                 180 {
164   // Compute polarization in global system if     181   // Compute polarization in global system if needed:
165   G4ThreeVector globalPolarization(polarizatio    182   G4ThreeVector globalPolarization(polarization);
166   if (localCoordinates)                           183   if (localCoordinates)
167     globalPolarization =                       << 184     globalPolarization = fFastTrack->GetInverseAffineTransformation()->
168       fFastTrack->GetInverseAffineTransformati << 185       TransformAxis(globalPolarization);  
169   // Feed the particle globalPolarization:        186   // Feed the particle globalPolarization:
170   thePolarizationChange = globalPolarization;     187   thePolarizationChange = globalPolarization;
171 }                                                 188 }
172                                                   189 
173 void G4FastStep::SetPrimaryTrackFinalPolarizat << 190 void 
174                                                << 191 G4FastStep::
                                                   >> 192 SetPrimaryTrackFinalPolarization(const G4ThreeVector &polarization,
                                                   >> 193                                  G4bool localCoordinates)
175 {                                                 194 {
176   ProposePrimaryTrackFinalPolarization(polariz    195   ProposePrimaryTrackFinalPolarization(polarization, localCoordinates);
177 }                                                 196 }
178                                                   197 
179 //--------------------                            198 //--------------------
180 //                                                199 //
181 //--------------------                            200 //--------------------
182 G4Track* G4FastStep::CreateSecondaryTrack(cons << 201 G4Track* G4FastStep::
183                                           G4Th << 202 CreateSecondaryTrack(const G4DynamicParticle& dynamics,
184                                           G4do << 203                      G4ThreeVector polarization,
                                                   >> 204                      G4ThreeVector position,
                                                   >> 205                      G4double time,
                                                   >> 206                      G4bool localCoordinates     )
185 {                                                 207 {
186   G4DynamicParticle dummyDynamics(dynamics);      208   G4DynamicParticle dummyDynamics(dynamics);
187                                                << 209   
188   // -----------------------------------------    210   // ------------------------------------------
189   // Add the polarization to the dummyDynamics    211   // Add the polarization to the dummyDynamics:
190   // -----------------------------------------    212   // ------------------------------------------
191   dummyDynamics.SetPolarization(polarization.x << 213   dummyDynamics.SetPolarization(polarization.x(),
192                                                << 214                                 polarization.y(),
                                                   >> 215                                 polarization.z());
                                                   >> 216   
193   return CreateSecondaryTrack(dummyDynamics, p    217   return CreateSecondaryTrack(dummyDynamics, position, time, localCoordinates);
194 }                                                 218 }
195                                                   219 
196 //--------------------                            220 //--------------------
197 //                                                221 //
198 //--------------------                            222 //--------------------
199 G4Track* G4FastStep::CreateSecondaryTrack(cons << 223 G4Track* G4FastStep::
200                                           G4do << 224 CreateSecondaryTrack(const G4DynamicParticle& dynamics,
                                                   >> 225                      G4ThreeVector position,
                                                   >> 226                      G4double time,
                                                   >> 227                      G4bool localCoordinates     )
201 {                                                 228 {
202   // ----------------------------------------     229   // ----------------------------------------
203   // Quantities in global coordinates system.     230   // Quantities in global coordinates system.
204   //                                           << 231   //  
205   // The allocated globalDynamics is deleted      232   // The allocated globalDynamics is deleted
206   // by the destructor of the G4Track.            233   // by the destructor of the G4Track.
207   // ----------------------------------------     234   // ----------------------------------------
208   auto globalDynamics = new G4DynamicParticle( << 235   G4DynamicParticle* globalDynamics =
                                                   >> 236     new G4DynamicParticle(dynamics);
209   G4ThreeVector globalPosition(position);         237   G4ThreeVector globalPosition(position);
210                                                << 238   
211   // -----------------------------------          239   // -----------------------------------
212   // Convert to global system if needed:          240   // Convert to global system if needed:
213   // -----------------------------------          241   // -----------------------------------
214   if (localCoordinates) {                      << 242   if (localCoordinates)
215     // -- Momentum Direction:                  << 243     {
216     globalDynamics->SetMomentumDirection(      << 244       // -- Momentum Direction:
217       fFastTrack->GetInverseAffineTransformati << 245       globalDynamics->SetMomentumDirection(fFastTrack->
218         globalDynamics->GetMomentumDirection() << 246                                            GetInverseAffineTransformation()->
219     // -- Polarization:                        << 247                                            TransformAxis(globalDynamics->
220     G4ThreeVector globalPolarization;          << 248                                                          GetMomentumDirection()));
221     globalPolarization = fFastTrack->GetInvers << 249       // -- Polarization:
222       globalDynamics->GetPolarization());      << 250       G4ThreeVector globalPolarization;
223     globalDynamics->SetPolarization(globalPola << 251       globalPolarization = fFastTrack->GetInverseAffineTransformation()->
224                                     globalPola << 252         TransformAxis(globalDynamics->GetPolarization());
225                                                << 253       globalDynamics->SetPolarization(
226     // -- Position:                            << 254                                       globalPolarization.x(),
227     globalPosition = fFastTrack->GetInverseAff << 255                                       globalPolarization.y(),
228   }                                            << 256                                       globalPolarization.z()
229                                                << 257                                       );
                                                   >> 258       
                                                   >> 259       // -- Position:
                                                   >> 260       globalPosition = fFastTrack->GetInverseAffineTransformation()->
                                                   >> 261         TransformPoint(globalPosition);
                                                   >> 262     }
                                                   >> 263   
230   //-------------------------------------         264   //-------------------------------------
231   // Create the G4Track of the secondary:         265   // Create the G4Track of the secondary:
232   //-------------------------------------         266   //-------------------------------------
233   auto secondary = new G4Track(globalDynamics, << 267   G4Track* secondary = new G4Track(
234                                                << 268                                    globalDynamics,
                                                   >> 269                                    time,
                                                   >> 270                                    globalPosition
                                                   >> 271                                    );
                                                   >> 272   
235   //-------------------------------               273   //-------------------------------
236   // and feed the changes:                        274   // and feed the changes:
237   //-------------------------------               275   //-------------------------------
238   AddSecondary(secondary);                        276   AddSecondary(secondary);
239                                                << 277   
240   //--------------------------------------        278   //--------------------------------------
241   // returns the pointer on the secondary:        279   // returns the pointer on the secondary:
242   //--------------------------------------        280   //--------------------------------------
243   return secondary;                               281   return secondary;
244 }                                                 282 }
245                                                   283 
246 // G4FastStep should never be Initialized in t    284 // G4FastStep should never be Initialized in this way
247 // but we must define it to avoid warnings.       285 // but we must define it to avoid warnings.
248 void G4FastStep::Initialize(const G4Track&)       286 void G4FastStep::Initialize(const G4Track&)
249 {                                                 287 {
250   G4ExceptionDescription tellWhatIsWrong;      << 288   G4ExceptionDescription  tellWhatIsWrong;
251   tellWhatIsWrong << "G4FastStep can be initia << 289   tellWhatIsWrong << "G4FastStep can be initialised only through G4FastTrack."
252   G4Exception("G4FastStep::Initialize(const G4 << 290       << G4endl;
253               tellWhatIsWrong);                << 291   G4Exception("G4FastStep::Initialize(const G4Track&)",
                                                   >> 292         "FastSim005",
                                                   >> 293         FatalException,
                                                   >> 294         tellWhatIsWrong);
                                                   >> 295 }
                                                   >> 296 
                                                   >> 297 G4FastStep::G4FastStep()
                                                   >> 298   : G4VParticleChange()
                                                   >> 299 {
                                                   >> 300   if (verboseLevel>2)
                                                   >> 301   {
                                                   >> 302     G4cerr << "G4FastStep::G4FastStep() " << G4endl;
                                                   >> 303   }
                                                   >> 304 }
                                                   >> 305 
                                                   >> 306 G4FastStep::~G4FastStep() 
                                                   >> 307 {
                                                   >> 308   if (verboseLevel>2)
                                                   >> 309   {
                                                   >> 310     G4cerr << "G4FastStep::~G4FastStep() " << G4endl;
                                                   >> 311   }
                                                   >> 312 }
                                                   >> 313 
                                                   >> 314 // copy and assignment operators are implemented as "shallow copy"
                                                   >> 315 G4FastStep::G4FastStep(const G4FastStep &right)
                                                   >> 316   : G4VParticleChange()
                                                   >> 317 {
                                                   >> 318    *this = right;
                                                   >> 319 }
                                                   >> 320 
                                                   >> 321 
                                                   >> 322 G4FastStep & G4FastStep::operator=(const G4FastStep &right)
                                                   >> 323 {
                                                   >> 324    if (this != &right)
                                                   >> 325    {
                                                   >> 326      G4VParticleChange::operator=(right);
                                                   >> 327      theListOfSecondaries          = right.theListOfSecondaries;
                                                   >> 328      theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
                                                   >> 329      theNumberOfSecondaries        = right.theNumberOfSecondaries;
                                                   >> 330      theStatusChange               = right.theStatusChange;
                                                   >> 331      theMomentumChange             = right.theMomentumChange;
                                                   >> 332      thePolarizationChange         = right.thePolarizationChange;
                                                   >> 333      thePositionChange             = right.thePositionChange;
                                                   >> 334      theTimeChange                 = right.theTimeChange;
                                                   >> 335      theEnergyChange               = right.theEnergyChange;
                                                   >> 336      theTrueStepLength             = right.theTrueStepLength;
                                                   >> 337      theLocalEnergyDeposit         = right.theLocalEnergyDeposit;
                                                   >> 338      theSteppingControlFlag        = right.theSteppingControlFlag;
                                                   >> 339      theWeightChange               = right.theWeightChange;
                                                   >> 340    }
                                                   >> 341    return *this;
                                                   >> 342 }
                                                   >> 343 
                                                   >> 344 
                                                   >> 345 
                                                   >> 346 
                                                   >> 347 
                                                   >> 348 G4bool G4FastStep::operator==(const G4FastStep &right) const
                                                   >> 349 {
                                                   >> 350    return ((G4VParticleChange *)this == (G4VParticleChange *) &right);
                                                   >> 351 }
                                                   >> 352 
                                                   >> 353 G4bool G4FastStep::operator!=(const G4FastStep &right) const
                                                   >> 354 {
                                                   >> 355    return ((G4VParticleChange *)this != (G4VParticleChange *) &right);
254 }                                                 356 }
255                                                   357 
256 //--------------------------------------------    358 //----------------------------------------------------------------
257 // methods for updating G4Step                 << 359 // methods for updating G4Step 
258 //                                                360 //
259                                                   361 
260 G4Step* G4FastStep::UpdateStepForPostStep(G4St    362 G4Step* G4FastStep::UpdateStepForPostStep(G4Step* pStep)
261 {                                              << 363 { 
262   // A physics process always calculates the f    364   // A physics process always calculates the final state of the particle
263                                                   365 
264   // Take note that the return type of GetMome    366   // Take note that the return type of GetMomentumChange is a
265   // pointer to G4ParticleMometum. Also it is  << 367   // pointer to G4ParticleMometum. Also it is a normalized 
266   // momentum vector.                             368   // momentum vector.
267                                                   369 
268   //  G4StepPoint* pPreStepPoint  = pStep->Get << 370   //  G4StepPoint* pPreStepPoint  = pStep->GetPreStepPoint(); 
269   G4StepPoint* pPostStepPoint = pStep->GetPost << 371   G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint(); 
270   G4Track* aTrack = pStep->GetTrack();         << 372   G4Track*     aTrack  = pStep->GetTrack();
271   //  G4double     mass = aTrack->GetDynamicPa    373   //  G4double     mass = aTrack->GetDynamicParticle()->GetMass();
272                                                << 374  
273   // update kinetic energy and momentum direct    375   // update kinetic energy and momentum direction
274   pPostStepPoint->SetMomentumDirection(theMome    376   pPostStepPoint->SetMomentumDirection(theMomentumChange);
275   pPostStepPoint->SetKineticEnergy(theEnergyCh << 377   pPostStepPoint->SetKineticEnergy( theEnergyChange );
276                                                << 
277   // update polarization                       << 
278   pPostStepPoint->SetPolarization(thePolarizat << 
279                                                   378 
                                                   >> 379    // update polarization
                                                   >> 380   pPostStepPoint->SetPolarization( thePolarizationChange );
                                                   >> 381       
280   // update position and time                     382   // update position and time
281   pPostStepPoint->SetPosition(thePositionChang << 383   pPostStepPoint->SetPosition( thePositionChange  );
282   pPostStepPoint->SetGlobalTime(theTimeChange) << 384   pPostStepPoint->SetGlobalTime( theTimeChange  );
283   pPostStepPoint->AddLocalTime(theTimeChange - << 385   pPostStepPoint->AddLocalTime( theTimeChange 
284   pPostStepPoint->SetProperTime(theProperTimeC << 386                                  - aTrack->GetGlobalTime());
                                                   >> 387   pPostStepPoint->SetProperTime( theProperTimeChange  );
285                                                   388 
286   // update weight                                389   // update weight
287   pPostStepPoint->SetWeight(theWeightChange);  << 390   pPostStepPoint->SetWeight( theWeightChange );
288                                                   391 
289   if (debugFlag) CheckIt(*aTrack);                392   if (debugFlag) CheckIt(*aTrack);
290                                                   393 
291   //  Update the G4Step specific attributes    << 394   
                                                   >> 395   //  Update the G4Step specific attributes 
292   return UpdateStepInfo(pStep);                   396   return UpdateStepInfo(pStep);
293 }                                                 397 }
294                                                   398 
295 G4Step* G4FastStep::UpdateStepForAtRest(G4Step    399 G4Step* G4FastStep::UpdateStepForAtRest(G4Step* pStep)
296 {                                              << 400 { 
297   // A physics process always calculates the f    401   // A physics process always calculates the final state of the particle
298                                                   402 
299   // G4StepPoint* pPreStepPoint  = pStep->GetP << 403   // G4StepPoint* pPreStepPoint  = pStep->GetPreStepPoint(); 
300   G4StepPoint* pPostStepPoint = pStep->GetPost << 404   G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint(); 
301   G4Track* aTrack = pStep->GetTrack();         << 405   G4Track*     aTrack  = pStep->GetTrack();
302   // G4double     mass = aTrack->GetDynamicPar    406   // G4double     mass = aTrack->GetDynamicParticle()->GetMass();
303                                                << 407  
304   // update kinetic energy and momentum direct    408   // update kinetic energy and momentum direction
305   pPostStepPoint->SetMomentumDirection(theMome    409   pPostStepPoint->SetMomentumDirection(theMomentumChange);
306   pPostStepPoint->SetKineticEnergy(theEnergyCh << 410   pPostStepPoint->SetKineticEnergy( theEnergyChange );
307                                                   411 
308   // update polarization                          412   // update polarization
309   pPostStepPoint->SetPolarization(thePolarizat << 413   pPostStepPoint->SetPolarization( thePolarizationChange );
310                                                << 414       
311   // update position and time                     415   // update position and time
312   pPostStepPoint->SetPosition(thePositionChang << 416   pPostStepPoint->SetPosition( thePositionChange  );
313   pPostStepPoint->SetGlobalTime(theTimeChange) << 417   pPostStepPoint->SetGlobalTime( theTimeChange  );
314   pPostStepPoint->AddLocalTime(theTimeChange - << 418   pPostStepPoint->AddLocalTime( theTimeChange 
315   pPostStepPoint->SetProperTime(theProperTimeC << 419                                  - aTrack->GetGlobalTime());
                                                   >> 420   pPostStepPoint->SetProperTime( theProperTimeChange  );
316                                                   421 
317   // update weight                                422   // update weight
318   pPostStepPoint->SetWeight(theWeightChange);  << 423   pPostStepPoint->SetWeight( theWeightChange );
319                                                   424 
320   if (debugFlag) CheckIt(*aTrack);                425   if (debugFlag) CheckIt(*aTrack);
321                                                   426 
322   //  Update the G4Step specific attributes    << 427   //  Update the G4Step specific attributes 
323   return UpdateStepInfo(pStep);                   428   return UpdateStepInfo(pStep);
324 }                                                 429 }
325                                                   430 
326 //--------------------------------------------    431 //----------------------------------------------------------------
327 // methods for printing messages               << 432 // methods for printing messages  
328 //                                                433 //
329                                                   434 
330 void G4FastStep::DumpInfo() const                 435 void G4FastStep::DumpInfo() const
331 {                                                 436 {
332   // use base-class DumpInfo                   << 437 // use base-class DumpInfo
333   G4VParticleChange::DumpInfo();                  438   G4VParticleChange::DumpInfo();
334                                                   439 
335   G4cout << "        Position - x (mm)   : " < << 
336          << G4endl;                            << 
337   G4cout << "        Position - y (mm)   : " < << 
338          << G4endl;                            << 
339   G4cout << "        Position - z (mm)   : " < << 
340          << G4endl;                            << 
341   G4cout << "        Time (ns)           : " < << 
342   G4cout << "        Proper Time (ns)    : " < << 
343   G4long olprc = G4cout.precision(3);          << 
344   G4cout << "        Momentum Direct - x : " < << 
345   G4cout << "        Momentum Direct - y : " < << 
346   G4cout << "        Momentum Direct - z : " < << 
347   G4cout.precision(olprc);                     << 
348   G4cout << "        Kinetic Energy (MeV): " < << 
349   G4cout.precision(3);                            440   G4cout.precision(3);
350   G4cout << "        Polarization - x    : " < << 441   G4cout << "        Position - x (mm)   : " 
351          << G4endl;                            << 442        << std::setw(20) << thePositionChange.x()/mm
352   G4cout << "        Polarization - y    : " < << 443        << G4endl; 
353          << G4endl;                            << 444   G4cout << "        Position - y (mm)   : " 
354   G4cout << "        Polarization - z    : " < << 445        << std::setw(20) << thePositionChange.y()/mm
355          << G4endl;                            << 446        << G4endl; 
356   G4cout.precision(olprc);                     << 447   G4cout << "        Position - z (mm)   : " 
                                                   >> 448        << std::setw(20) << thePositionChange.z()/mm
                                                   >> 449        << G4endl;
                                                   >> 450   G4cout << "        Time (ns)           : " 
                                                   >> 451        << std::setw(20) << theTimeChange/ns
                                                   >> 452        << G4endl;
                                                   >> 453   G4cout << "        Proper Time (ns)    : " 
                                                   >> 454        << std::setw(20) << theProperTimeChange/ns
                                                   >> 455        << G4endl;
                                                   >> 456   G4cout << "        Momentum Direct - x : " 
                                                   >> 457        << std::setw(20) << theMomentumChange.x()
                                                   >> 458        << G4endl;
                                                   >> 459   G4cout << "        Momentum Direct - y : " 
                                                   >> 460        << std::setw(20) << theMomentumChange.y()
                                                   >> 461        << G4endl;
                                                   >> 462   G4cout << "        Momentum Direct - z : " 
                                                   >> 463        << std::setw(20) << theMomentumChange.z()
                                                   >> 464        << G4endl;
                                                   >> 465   G4cout << "        Kinetic Energy (MeV): " 
                                                   >> 466        << std::setw(20) << theEnergyChange/MeV
                                                   >> 467        << G4endl;
                                                   >> 468   G4cout << "        Polarization - x    : " 
                                                   >> 469        << std::setw(20) << thePolarizationChange.x()
                                                   >> 470        << G4endl;
                                                   >> 471   G4cout << "        Polarization - y    : " 
                                                   >> 472        << std::setw(20) << thePolarizationChange.y()
                                                   >> 473        << G4endl;
                                                   >> 474   G4cout << "        Polarization - z    : " 
                                                   >> 475        << std::setw(20) <<  thePolarizationChange.z()
                                                   >> 476        << G4endl;
357 }                                                 477 }
358                                                   478 
359 G4bool G4FastStep::CheckIt(const G4Track& aTra    479 G4bool G4FastStep::CheckIt(const G4Track& aTrack)
360 {                                                 480 {
361   //                                              481   //
362   //      In the G4FastStep::CheckIt              482   //      In the G4FastStep::CheckIt
363   //      We only check a bit                     483   //      We only check a bit
364   //                                           << 484   //      
365   //      If the user violates the energy,        485   //      If the user violates the energy,
366   //      We don't care, we agree.                486   //      We don't care, we agree.
367   //                                              487   //
368   //      But for theMomentumDirectionChange,     488   //      But for theMomentumDirectionChange,
369   //      We do pay attention.                    489   //      We do pay attention.
370   //      And if too large is its range,          490   //      And if too large is its range,
371   //      We issue an Exception.                  491   //      We issue an Exception.
372   //                                              492   //
373   //                                              493   //
374   // It means, the G4FastStep::CheckIt issues     494   // It means, the G4FastStep::CheckIt issues an exception only for the
375   // theMomentumDirectionChange which should b    495   // theMomentumDirectionChange which should be an unit vector
376   // and it corrects it because it could cause    496   // and it corrects it because it could cause problems for the ulterior
377   // tracking.For the rest, only warning are i    497   // tracking.For the rest, only warning are issued.
378                                                   498 
379   G4bool itsOK = true;                         << 499   G4bool    itsOK = true;
380   G4bool exitWithError = false;                << 500   G4bool    exitWithError = false;
381   G4double accuracy;                           << 501   G4double  accuracy;
382                                                << 502   
383   // Energy should not be larger than the init    503   // Energy should not be larger than the initial value
384   accuracy = (theEnergyChange - aTrack.GetKine << 504   accuracy = ( theEnergyChange - aTrack.GetKineticEnergy())/MeV;
385   if (accuracy > GetAccuracyForWarning()) {    << 505   if (accuracy > GetAccuracyForWarning())
386     G4ExceptionDescription ed;                 << 506     {
387     ed << "The energy becomes larger than the  << 507       G4ExceptionDescription ed;
388        << G4endl;                              << 508       ed << "The energy becomes larger than the initial value, difference = " <<  accuracy << " MeV" << G4endl;
389     G4Exception("G4FastStep::CheckIt(const G4T << 509       G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
390     itsOK = false;                             << 510       "FastSim006",
391     if (accuracy > GetAccuracyForException())  << 511       JustWarning, ed);
392       exitWithError = true;                    << 512       itsOK = false;
                                                   >> 513       if (accuracy > GetAccuracyForException())  {exitWithError = true;}
393     }                                             514     }
394   }                                            << 515   
395                                                << 
396   G4bool itsOKforMomentum = true;                 516   G4bool itsOKforMomentum = true;
397   if (theEnergyChange > 0.) {                  << 517   if ( theEnergyChange >0.)
398     accuracy = std::abs(theMomentumChange.mag2 << 518     {
399     if (accuracy > GetAccuracyForWarning()) {  << 519       accuracy = std::abs(theMomentumChange.mag2()-1.0);
                                                   >> 520       if (accuracy > GetAccuracyForWarning())
                                                   >> 521   {
                                                   >> 522     G4ExceptionDescription ed;
                                                   >> 523     ed << "The Momentum Change is not a unit vector, difference = " <<  accuracy << G4endl;
                                                   >> 524     G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
                                                   >> 525           "FastSim007",
                                                   >> 526           JustWarning, ed);
                                                   >> 527     itsOK = itsOKforMomentum = false;
                                                   >> 528     if (accuracy > GetAccuracyForException())  {exitWithError = true;}
                                                   >> 529   }
                                                   >> 530     }
                                                   >> 531   
                                                   >> 532   accuracy = (aTrack.GetGlobalTime()- theTimeChange)/ns;  
                                                   >> 533   if (accuracy > GetAccuracyForWarning())
                                                   >> 534     {
400       G4ExceptionDescription ed;                  535       G4ExceptionDescription ed;
401       ed << "The Momentum Change is not a unit << 536       ed << "The global time is getting backward, difference = " <<  accuracy << " ns" << G4endl;
402       G4Exception("G4FastStep::CheckIt(const G << 537       G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
403       itsOK = itsOKforMomentum = false;        << 538       "FastSim008",
404       if (accuracy > GetAccuracyForException() << 539       JustWarning, ed);
405         exitWithError = true;                  << 540       itsOK = false;
406       }                                        << 
407     }                                             541     }
408   }                                            << 542   
409                                                << 543   accuracy = (aTrack.GetProperTime() - theProperTimeChange )/ns;
410   accuracy = (aTrack.GetGlobalTime() - theTime << 544   if (accuracy >  GetAccuracyForWarning())
411   if (accuracy > GetAccuracyForWarning()) {    << 545     {
412     G4ExceptionDescription ed;                 << 546       G4ExceptionDescription ed;
413     ed << "The global time is getting backward << 547       ed << "The proper time is getting backward, difference = " <<  accuracy << " ns" << G4endl;
414     G4Exception("G4FastStep::CheckIt(const G4T << 548       G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
415     itsOK = false;                             << 549       "FastSim009",
416   }                                            << 550       JustWarning, ed);
417                                                << 551       itsOK = false;
418   accuracy = (aTrack.GetProperTime() - theProp << 552     }
419   if (accuracy > GetAccuracyForWarning()) {    << 553   
420     G4ExceptionDescription ed;                 << 554   if (!itsOK)
421     ed << "The proper time is getting backward << 555     { 
422     G4Exception("G4FastStep::CheckIt(const G4T << 556       G4cout << "ERROR - G4FastStep::CheckIt() " << G4endl;
423     itsOK = false;                             << 557       G4cout << "        Pointer : " << this << G4endl ;
424   }                                            << 558       DumpInfo();
425                                                << 559     }
426   if (!itsOK) {                                << 560   
427     G4cout << "ERROR - G4FastStep::CheckIt() " << 
428     G4cout << "        Pointer : " << this <<  << 
429     DumpInfo();                                << 
430   }                                            << 
431                                                << 
432   // Exit with error                              561   // Exit with error
433   if (exitWithError) {                         << 562   if (exitWithError)
434     G4ExceptionDescription ed;                 << 563     {
435     ed << "An inaccuracy in G4FastStep is beyo << 564       G4ExceptionDescription ed;
436     G4Exception("G4FastStep::CheckIt(const G4T << 565       ed << "An inaccuracy in G4FastStep is beyond tolerance." << G4endl;
437   }                                            << 566       G4Exception("G4FastStep::CheckIt(const G4Track& aTrack)",
438                                                << 567       "FastSim010",
439   // correction for Momentum only.             << 568       FatalException, ed);
                                                   >> 569     }
                                                   >> 570   
                                                   >> 571   //correction for Momentum only.
440   if (!itsOKforMomentum) {                        572   if (!itsOKforMomentum) {
441     G4double vmag = theMomentumChange.mag();      573     G4double vmag = theMomentumChange.mag();
442     theMomentumChange = (1. / vmag) * theMomen << 574     theMomentumChange = (1./vmag)*theMomentumChange;
443   }                                               575   }
444                                                << 576   
445   itsOK = (itsOK) && G4VParticleChange::CheckI << 577   itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack); 
446   return itsOK;                                   578   return itsOK;
447 }                                                 579 }
448                                                   580