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