11 #include "G4LogicalVolumeStore.hh"
12 #include "G4PVPlacement.hh"
13 #include "G4PVParameterised.hh"
14 #include "G4LogicalVolume.hh"
15 #include "G4Material.hh"
16 #include "G4TransportationManager.hh"
21 std::vector<std::string> defNames;
22 nodeNames =
p.getUntrackedParameter<std::vector<std::string> >(
"NodeNames", defNames);
23 nPoints =
p.getUntrackedParameter<
int>(
"Resolution", 1000);
24 G4cout <<
"CheckOverlap:: initialised with " <<
nodeNames.size() <<
" Node Names and Resolution " <<
nPoints
25 <<
" the names are:" << G4endl;
34 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
35 G4cout <<
"CheckOverlap::update nLV= " << lvs->size() << G4endl;
36 std::vector<G4LogicalVolume*>::const_iterator lvcite;
38 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
40 if ((*lvcite)->GetName() == (G4String)(
nodeNames[
ii])) {
41 topLV.push_back((*lvcite));
45 G4cout <<
"Name of node " << (++
i) <<
" : " << (*lvcite)->GetName() << G4endl;
50 G4VPhysicalVolume* theTopPV =
getTopPV();
51 topLV.push_back(theTopPV->GetLogicalVolume());
55 G4cout <<
"No Top LV Found" << G4endl;
57 for (
unsigned int ii = 0;
ii <
topLV.size(); ++
ii) {
67 std::set<G4LogicalVolume*> lvDaughters;
68 int NoDaughters = lv->GetNoDaughters();
69 while ((NoDaughters--) > 0) {
70 G4VPhysicalVolume* pvD = lv->GetDaughter(NoDaughters);
72 lvDaughters.insert(pvD->GetLogicalVolume());
75 std::set<G4LogicalVolume*>::const_iterator scite;
76 mmlvpv::const_iterator mmcite;
79 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
80 std::pair<mmlvpv::iterator, mmlvpv::iterator> mmER = lvpvDaughters.equal_range(*scite);
82 for (mmcite = mmER.first; mmcite != mmER.second; mmcite++)
83 checkPV((*mmcite).second, leafDepth + 1);
93 if (
pv->GetMotherLogical())
94 mother =
pv->GetMotherLogical()->GetName();
95 if (!
pv->IsReplicated()) {
96 G4PVPlacement* pvplace = dynamic_cast<G4PVPlacement*>(
pv);
97 G4bool
ok = pvplace->CheckOverlaps(
nPoints);
98 G4cout <<
"Placed PV " << pvplace->GetName() <<
" Number " << pvplace->GetCopyNo() <<
" in mother " << mother
99 <<
" at depth " << leafDepth <<
" Status " <<
ok << G4endl;
101 if (
pv->GetRotation() ==
nullptr) {
102 G4cout <<
"Translation " <<
pv->GetTranslation() <<
" and with no rotation" << G4endl;
104 G4cout <<
"Translation " <<
pv->GetTranslation() <<
" and with rotation " << *(
pv->GetRotation()) << G4endl;
106 G4LogicalVolume* lv =
pv->GetLogicalVolume();
108 if (
pv->GetMotherLogical()) {
109 lv =
pv->GetMotherLogical();
114 if (
pv->GetParameterisation() !=
nullptr) {
115 G4PVParameterised* pvparam = dynamic_cast<G4PVParameterised*>(
pv);
116 G4bool
ok = pvparam->CheckOverlaps(
nPoints);
117 G4cout <<
"Parametrized PV " << pvparam->GetName() <<
" in mother " << mother <<
" at depth " << leafDepth
118 <<
" Status " <<
ok << G4endl;
125 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
129 G4cout <<
"Dump of " <<
str <<
" Logical Volume " << lv->GetName() <<
" Solid: " << lv->GetSolid()->GetName()
130 <<
" Material: " << lv->GetMaterial()->GetName() << G4endl;
131 G4cout << *(lv->GetSolid()) << G4endl;