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