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