1273 {
1274
1277
1279 if (!pScene) {
1281 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1282 }
1283 return;
1284 }
1285
1288 std::istringstream is (newValue);
1289 is >>
name >> copyNo;
1290
1291 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
1292
1293
1296 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
1298 size_t nWorlds = transportationManager->
GetNoWorlds();
1299 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
1302 (*iterWorld,
1305 &mp,
1306 true);
1308 (&searchModel, name, copyNo);
1309 searchModel.DescribeYourselfTo (searchScene);
1310 for (const auto& findings: searchScene.GetFindings()) {
1311 findingsVector.push_back(findings);
1312 }
1313 }
1314
1316 for (const auto& findings: findingsVector) {
1317
1318
1319 const auto& extent = findings.fpFoundPV->GetLogicalVolume()->GetSolid()->GetExtent();
1320 const auto& transform = findings.fFoundObjectTransformation;
1321
1322 const G4double lengthMax = extent.GetExtentRadius()/2.;
1323 const G4double intLog10LengthMax = std::floor(std::log10(lengthMax));
1324 G4double length = std::pow(10,intLog10LengthMax);
1325 if (5.*length < lengthMax) length *= 5.;
1326 else if (2.*length < lengthMax) length *= 2.;
1327
1328 const auto& axesModel =
new G4AxesModel(0.,0.,0.,length,transform);
1329 axesModel->SetGlobalTag("LocalAxesModel");
1330 std::ostringstream oss; oss
1331 << "Local Axes for " << findings.fpFoundPV->GetName()
1332 << ':' << findings.fFoundPVCopyNo << ':' << id++;
1333 axesModel->SetGlobalDescription(oss.str());
1334
1336 if (successful) {
1338 G4cout <<
"\"" << findings.fpFoundPV->GetName()
1339 << "\", copy no. " << findings.fFoundPVCopyNo
1340 << ",\n found in searched volume \""
1341 << findings.fpSearchPV->GetName()
1342 << "\" at depth " << findings.fFoundDepth
1343 << ",\n base path: \"" << findings.fFoundBasePVPath
1344 << "\".\n Local axes have been added to scene \""
1345 << pScene->
GetName() <<
"\".";
1347 G4cout <<
" With extent " << extent
1348 << "\n at " << transform.getRotation()
1349 << " " << transform.getTranslation();
1350 }
1352 }
1353 } else {
1355 }
1356 }
1357
1358 if (findingsVector.empty()) {
1360 G4warn <<
"ERROR: Volume \"" <<
name <<
"\"";
1361 if (copyNo >= 0) {
1362 G4warn <<
", copy no. " << copyNo <<
",";
1363 }
1365 }
1367 return;
1368 }
1369
1371}
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
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()
const char * name(G4int ptype)