1271 {
1272
1275
1277 if (!pScene) {
1279 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
1280 }
1281 return;
1282 }
1283
1286 std::istringstream is (newValue);
1287 is >>
name >> copyNo;
1288
1289 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
1290
1291
1294 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
1296 size_t nWorlds = transportationManager->
GetNoWorlds();
1297 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
1300 (*iterWorld,
1303 &mp,
1304 true);
1306 (&searchModel, name, copyNo);
1307 searchModel.DescribeYourselfTo (searchScene);
1308 for (const auto& findings: searchScene.GetFindings()) {
1309 findingsVector.push_back(findings);
1310 }
1311 }
1312
1314 for (const auto& findings: findingsVector) {
1315
1316
1317 const auto& extent = findings.fpFoundPV->GetLogicalVolume()->GetSolid()->GetExtent();
1318 const auto& transform = findings.fFoundObjectTransformation;
1319
1320 const G4double lengthMax = extent.GetExtentRadius()/2.;
1321 const G4double intLog10LengthMax = std::floor(std::log10(lengthMax));
1322 G4double length = std::pow(10,intLog10LengthMax);
1323 if (5.*length < lengthMax) length *= 5.;
1324 else if (2.*length < lengthMax) length *= 2.;
1325
1326 const auto& axesModel =
new G4AxesModel(0.,0.,0.,length,transform);
1327 axesModel->SetGlobalTag("LocalAxesModel");
1328 std::ostringstream oss; oss
1329 << "Local Axes for " << findings.fpFoundPV->GetName()
1330 << ':' << findings.fFoundPVCopyNo << ':' << id++;
1331 axesModel->SetGlobalDescription(oss.str());
1332
1334 if (successful) {
1336 G4cout <<
"\"" << findings.fpFoundPV->GetName()
1337 << "\", copy no. " << findings.fFoundPVCopyNo
1338 << ",\n found in searched volume \""
1339 << findings.fpSearchPV->GetName()
1340 << "\" at depth " << findings.fFoundDepth
1341 << ",\n base path: \"" << findings.fFoundBasePVPath
1342 << "\".\n Local axes have been added to scene \""
1343 << pScene->
GetName() <<
"\".";
1345 G4cout <<
" With extent " << extent
1346 << "\n at " << transform.getRotation()
1347 << " " << transform.getTranslation();
1348 }
1350 }
1351 } else {
1353 }
1354 }
1355
1356 if (findingsVector.empty()) {
1358 G4warn <<
"ERROR: Volume \"" <<
name <<
"\"";
1359 if (copyNo >= 0) {
1360 G4warn <<
", copy no. " << copyNo <<
",";
1361 }
1363 }
1365 return;
1366 }
1367
1369}
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)