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 // 26 // >> 27 // $Id: G4FastSimulationManager.cc 68056 2013-03-13 14:44:48Z gcosmo $ 27 // 28 // 28 //-------------------------------------------- 29 //--------------------------------------------------------------- 29 // 30 // 30 // G4FastSimulationManager.cc 31 // G4FastSimulationManager.cc 31 // 32 // 32 // Description: 33 // Description: 33 // Manages the Fast Simulation models attac 34 // Manages the Fast Simulation models attached to a envelope. 34 // 35 // 35 // History: 36 // History: 36 // Oct 97: Verderi && MoraDeFreitas - First 37 // Oct 97: Verderi && MoraDeFreitas - First Implementation. 37 // ... 38 // ... 38 // May 07: Move to parallel world scheme 39 // May 07: Move to parallel world scheme 39 // 40 // 40 //-------------------------------------------- 41 //--------------------------------------------------------------- 41 42 42 #include "G4FastSimulationManager.hh" 43 #include "G4FastSimulationManager.hh" 43 << 44 #include "G4GlobalFastSimulationManager.hh" 44 #include "G4GlobalFastSimulationManager.hh" 45 #include "G4PVPlacement.hh" 45 #include "G4PVPlacement.hh" 46 #include "G4TransportationManager.hh" 46 #include "G4TransportationManager.hh" 47 47 48 // ------------------------------------------- 48 // -------------------------------------------------- 49 // Constructor with envelope and IsUnique flag 49 // Constructor with envelope and IsUnique flag : 50 // ------------------------------------------- 50 // -------------------------------------------------- 51 // 51 // 52 G4FastSimulationManager::G4FastSimulationManag << 52 G4FastSimulationManager:: 53 : fFastTrack(anEnvelope, IsUnique) << 53 G4FastSimulationManager(G4Envelope *anEnvelope, >> 54 G4bool IsUnique) : >> 55 fFastTrack(anEnvelope,IsUnique),fTriggedFastSimulationModel(0), >> 56 fLastCrossedParticle(0) 54 { 57 { 55 // Communicates to the region that it become 58 // Communicates to the region that it becomes a 56 // envelope and with this fast simulation ma 59 // envelope and with this fast simulation manager. 57 anEnvelope->SetFastSimulationManager(this); 60 anEnvelope->SetFastSimulationManager(this); 58 61 59 // Add itself to the GlobalFastSimulationMan << 62 // Add itself to the GlobalFastSimulationManager 60 G4GlobalFastSimulationManager::GetGlobalFast << 63 G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()-> >> 64 AddFastSimulationManager(this); 61 } 65 } 62 66 63 // ----------- 67 // ----------- 64 // Destructor: 68 // Destructor: 65 // ----------- 69 // ----------- 66 G4FastSimulationManager::~G4FastSimulationMana 70 G4FastSimulationManager::~G4FastSimulationManager() 67 { 71 { 68 // 72 // 69 // Check out the Envelope about this pointer << 73 // Check out the Envelope about this pointer. If in use, 70 // resets the Logical Volume IsEnvelope flag 74 // resets the Logical Volume IsEnvelope flag to avoid clash. 71 // 75 // 72 if (fFastTrack.GetEnvelope()->GetFastSimulat << 76 if(fFastTrack.GetEnvelope()->GetFastSimulationManager()==this) 73 fFastTrack.GetEnvelope()->ClearFastSimulat 77 fFastTrack.GetEnvelope()->ClearFastSimulationManager(); 74 // Remove itself from the GlobalFastSimulati << 78 // Remove itself from the GlobalFastSimulationManager 75 G4GlobalFastSimulationManager::GetGlobalFast << 79 G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()-> 76 this); << 80 RemoveFastSimulationManager(this); 77 } 81 } 78 82 79 // --------------------------------------- 83 // --------------------------------------- 80 // Methods to activate/inactivate models 84 // Methods to activate/inactivate models 81 //---------------------------------------- 85 //---------------------------------------- 82 86 83 G4bool G4FastSimulationManager::ActivateFastSi << 87 G4bool >> 88 G4FastSimulationManager::ActivateFastSimulationModel(const G4String& aName) 84 { 89 { 85 G4int iModel; << 90 size_t iModel; 86 91 87 // If the model is already active, do nothin 92 // If the model is already active, do nothing. 88 for (iModel = 0; iModel < (G4int)ModelList.s << 93 for (iModel=0; iModel<ModelList.size(); iModel++) 89 if (ModelList[iModel]->GetName() == aName) << 94 if(ModelList[iModel]->GetName() == aName) 90 << 95 return true; 91 // Look for in the fInactivatedModels list, << 96 >> 97 // Look for in the fInactivatedModels list, if found push_back it back to 92 // the ModelList 98 // the ModelList 93 for (iModel = 0; iModel < (G4int)fInactivate << 99 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 94 if (fInactivatedModels[iModel]->GetName() << 100 if(fInactivatedModels[iModel]->GetName() == aName) { 95 ModelList.push_back(fInactivatedModels.r << 101 ModelList. >> 102 push_back (fInactivatedModels.removeAt(iModel)); 96 // forces the fApplicableModelList to be 103 // forces the fApplicableModelList to be rebuild 97 fLastCrossedParticle = nullptr; << 104 fLastCrossedParticle=0; 98 return true; 105 return true; 99 } 106 } 100 return false; 107 return false; 101 } 108 } 102 109 103 G4bool G4FastSimulationManager::InActivateFast << 110 G4bool >> 111 G4FastSimulationManager::InActivateFastSimulationModel(const G4String& aName) 104 { 112 { 105 // Look for in the ModelList, if found remov << 113 // Look for in the ModelList, if found remove from it and keep the pointer 106 // on the fInactivatedModels list. 114 // on the fInactivatedModels list. 107 for (G4int iModel = 0; iModel < (G4int)Model << 115 for (size_t iModel=0; iModel<ModelList.size(); iModel++) 108 if (ModelList[iModel]->GetName() == aName) << 116 if(ModelList[iModel]->GetName() == aName) { 109 fInactivatedModels.push_back(ModelList.r << 117 fInactivatedModels. >> 118 push_back (ModelList.removeAt(iModel)); 110 // forces the fApplicableModelList to be 119 // forces the fApplicableModelList to be rebuild 111 fLastCrossedParticle = nullptr; << 120 fLastCrossedParticle=0; 112 return true; 121 return true; 113 } 122 } 114 return false; 123 return false; 115 } 124 } 116 125 117 G4VFastSimulationModel* << 126 G4VFastSimulationModel* 118 G4FastSimulationManager::GetFastSimulationMode 127 G4FastSimulationManager::GetFastSimulationModel(const G4String& modelName, 119 << 128 const G4VFastSimulationModel* previousFound, 120 << 129 bool &foundPrevious) const 121 { 130 { 122 G4VFastSimulationModel* model = nullptr; << 131 G4VFastSimulationModel* model = 0; 123 for (auto iModel : ModelList) { << 132 for (size_t iModel=0; iModel<ModelList.size(); iModel++) 124 if (iModel->GetName() == modelName) { << 133 { 125 if (previousFound == nullptr) { << 134 if(ModelList[iModel]->GetName() == modelName) 126 model = iModel; << 135 { 127 break; << 136 if (previousFound == 0) 128 } << 137 { 129 if (iModel == previousFound) { << 138 model = ModelList[iModel]; 130 foundPrevious = true; << 139 break; 131 continue; << 140 } 132 } << 141 else 133 if (foundPrevious) { << 142 { 134 model = iModel; << 143 if (ModelList[iModel] == previousFound) 135 break; << 144 { 136 } << 145 foundPrevious = true; >> 146 continue; >> 147 } >> 148 if (foundPrevious) >> 149 { >> 150 model = ModelList[iModel]; >> 151 break; >> 152 } >> 153 } >> 154 } 137 } 155 } 138 } << 139 return model; 156 return model; 140 } 157 } 141 158 142 void G4FastSimulationManager::FlushModels() << 143 { << 144 for (auto& iModel : ModelList) { << 145 iModel->Flush(); << 146 } << 147 } << 148 159 149 //-------------------------------------------- 160 //------------------------------------------------------------------ 150 // Interface trigger method for the G4Paramete 161 // Interface trigger method for the G4ParameterisationManagerProcess 151 //-------------------------------------------- 162 //------------------------------------------------------------------ 152 // G4bool GetFastSimulationManagerTrigger(co 163 // G4bool GetFastSimulationManagerTrigger(const G4Track &); 153 // 164 // 154 // This method is used to interface the G4F 165 // This method is used to interface the G4FastSimulationManagerProcess 155 // with the user Fast Simulation Models. It << 166 // with the user Fast Simulation Models. It's called when the particle 156 // is inside the envelope. 167 // is inside the envelope. 157 // 168 // 158 // It : 169 // It : 159 // 170 // 160 // 1) initialises the private members (fF 171 // 1) initialises the private members (fFastTrack and so 161 // on); 172 // on); 162 // 2) loops on the IsApplicable() methods 173 // 2) loops on the IsApplicable() methods to find out the 163 // ones should be applied. 174 // ones should be applied. 164 // 2) for these, loops on the ModelTrigge << 175 // 2) for these, loops on the ModelTrigger() methods to find out 165 // perhaps one that must be applied ju 176 // perhaps one that must be applied just now. 166 // 177 // 167 // If the a Fast Simulation Model is trigge << 178 // If the a Fast Simulation Model is triggered then it returns 168 // true, false otherwise. 179 // true, false otherwise. 169 // 180 // 170 //-------------------------------------------- 181 //----------------------------------------------------------- 171 G4bool << 182 G4bool 172 G4FastSimulationManager::PostStepGetFastSimula << 183 G4FastSimulationManager:: 173 << 184 PostStepGetFastSimulationManagerTrigger(const G4Track& track, >> 185 const G4Navigator* theNavigator) 174 { 186 { >> 187 size_t iModel; >> 188 175 // If particle type changed re-build the fAp 189 // If particle type changed re-build the fApplicableModelList. 176 if (fLastCrossedParticle != track.GetDefinit << 190 if(fLastCrossedParticle!=track.GetDefinition()) { 177 fLastCrossedParticle = track.GetDefinition << 191 fLastCrossedParticle=track.GetDefinition(); 178 fApplicableModelList.clear(); 192 fApplicableModelList.clear(); 179 // If Model List is empty, do nothing ! 193 // If Model List is empty, do nothing ! 180 if (ModelList.empty()) return false; << 194 if(ModelList.size()==0) return false; 181 << 195 for (iModel=0; iModel<ModelList.size(); iModel++) 182 for (auto iModel : ModelList) { << 196 if(ModelList[iModel]->IsApplicable(*(track.GetDefinition()))) 183 if (iModel->IsApplicable(*(track.GetDefi << 197 fApplicableModelList.push_back (ModelList[iModel]); 184 fApplicableModelList.push_back(iModel) << 185 } << 186 } << 187 } 198 } 188 199 189 // If Applicable Model List is empty, do not 200 // If Applicable Model List is empty, do nothing ! 190 if (fApplicableModelList.empty()) return fal << 201 if(fApplicableModelList.size()==0) return false; 191 202 192 // -- Register current track 203 // -- Register current track 193 fFastTrack.SetCurrentTrack(track, theNavigat << 204 fFastTrack.SetCurrentTrack(track,theNavigator); 194 205 195 // tests if particle are on the boundary and 206 // tests if particle are on the boundary and leaving, 196 // in this case do nothing ! 207 // in this case do nothing ! 197 if (fFastTrack.OnTheBoundaryButExiting()) re << 208 if(fFastTrack.OnTheBoundaryButExiting()) return false; 198 << 209 199 // Loops on the ModelTrigger() methods 210 // Loops on the ModelTrigger() methods 200 for (auto iModel : fApplicableModelList) << 211 for (iModel=0; iModel<fApplicableModelList.size(); iModel++) >> 212 201 //---------------------------------------- 213 //--------------------------------------------------- 202 // Asks the ModelTrigger method if it must 214 // Asks the ModelTrigger method if it must be trigged now. 203 //---------------------------------------- 215 //--------------------------------------------------- 204 << 216 205 if (iModel->ModelTrigger(fFastTrack)) { << 217 if(fApplicableModelList[iModel]->ModelTrigger(fFastTrack)) { 206 //-------------------------------------- 218 //-------------------------------------------------- 207 // The model will be applied. Initialize << 219 // The model will be applied. Initializes the G4FastStep 208 // with the current state of the G4Track << 220 // with the current state of the G4Track and 209 // same usefull parameters. 221 // same usefull parameters. 210 // In particular it does SetLocalEnergyD 222 // In particular it does SetLocalEnergyDeposit(0.0). 211 //-------------------------------------- << 223 //-------------------------------------------------- 212 fFastStep.Initialize(fFastTrack); 224 fFastStep.Initialize(fFastTrack); 213 << 225 214 // Keeps the FastSimulationModel pointer 226 // Keeps the FastSimulationModel pointer to call the 215 // DoIt() method. 227 // DoIt() method. 216 fTriggedFastSimulationModel = iModel; << 228 fTriggedFastSimulationModel=fApplicableModelList[iModel]; 217 return true; 229 return true; 218 } 230 } 219 231 220 //------------------------------------------ 232 //-------------------------------------------- 221 // Nobody asks to gain control, returns fals 233 // Nobody asks to gain control, returns false 222 //------------------------------------------ 234 //-------------------------------------------- 223 return false; 235 return false; 224 } 236 } 225 237 226 G4VParticleChange* G4FastSimulationManager::In << 238 G4VParticleChange* G4FastSimulationManager::InvokePostStepDoIt() 227 { 239 { 228 fTriggedFastSimulationModel->DoIt(fFastTrack << 240 // const G4FastTrack& parFastTrack=fFastTrack; >> 241 fTriggedFastSimulationModel->DoIt(fFastTrack,fFastStep); 229 return &fFastStep; 242 return &fFastStep; 230 } 243 } 231 244 232 // ------------------------------------------- 245 // ------------------------------------------------------------- 233 // -- Mostly the same as above, in the case of 246 // -- Mostly the same as above, in the case of AtRest particles: 234 // ------------------------------------------- 247 // ------------------------------------------------------------- 235 G4bool << 248 G4bool 236 G4FastSimulationManager::AtRestGetFastSimulati 249 G4FastSimulationManager::AtRestGetFastSimulationManagerTrigger(const G4Track& track, 237 << 250 const G4Navigator* theNavigator) 238 { 251 { >> 252 size_t iModel; >> 253 239 // If particle type changed re-build the fAp 254 // If particle type changed re-build the fApplicableModelList. 240 if (fLastCrossedParticle != track.GetDefinit << 255 if(fLastCrossedParticle!=track.GetDefinition()) { 241 fLastCrossedParticle = track.GetDefinition << 256 fLastCrossedParticle=track.GetDefinition(); 242 fApplicableModelList.clear(); 257 fApplicableModelList.clear(); 243 // If Model List is empty, do nothing ! 258 // If Model List is empty, do nothing ! 244 if (ModelList.empty()) return false; << 259 if(ModelList.size()==0) return false; 245 << 260 for (iModel=0; iModel<ModelList.size(); iModel++) 246 for (auto iModel : ModelList) { << 261 if(ModelList[iModel]->IsApplicable(*(track.GetDefinition()))) 247 if (iModel->IsApplicable(*(track.GetDefi << 262 fApplicableModelList.push_back (ModelList[iModel]); 248 fApplicableModelList.push_back(iModel) << 249 } << 250 } << 251 } 263 } 252 << 264 253 // If Applicable Model List is empty, do not 265 // If Applicable Model List is empty, do nothing ! 254 if (fApplicableModelList.empty()) return fal << 266 if(fApplicableModelList.size()==0) return false; 255 267 256 // -- Register current track 268 // -- Register current track 257 fFastTrack.SetCurrentTrack(track, theNavigat << 269 fFastTrack.SetCurrentTrack(track,theNavigator); 258 << 270 259 // -- (note: compared to the PostStepGetFast 271 // -- (note: compared to the PostStepGetFastSimulationManagerTrigger, 260 // -- the test to see if the particle is on 272 // -- the test to see if the particle is on the boundary but leaving 261 // -- is irrelevant here) 273 // -- is irrelevant here) 262 << 274 263 // Loops on the models to see if one of them 275 // Loops on the models to see if one of them wants to trigger: 264 for (auto iModel : fApplicableModelList) { << 276 for (iModel=0; iModel < fApplicableModelList.size(); iModel++) 265 if (iModel->AtRestModelTrigger(fFastTrack) << 277 if(fApplicableModelList[iModel]->AtRestModelTrigger(fFastTrack)) 266 fFastStep.Initialize(fFastTrack); << 278 { 267 fTriggedFastSimulationModel = iModel; << 279 fFastStep.Initialize(fFastTrack); 268 return true; << 280 fTriggedFastSimulationModel=fApplicableModelList[iModel]; 269 } << 281 return true; 270 } << 282 } >> 283 271 //------------------------------------------ 284 //-------------------------------------------- 272 // Nobody asks to gain control, returns fals 285 // Nobody asks to gain control, returns false 273 //------------------------------------------ 286 //-------------------------------------------- 274 return false; 287 return false; 275 } 288 } 276 289 277 G4VParticleChange* G4FastSimulationManager::In << 290 G4VParticleChange* G4FastSimulationManager::InvokeAtRestDoIt() 278 { 291 { 279 fTriggedFastSimulationModel->AtRestDoIt(fFas << 292 fTriggedFastSimulationModel->AtRestDoIt(fFastTrack,fFastStep); 280 return &fFastStep; 293 return &fFastStep; 281 } 294 } 282 295 283 void G4FastSimulationManager::ListTitle() cons << 296 void >> 297 G4FastSimulationManager::ListTitle() const 284 { 298 { 285 G4cout << fFastTrack.GetEnvelope()->GetName( 299 G4cout << fFastTrack.GetEnvelope()->GetName(); 286 if (fFastTrack.GetEnvelope()->GetWorldPhysic << 300 // if(GhostPlacements.size()!=0) G4cout << " (ghost)"; 287 == G4TransportationManager::GetTransport << 301 if (fFastTrack.GetEnvelope()->GetWorldPhysical() == G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()) G4cout << " (mass geom.)"; 288 ->GetNavigatorForTracking() << 302 else G4cout << " (// geom.)"; 289 ->GetWorldVolume()) << 303 290 G4cout << " (mass geom.)"; << 291 else << 292 G4cout << " (// geom.)"; << 293 } 304 } 294 305 295 void G4FastSimulationManager::ListModels() con << 306 void >> 307 G4FastSimulationManager::ListModels() const 296 { 308 { >> 309 size_t iModel; >> 310 297 G4cout << "Current Models for the "; 311 G4cout << "Current Models for the "; 298 ListTitle(); 312 ListTitle(); 299 G4cout << " envelope:\n"; 313 G4cout << " envelope:\n"; 300 314 301 for (auto iModel : ModelList) << 315 for (iModel=0; iModel<ModelList.size(); iModel++) 302 G4cout << " " << iModel->GetName() << "\ << 316 G4cout << " " << ModelList[iModel]->GetName() << "\n"; 303 317 304 for (auto iModel : fInactivatedModels) << 318 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 305 G4cout << " " << iModel->GetName() << "( << 319 G4cout << " " << fInactivatedModels[iModel]->GetName() >> 320 << "(inactivated)\n"; 306 } 321 } 307 322 308 void G4FastSimulationManager::ListModels(const << 323 void >> 324 G4FastSimulationManager::ListModels(const G4String& aName) const 309 { 325 { 310 std::size_t iModel; << 326 size_t iModel; 311 G4int titled = 0; 327 G4int titled = 0; 312 G4ParticleTable* theParticleTable = G4Partic << 328 G4ParticleTable* theParticleTable= 313 << 329 G4ParticleTable::GetParticleTable(); >> 330 314 // Active Models 331 // Active Models 315 for (iModel = 0; iModel < ModelList.size(); << 332 for (iModel=0; iModel<ModelList.size(); iModel++) 316 if (ModelList[iModel]->GetName() == modelN << 333 if(ModelList[iModel]->GetName() == aName || 317 if ((titled++) == 0) { << 334 aName == "all" ) { 318 G4cout << "In the envelope "; << 335 if(!(titled++)){ 319 ListTitle(); << 336 G4cout << "In the envelope "; 320 G4cout << ",\n"; << 337 ListTitle(); >> 338 G4cout << ",\n"; 321 } 339 } 322 G4cout << " the model " << ModelList[iM << 340 G4cout << " the model " << ModelList[iModel]->GetName() 323 << 341 << " is applicable for :\n "; 324 G4int list_started = 0; << 342 325 for (G4int iParticle = 0; iParticle < th << 343 G4int list_started=0; 326 if (ModelList[iModel]->IsApplicable(*( << 344 for (G4int iParticle=0; iParticle<theParticleTable->entries(); 327 if ((list_started++) != 0) G4cout << << 345 iParticle++) 328 G4cout << theParticleTable->GetParti << 346 if(ModelList[iModel]-> 329 } << 347 IsApplicable(*(theParticleTable-> 330 G4cout << G4endl; << 348 GetParticle(iParticle)))) { >> 349 if(list_started++) G4cout << ", "; >> 350 G4cout << theParticleTable-> >> 351 GetParticle(iParticle)->GetParticleName(); >> 352 } >> 353 G4cout <<G4endl; 331 } 354 } 332 << 355 333 // Inactive Models 356 // Inactive Models 334 for (iModel = 0; iModel < fInactivatedModels << 357 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 335 if (fInactivatedModels[iModel]->GetName() << 358 if(fInactivatedModels[iModel]->GetName() == aName || 336 if ((titled++) == 0) { << 359 aName == "all" ) { 337 G4cout << "In the envelope "; << 360 if(!(titled++)){ 338 ListTitle(); << 361 G4cout << "In the envelope "; 339 G4cout << ",\n"; << 362 ListTitle(); >> 363 G4cout << ",\n"; 340 } 364 } 341 G4cout << " the model " << fInactivated 365 G4cout << " the model " << fInactivatedModels[iModel]->GetName() 342 << " (inactivated) is applicable << 366 << " (inactivated) is applicable for :\n "; 343 << 367 344 G4int list_started = 0; << 368 G4int list_started=0; 345 for (G4int iParticle = 0; iParticle < th << 369 for (G4int iParticle=0; iParticle<theParticleTable->entries(); 346 if (fInactivatedModels[iModel]->IsAppl << 370 iParticle++) 347 if ((list_started++) != 0) G4cout << << 371 if(fInactivatedModels[iModel]-> 348 G4cout << theParticleTable->GetParti << 372 IsApplicable(*(theParticleTable-> 349 } << 373 GetParticle(iParticle)))) { 350 G4cout << G4endl; << 374 if(list_started++) G4cout << ", "; >> 375 G4cout << theParticleTable-> >> 376 GetParticle(iParticle)->GetParticleName(); >> 377 } >> 378 G4cout <<G4endl; 351 } 379 } 352 } 380 } 353 381 354 void G4FastSimulationManager::ListModels(const << 382 void 355 { << 383 G4FastSimulationManager::ListModels(const G4ParticleDefinition* aPD) const 356 std::size_t iModel; << 384 { 357 G4bool unique = true; << 385 size_t iModel; 358 << 386 G4bool unique=true; >> 387 359 // Active Models 388 // Active Models 360 for (iModel = 0; iModel < ModelList.size(); << 389 for (iModel=0; iModel<ModelList.size(); iModel++) 361 if (ModelList[iModel]->IsApplicable(*parti << 390 if(ModelList[iModel]->IsApplicable(*aPD)) { 362 G4cout << "Envelope "; 391 G4cout << "Envelope "; 363 ListTitle(); 392 ListTitle(); 364 G4cout << ", Model " << ModelList[iModel << 393 G4cout << ", Model " 365 // -- Verify unicity of model attached t << 394 << ModelList[iModel]->GetName() 366 for (auto jModel = iModel + 1; jModel < << 395 << "." << G4endl; 367 if (ModelList[jModel]->IsApplicable(*p << 396 } 368 } << 397 // inactive Models 369 << 398 for (iModel=0; iModel<fInactivatedModels.size(); iModel++) 370 // Inactive Models << 399 if(fInactivatedModels[iModel]->IsApplicable(*aPD)) { 371 for (iModel = 0; iModel < fInactivatedModels << 372 if (fInactivatedModels[iModel]->IsApplicab << 373 G4cout << "Envelope "; 400 G4cout << "Envelope "; 374 ListTitle(); 401 ListTitle(); 375 G4cout << ", Model " << fInactivatedMode << 402 G4cout << ", Model " >> 403 << fInactivatedModels[iModel]->GetName() >> 404 << " (inactivated)." << G4endl; >> 405 } >> 406 >> 407 if( !unique ) >> 408 { >> 409 G4ExceptionDescription ed; >> 410 ed << "Two or more Models are available for the same particle type, in the same envelope/region." << G4endl; >> 411 G4Exception("G4FastSimulationManager::ListModels(const G4ParticleDefinition* aPD) const", >> 412 "FastSim001", >> 413 JustWarning, ed, >> 414 "Models risk to exclude each other."); 376 } 415 } 377 << 416 unique=false; 378 if (!unique) { << 379 G4ExceptionDescription ed; << 380 ed << "Two or more active Models are avail << 381 "envelope/region." << 382 << G4endl; << 383 G4Exception( << 384 "G4FastSimulationManager::ListModels(con << 385 "FastSim001", JustWarning, ed, "Models r << 386 } << 387 unique = false; << 388 } 417 } 389 418