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