1331 {
1332
1335
1337 if (!pScene) {
1339 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1340 }
1341 return;
1342 }
1343
1346 std::istringstream is (newValue);
1347 is >>
name >> copyNo;
1348
1349 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
1350
1351
1352 G4TransportationManager* transportationManager =
1354 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
1356 size_t nWorlds = transportationManager->
GetNoWorlds();
1357 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
1358 G4ModelingParameters mp;
1359 G4PhysicalVolumeModel searchModel
1360 (*iterWorld,
1363 &mp,
1364 true);
1365 G4PhysicalVolumesSearchScene searchScene
1366 (&searchModel, name, copyNo);
1367 searchModel.DescribeYourselfTo (searchScene);
1368 for (const auto& findings: searchScene.GetFindings()) {
1369 findingsVector.push_back(findings);
1370 }
1371 }
1372
1374 for (const auto& findings: findingsVector) {
1375
1376
1377 const auto& extent = findings.fpFoundPV->GetLogicalVolume()->GetSolid()->GetExtent();
1378 const auto& transform = findings.fFoundObjectTransformation;
1379
1380 const G4double lengthMax = extent.GetExtentRadius()/2.;
1381 const G4double intLog10LengthMax = std::floor(std::log10(lengthMax));
1382 G4double length = std::pow(10,intLog10LengthMax);
1383 if (5.*length < lengthMax) length *= 5.;
1384 else if (2.*length < lengthMax) length *= 2.;
1385
1386 const auto& axesModel = new G4AxesModel(0.,0.,0.,length,transform);
1387 axesModel->SetGlobalTag("LocalAxesModel");
1388 std::ostringstream oss; oss
1389 << "Local Axes for " << findings.fpFoundPV->GetName()
1390 << ':' << findings.fFoundPVCopyNo << ':' << id++;
1391 axesModel->SetGlobalDescription(oss.str());
1392
1394 if (successful) {
1396 G4cout <<
"\"" << findings.fpFoundPV->GetName()
1397 << "\", copy no. " << findings.fFoundPVCopyNo
1398 << ",\n found in searched volume \""
1399 << findings.fpSearchPV->GetName()
1400 << "\" at depth " << findings.fFoundDepth
1401 << ",\n base path: \"" << findings.fFoundBasePVPath
1402 << "\".\n Local axes have been added to scene \""
1403 << pScene->
GetName() <<
"\".";
1405 G4cout <<
" With extent " << extent
1406 << "\n at " << transform.getRotation()
1407 << " " << transform.getTranslation();
1408 }
1410 }
1411 } else {
1413 }
1414 }
1415
1416 if (findingsVector.empty()) {
1418 G4warn <<
"ERROR: Volume \"" <<
name <<
"\"";
1419 if (copyNo >= 0) {
1420 G4warn <<
", copy no. " << copyNo <<
",";
1421 }
1423 }
1425 return;
1426 }
1427
1429}
G4GLOB_DLL std::ostream G4cout
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
std::size_t GetNoWorlds() const
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager
const char * name(G4int ptype)