Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/biasing/importance/src/G4WeightCutOffProcess.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/biasing/importance/src/G4WeightCutOffProcess.cc (Version 11.3.0) and /processes/biasing/importance/src/G4WeightCutOffProcess.cc (Version 10.4.p3)


  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 // G4WeightCutOffProcess                       << 
 27 //                                                 26 //
 28 // Author: Michael Dressel, 2002               <<  27 // $Id$
 29 // ------------------------------------------- <<  28 //
                                                   >>  29 // ----------------------------------------------------------------------
                                                   >>  30 // GEANT 4 class source file
                                                   >>  31 //
                                                   >>  32 // G4WeightCutOffProcess.cc
                                                   >>  33 //
                                                   >>  34 // ----------------------------------------------------------------------
 30                                                    35 
 31 #include "G4WeightCutOffProcess.hh"                36 #include "G4WeightCutOffProcess.hh"
                                                   >>  37 //#include "G4VScorer.hh"
 32 #include "G4GeometryCellStep.hh"                   38 #include "G4GeometryCellStep.hh"
                                                   >>  39 //#include "G4GCellFinder.hh"
 33 #include "G4TouchableHandle.hh"                    40 #include "G4TouchableHandle.hh"
 34 #include "G4VIStore.hh"                            41 #include "G4VIStore.hh"
 35                                                    42 
 36 #include "G4Step.hh"                               43 #include "G4Step.hh"
 37 #include "G4Navigator.hh"                          44 #include "G4Navigator.hh"
 38 #include "G4VTouchable.hh"                         45 #include "G4VTouchable.hh"
 39 #include "G4VPhysicalVolume.hh"                    46 #include "G4VPhysicalVolume.hh"
 40 #include "G4ParticleChange.hh"                     47 #include "G4ParticleChange.hh"
 41 #include "G4PathFinder.hh"                         48 #include "G4PathFinder.hh"
 42 #include "G4TransportationManager.hh"              49 #include "G4TransportationManager.hh"
 43 #include "G4StepPoint.hh"                          50 #include "G4StepPoint.hh"
 44 #include "G4FieldTrackUpdator.hh"                  51 #include "G4FieldTrackUpdator.hh"
 45                                                    52 
 46                                                    53 
 47 G4WeightCutOffProcess::                            54 G4WeightCutOffProcess::
 48 G4WeightCutOffProcess(G4double wsurvival,          55 G4WeightCutOffProcess(G4double wsurvival,
 49                       G4double wlimit,             56                       G4double wlimit,
 50                       G4double isource,            57                       G4double isource,
 51                       G4VIStore *istore,           58                       G4VIStore *istore,
                                                   >>  59           //                      const G4VGCellFinder &aGCellFinder,
 52                       const G4String &aName, G     60                       const G4String &aName, G4bool para)
 53   : G4VProcess(aName),                             61   : G4VProcess(aName), 
 54     fParticleChange(new G4ParticleChange),         62     fParticleChange(new G4ParticleChange),
 55     fWeightSurvival(wsurvival),                    63     fWeightSurvival(wsurvival),
 56     fWeightLimit(wlimit),                          64     fWeightLimit(wlimit),
 57     fSourceImportance(isource),                    65     fSourceImportance(isource), 
 58     fIStore(istore),                               66     fIStore(istore),
 59     fParaflag(para)                            <<  67     //    fGCellFinder(aGCellFinder),
                                                   >>  68     fGhostWorldName("NoParallelWorld"), fGhostWorld(0),
                                                   >>  69     fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0'),
                                                   >>  70     fParaflag(para), fEndTrack('0'), feLimited(kDoNot)
 60 {                                                  71 {
 61   if (!fParticleChange)                            72   if (!fParticleChange)
 62   {                                                73   {
 63     G4Exception("G4WeightCutOffProcess::G4Weig     74     G4Exception("G4WeightCutOffProcess::G4WeightCutOffProcess()",
 64                 "FatalError", FatalException,      75                 "FatalError", FatalException,
 65                 "Failed to allocate G4Particle     76                 "Failed to allocate G4ParticleChange !");
 66   }                                                77   }
 67                                                    78 
 68   G4VProcess::pParticleChange = fParticleChang     79   G4VProcess::pParticleChange = fParticleChange;
 69                                                    80 
 70   fGhostStep = new G4Step();                       81   fGhostStep = new G4Step();
 71   fGhostPreStepPoint = fGhostStep->GetPreStepP     82   fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
 72   fGhostPostStepPoint = fGhostStep->GetPostSte     83   fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
 73                                                    84 
 74   fTransportationManager = G4TransportationMan     85   fTransportationManager = G4TransportationManager::GetTransportationManager();
 75   fPathFinder = G4PathFinder::GetInstance();       86   fPathFinder = G4PathFinder::GetInstance();
 76                                                    87 
 77   if (verboseLevel>0)                              88   if (verboseLevel>0)
 78   {                                                89   {
 79     G4cout << GetProcessName() << " is created     90     G4cout << GetProcessName() << " is created " << G4endl;
 80   }                                                91   }
 81 }                                                  92 }
 82                                                    93 
 83 G4WeightCutOffProcess::~G4WeightCutOffProcess(     94 G4WeightCutOffProcess::~G4WeightCutOffProcess()
 84 {                                                  95 {
 85   delete fParticleChange;                          96   delete fParticleChange;
 86   // delete fGhostStep;                        <<  97   //  delete fGhostStep;
 87 }                                                  98 }
 88                                                    99 
 89                                                   100 
 90 //--------------------------------------------    101 //------------------------------------------------------
 91 //                                                102 //
 92 // SetParallelWorld                               103 // SetParallelWorld 
 93 //                                                104 //
 94 //--------------------------------------------    105 //------------------------------------------------------
 95 void G4WeightCutOffProcess::                      106 void G4WeightCutOffProcess::
 96 SetParallelWorld(const G4String &parallelWorld    107 SetParallelWorld(const G4String &parallelWorldName)
 97 {                                                 108 {
 98 //++++++++++++++++++++++++++++++++++++++++++++    109 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 99 // Get pointers of the parallel world and its     110 // Get pointers of the parallel world and its navigator
100 //++++++++++++++++++++++++++++++++++++++++++++    111 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
101   fGhostWorldName = parallelWorldName;            112   fGhostWorldName = parallelWorldName;
102   fGhostWorld = fTransportationManager->GetPar    113   fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
103   fGhostNavigator = fTransportationManager->Ge    114   fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
104 //++++++++++++++++++++++++++++++++++++++++++++    115 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105 }                                                 116 }
106                                                   117 
107 void G4WeightCutOffProcess::                      118 void G4WeightCutOffProcess::
108 SetParallelWorld(G4VPhysicalVolume* parallelWo    119 SetParallelWorld(G4VPhysicalVolume* parallelWorld)
109 {                                                 120 {
110 //++++++++++++++++++++++++++++++++++++++++++++    121 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
111 // Get pointer of navigator                       122 // Get pointer of navigator
112 //++++++++++++++++++++++++++++++++++++++++++++    123 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
113   fGhostWorldName = parallelWorld->GetName();     124   fGhostWorldName = parallelWorld->GetName();
114   fGhostWorld = parallelWorld;                    125   fGhostWorld = parallelWorld;
115   fGhostNavigator = fTransportationManager->Ge    126   fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
116 //++++++++++++++++++++++++++++++++++++++++++++    127 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
117 }                                                 128 }
118                                                   129 
119 //--------------------------------------------    130 //------------------------------------------------------
120 //                                                131 //
121 // StartTracking                                  132 // StartTracking
122 //                                                133 //
123 //--------------------------------------------    134 //------------------------------------------------------
124 void G4WeightCutOffProcess::StartTracking(G4Tr    135 void G4WeightCutOffProcess::StartTracking(G4Track* trk)
125 {                                                 136 {
126 //++++++++++++++++++++++++++++++++++++++++++++    137 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
127 // Activate navigator and get the navigator ID    138 // Activate navigator and get the navigator ID
128 //++++++++++++++++++++++++++++++++++++++++++++    139 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
129 // G4cout << " G4ParallelWorldScoringProcess::    140 // G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
130                                                   141 
131   if(fParaflag) {                                 142   if(fParaflag) {
132     if(fGhostNavigator != nullptr)             << 143     if(fGhostNavigator)
133       { fNavigatorID = fTransportationManager-    144       { fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
134     else                                          145     else
135       {                                           146       {
136   G4Exception("G4WeightCutOffProcess::StartTra    147   G4Exception("G4WeightCutOffProcess::StartTracking",
137         "ProcParaWorld000",FatalException,        148         "ProcParaWorld000",FatalException,
138         "G4WeightCutOffProcess is used for tra    149         "G4WeightCutOffProcess is used for tracking without having a parallel world assigned");
139       }                                           150       }
140 //++++++++++++++++++++++++++++++++++++++++++++    151 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
141                                                   152 
142 // G4cout << "G4ParallelWorldScoringProcess::S    153 // G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
143 //++++++++++++++++++++++++++++++++++++++++++++    154 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
144 // Let PathFinder initialize                      155 // Let PathFinder initialize
145 //++++++++++++++++++++++++++++++++++++++++++++    156 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
146     fPathFinder->PrepareNewTrack(trk->GetPosit    157     fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
147 //++++++++++++++++++++++++++++++++++++++++++++    158 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
148                                                   159 
149 //++++++++++++++++++++++++++++++++++++++++++++    160 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
150 // Setup initial touchables for the first step    161 // Setup initial touchables for the first step
151 //++++++++++++++++++++++++++++++++++++++++++++    162 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
152     fOldGhostTouchable = fPathFinder->CreateTo    163     fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
153     fGhostPreStepPoint->SetTouchableHandle(fOl    164     fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
154     fNewGhostTouchable = fOldGhostTouchable;      165     fNewGhostTouchable = fOldGhostTouchable;
155     fGhostPostStepPoint->SetTouchableHandle(fN    166     fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
156                                                   167     
157     // Initialize                                 168     // Initialize 
158     fGhostSafety = -1.;                           169     fGhostSafety = -1.;
159     fOnBoundary = false;                          170     fOnBoundary = false;
160   }                                               171   }
161 }                                                 172 }
162                                                   173 
163                                                   174 
164 G4double G4WeightCutOffProcess::                  175 G4double G4WeightCutOffProcess::
165 PostStepGetPhysicalInteractionLength(const G4T    176 PostStepGetPhysicalInteractionLength(const G4Track &,
166                                      G4double,    177                                      G4double, G4ForceCondition* condition)
167 {                                                 178 {
168 //   *condition = Forced;                         179 //   *condition = Forced;
169 //   return kInfinity;                            180 //   return kInfinity;
170                                                   181 
171 //  *condition = StronglyForced;                  182 //  *condition = StronglyForced;
172   *condition = Forced;                            183   *condition = Forced;
173   return DBL_MAX;                                 184   return DBL_MAX;
174 }                                                 185 }
175                                                   186   
176 G4VParticleChange *                               187 G4VParticleChange * 
177 G4WeightCutOffProcess::PostStepDoIt(const G4Tr    188 G4WeightCutOffProcess::PostStepDoIt(const G4Track& aTrack, 
178                                     const G4St    189                                     const G4Step &aStep)
179 {                                                 190 {
180   fParticleChange->Initialize(aTrack);            191   fParticleChange->Initialize(aTrack);
181                                                   192 
182   if(fParaflag) {                                 193   if(fParaflag) {
183     fOldGhostTouchable = fGhostPostStepPoint->    194     fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
184     //xbug?    fOnBoundary = false;               195     //xbug?    fOnBoundary = false;
185     CopyStep(aStep);                              196     CopyStep(aStep);
186                                                   197 
187     if(fOnBoundary)                               198     if(fOnBoundary)
188       {                                           199       {
189 //++++++++++++++++++++++++++++++++++++++++++++    200 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
190 // Locate the point and get new touchable         201 // Locate the point and get new touchable
191 //++++++++++++++++++++++++++++++++++++++++++++    202 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
192   //??  fPathFinder->Locate(step.GetPostStepPo    203   //??  fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
193   //??                      step.GetPostStepPo    204   //??                      step.GetPostStepPoint()->GetMomentumDirection());
194   fNewGhostTouchable = fPathFinder->CreateTouc    205   fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
195 //++++++++++++++++++++++++++++++++++++++++++++    206 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
196       }                                           207       }
197     else                                          208     else
198       {                                           209       {
199   // Do I need this ??????????????????????????    210   // Do I need this ??????????????????????????????????????????????????????????
200   // fGhostNavigator->LocateGlobalPointWithinV    211   // fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
201   // ?????????????????????????????????????????    212   // ?????????????????????????????????????????????????????????????????????????
202                                                   213   
203   // fPathFinder->ReLocate(track.GetPosition()    214   // fPathFinder->ReLocate(track.GetPosition());
204                                                   215   
205   // reuse the touchable                          216   // reuse the touchable
206   fNewGhostTouchable = fOldGhostTouchable;        217   fNewGhostTouchable = fOldGhostTouchable;
207       }                                           218       }
208                                                   219     
209     fGhostPreStepPoint->SetTouchableHandle(fOl    220     fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
210     fGhostPostStepPoint->SetTouchableHandle(fN    221     fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
211                                                   222 
212   }                                               223   }
213                                                   224 
214   if(fParaflag) {                                 225   if(fParaflag) {
215     G4GeometryCell postCell(*(fGhostPostStepPo    226     G4GeometryCell postCell(*(fGhostPostStepPoint->GetPhysicalVolume()), 
216           fGhostPostStepPoint->GetTouchable()-    227           fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
217                                                   228 
218                                                   229 
219     //  G4GeometryCell postCell = fGCellFinder    230     //  G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
220     //  G4GeometryCell postCell = fGCellFinder    231     //  G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
221     G4double R = fSourceImportance;               232     G4double R = fSourceImportance;
222     if (fIStore != nullptr)                    << 233     if (fIStore)
223       {                                           234       {
224   G4double i = fIStore->GetImportance(postCell    235   G4double i = fIStore->GetImportance(postCell);
225   if (i>0)                                        236   if (i>0)
226     {                                             237     {
227       R/=i;                                       238       R/=i;
228     }                                             239     }
229       }                                           240       }
230     G4double w = aTrack.GetWeight();              241     G4double w = aTrack.GetWeight();
231     if (w<R*fWeightLimit)                         242     if (w<R*fWeightLimit)
232       {                                           243       {
233   G4double ws = fWeightSurvival*R;                244   G4double ws = fWeightSurvival*R;
234   G4double p = w/(ws);                            245   G4double p = w/(ws);
235   if (G4UniformRand()<p)                          246   if (G4UniformRand()<p)
236     {                                             247     {
237       fParticleChange->ProposeTrackStatus(fSto    248       fParticleChange->ProposeTrackStatus(fStopAndKill);
238     }                                             249     }
239   else                                            250   else
240     {                                             251     {
241       fParticleChange->ProposeWeight(ws);         252       fParticleChange->ProposeWeight(ws);
242     }                                             253     }                  
243       }                                           254       }
244   } else {                                        255   } else {
245                                                   256 
246     G4GeometryCell postCell(*(aStep.GetPostSte    257     G4GeometryCell postCell(*(aStep.GetPostStepPoint()->GetPhysicalVolume()), 
247           aStep.GetPostStepPoint()->GetTouchab    258           aStep.GetPostStepPoint()->GetTouchable()->GetReplicaNumber());
248                                                   259 
249     //  G4GeometryCell postCell = fGCellFinder    260     //  G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
250     //  G4GeometryCell postCell = fGCellFinder    261     //  G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
251     G4double R = fSourceImportance;               262     G4double R = fSourceImportance;
252     if (fIStore != nullptr)                    << 263     if (fIStore)
253       {                                           264       {
254   G4double i = fIStore->GetImportance(postCell    265   G4double i = fIStore->GetImportance(postCell);
255   if (i>0)                                        266   if (i>0)
256     {                                             267     {
257       R/=i;                                       268       R/=i;
258     }                                             269     }
259       }                                           270       }
260     G4double w = aTrack.GetWeight();              271     G4double w = aTrack.GetWeight();
261     if (w<R*fWeightLimit)                         272     if (w<R*fWeightLimit)
262       {                                           273       {
263   G4double ws = fWeightSurvival*R;                274   G4double ws = fWeightSurvival*R;
264   G4double p = w/(ws);                            275   G4double p = w/(ws);
265   if (G4UniformRand()<p)                          276   if (G4UniformRand()<p)
266     {                                             277     {
267       fParticleChange->ProposeTrackStatus(fSto    278       fParticleChange->ProposeTrackStatus(fStopAndKill);
268     }                                             279     }
269   else                                            280   else
270     {                                             281     {
271       fParticleChange->ProposeWeight(ws);         282       fParticleChange->ProposeWeight(ws);
272     }                                             283     }                  
273       }                                           284       }
274   }                                               285   }
275                                                   286 
276   return fParticleChange;                         287   return fParticleChange;
277                                                   288 
278 }                                                 289 }
279                                                   290 
280 const G4String &G4WeightCutOffProcess::GetName    291 const G4String &G4WeightCutOffProcess::GetName() const
281 {                                                 292 {
282   return theProcessName;                          293   return theProcessName;
283 }                                                 294 }
284                                                   295 
285 G4double G4WeightCutOffProcess::                  296 G4double G4WeightCutOffProcess::
286 AlongStepGetPhysicalInteractionLength(            297 AlongStepGetPhysicalInteractionLength(
287             const G4Track& track, G4double  pr    298             const G4Track& track, G4double  previousStepSize, G4double  currentMinimumStep,
288             G4double& proposedSafety, G4GPILSe    299             G4double& proposedSafety, G4GPILSelection* selection)
289 {                                                 300 {
290   if(fParaflag) {                                 301   if(fParaflag) {
291                                                   302     
292     *selection = NotCandidateForSelection;        303     *selection = NotCandidateForSelection;
293     G4double returnedStep = DBL_MAX;              304     G4double returnedStep = DBL_MAX;
294                                                   305     
295     if (previousStepSize > 0.)                    306     if (previousStepSize > 0.)
296       { fGhostSafety -= previousStepSize; }       307       { fGhostSafety -= previousStepSize; }
297     //  else                                      308     //  else
298     //  { fGhostSafety = -1.; }                   309     //  { fGhostSafety = -1.; }
299     if (fGhostSafety < 0.) fGhostSafety = 0.0;    310     if (fGhostSafety < 0.) fGhostSafety = 0.0;
300                                                   311     
301     // ---------------------------------------    312     // ------------------------------------------
302     // Determination of the proposed STEP LENG    313     // Determination of the proposed STEP LENGTH:
303     // ---------------------------------------    314     // ------------------------------------------
304     if (currentMinimumStep <= fGhostSafety &&     315     if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
305       {                                           316       {
306   // I have no chance to limit                    317   // I have no chance to limit
307   returnedStep = currentMinimumStep;              318   returnedStep = currentMinimumStep;
308   fOnBoundary = false;                            319   fOnBoundary = false;
309   proposedSafety = fGhostSafety - currentMinim    320   proposedSafety = fGhostSafety - currentMinimumStep;
310       }                                           321       }
311     else // (currentMinimumStep > fGhostSafety    322     else // (currentMinimumStep > fGhostSafety: I may limit the Step)
312       {                                           323       {
313   G4FieldTrackUpdator::Update(&fFieldTrack,&tr    324   G4FieldTrackUpdator::Update(&fFieldTrack,&track);
314   //++++++++++++++++++++++++++++++++++++++++++    325   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
315   // ComputeStep                                  326   // ComputeStep
316   //++++++++++++++++++++++++++++++++++++++++++    327   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
317   returnedStep                                    328   returnedStep
318     = fPathFinder->ComputeStep(fFieldTrack,cur    329     = fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
319              track.GetCurrentStepNumber(),fGho    330              track.GetCurrentStepNumber(),fGhostSafety,feLimited,
320              fEndTrack,track.GetVolume());        331              fEndTrack,track.GetVolume());
321   //++++++++++++++++++++++++++++++++++++++++++    332   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
322   if(feLimited == kDoNot)                         333   if(feLimited == kDoNot)
323     {                                             334     {
324       // Track is not on the boundary             335       // Track is not on the boundary
325       fOnBoundary = false;                        336       fOnBoundary = false;
326       fGhostSafety = fGhostNavigator->ComputeS    337       fGhostSafety = fGhostNavigator->ComputeSafety(fEndTrack.GetPosition());
327     }                                             338     }
328   else                                            339   else
329     {                                             340     {
330       // Track is on the boundary                 341       // Track is on the boundary
331       fOnBoundary = true;                         342       fOnBoundary = true;
332       proposedSafety = fGhostSafety;              343       proposedSafety = fGhostSafety;
333     }                                             344     }
334   //xbug? proposedSafety = fGhostSafety;          345   //xbug? proposedSafety = fGhostSafety;
335   if(feLimited == kUnique || feLimited == kSha    346   if(feLimited == kUnique || feLimited == kSharedOther) {
336     *selection = CandidateForSelection;           347     *selection = CandidateForSelection;
337   }else if (feLimited == kSharedTransport) {      348   }else if (feLimited == kSharedTransport) { 
338     returnedStep *= (1.0 + 1.0e-9);               349     returnedStep *= (1.0 + 1.0e-9);  
339     // Expand to disable its selection in Step    350     // Expand to disable its selection in Step Manager comparison
340   }                                               351   }
341                                                   352   
342       }                                           353       }
343                                                   354 
344   // -----------------------------------------    355   // ----------------------------------------------
345   // Returns the fGhostSafety as the proposedS    356   // Returns the fGhostSafety as the proposedSafety
346   // The SteppingManager will take care of kee    357   // The SteppingManager will take care of keeping
347   // the smallest one.                            358   // the smallest one.
348   // -----------------------------------------    359   // ----------------------------------------------
349     return returnedStep;                          360     return returnedStep;
350                                                   361 
351   } else {                                        362   } else {
352     return DBL_MAX;                               363     return DBL_MAX;
353     //not sensible!    return -1.0;               364     //not sensible!    return -1.0;
354   }                                               365   }
355                                                   366 
356 }                                                 367 }
357                                                   368 
358                                                   369   
359 G4double G4WeightCutOffProcess::                  370 G4double G4WeightCutOffProcess::
360 AtRestGetPhysicalInteractionLength(const G4Tra    371 AtRestGetPhysicalInteractionLength(const G4Track& ,
361                                    G4ForceCond    372                                    G4ForceCondition*)
362 {                                                 373 {
363   return -1.0;                                    374   return -1.0;
364 }                                                 375 }
365                                                   376   
366 G4VParticleChange*                                377 G4VParticleChange*
367 G4WeightCutOffProcess::AtRestDoIt(const G4Trac    378 G4WeightCutOffProcess::AtRestDoIt(const G4Track&, const G4Step&)
368 {                                                 379 {
369   return nullptr;                              << 380   return 0;
370 }                                                 381 }
371                                                   382 
372 G4VParticleChange*                                383 G4VParticleChange*
373 G4WeightCutOffProcess::AlongStepDoIt(const G4T    384 G4WeightCutOffProcess::AlongStepDoIt(const G4Track& track, const G4Step&)
374 {                                                 385 {
375   // Dummy ParticleChange ie: does nothing        386   // Dummy ParticleChange ie: does nothing
376   // Expecting G4Transportation to move the tr    387   // Expecting G4Transportation to move the track
377   pParticleChange->Initialize(track);             388   pParticleChange->Initialize(track);
378   return pParticleChange;                         389   return pParticleChange; 
                                                   >> 390 
                                                   >> 391   //  return 0;
379 }                                                 392 }
380                                                   393 
381 void G4WeightCutOffProcess::CopyStep(const G4S    394 void G4WeightCutOffProcess::CopyStep(const G4Step & step)
382 {                                                 395 {
383   fGhostStep->SetTrack(step.GetTrack());          396   fGhostStep->SetTrack(step.GetTrack());
384   fGhostStep->SetStepLength(step.GetStepLength    397   fGhostStep->SetStepLength(step.GetStepLength());
385   fGhostStep->SetTotalEnergyDeposit(step.GetTo    398   fGhostStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
386   fGhostStep->SetControlFlag(step.GetControlFl    399   fGhostStep->SetControlFlag(step.GetControlFlag());
387                                                   400 
388   *fGhostPreStepPoint = *(step.GetPreStepPoint    401   *fGhostPreStepPoint = *(step.GetPreStepPoint());
389   *fGhostPostStepPoint = *(step.GetPostStepPoi    402   *fGhostPostStepPoint = *(step.GetPostStepPoint());
390                                                   403 
391 //++++++++++++++++++++++++++++++++++++++++++++    404 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
392 // Set StepStatus for ghost world                 405 // Set StepStatus for ghost world
393 //++++++++++++++++++++++++++++++++++++++++++++    406 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
394   if(fOnBoundary)                                 407   if(fOnBoundary)
395   { fGhostPostStepPoint->SetStepStatus(fGeomBo    408   { fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
396   else if(fGhostPostStepPoint->GetStepStatus()    409   else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
397   { fGhostPostStepPoint->SetStepStatus(fPostSt    410   { fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
398 //++++++++++++++++++++++++++++++++++++++++++++    411 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
399 }                                                 412 }
400                                                   413