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