12 #include "G4LogicalVolumeStore.hh"
13 #include "G4PVPlacement.hh"
14 #include "G4PVParameterised.hh"
15 #include "G4LogicalVolume.hh"
16 #include "G4Material.hh"
17 #include "G4TransportationManager.hh"
22 std::vector<std::string> defNames;
25 edm::LogInfo(
"G4cout") <<
"CheckOverlap:: initialised with "
26 <<
nodeNames.size() <<
" Node Names and Resolution "
27 << nPoints <<
" the names are:";
28 for (
unsigned int ii=0; ii<
nodeNames.size(); ii++)
37 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
38 std::vector<G4LogicalVolume *>::const_iterator lvcite;
40 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
41 for (
unsigned int ii=0; ii<
nodeNames.size(); ii++) {
42 if ((*lvcite)->GetName() == (G4String)(
nodeNames[ii])) {
43 topLV.push_back((*lvcite));
48 << (*lvcite)->GetName();
52 G4VPhysicalVolume * theTopPV =
getTopPV();
53 topLV.push_back(theTopPV->GetLogicalVolume());
56 if (
topLV.size() == 0) {
59 for (
unsigned int ii=0; ii<
topLV.size(); ii++) {
67 unsigned int leafDepth) {
71 std::set< G4LogicalVolume * > lvDaughters;
72 int NoDaughters = lv->GetNoDaughters();
73 while ((NoDaughters--)>0) {
74 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
76 lvDaughters.insert(pvD->GetLogicalVolume());
79 std::set< G4LogicalVolume * >::const_iterator scite;
80 mmlvpv::const_iterator mmcite;
83 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
84 std::pair< mmlvpv::iterator, mmlvpv::iterator > mmER = lvpvDaughters.equal_range(*scite);
86 for (mmcite = mmER.first ; mmcite != mmER.second; mmcite++)
87 checkPV((*mmcite).second, leafDepth+1);
97 std::string mother =
"World";
98 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
99 if (!pv->IsReplicated()) {
100 G4PVPlacement* pvplace =
dynamic_cast<G4PVPlacement*
>(pv);
101 G4bool
ok = pvplace->CheckOverlaps(
nPoints);
102 edm::LogInfo(
"G4cout") <<
"Placed PV " << pvplace->GetName()
103 <<
" Number " << pvplace->GetCopyNo()
104 <<
" in mother " << mother <<
" at depth "
105 << leafDepth <<
" Status " <<
ok;
107 if(pv->GetRotation() == 0) {
108 edm::LogInfo(
"G4cout") <<
"Translation " << pv->GetTranslation()
109 <<
" and with no rotation";
111 edm::LogInfo(
"G4cout") <<
"Translation " << pv->GetTranslation()
112 <<
" and with rotation "<< *(pv->GetRotation());
114 G4LogicalVolume* lv = pv->GetLogicalVolume();
116 if (pv->GetMotherLogical()) {
117 lv = pv->GetMotherLogical();
122 if (pv->GetParameterisation() != 0) {
123 G4PVParameterised* pvparam =
dynamic_cast<G4PVParameterised*
>(pv);
124 G4bool
ok = pvparam->CheckOverlaps(
nPoints);
125 edm::LogInfo(
"G4cout") <<
"Parametrized PV " << pvparam->GetName()
126 <<
" in mother " << mother <<
" at depth "
127 << leafDepth <<
" Status " <<
ok;
134 return G4TransportationManager::GetTransportationManager()
135 ->GetNavigatorForTracking()->GetWorldVolume();
139 edm::LogInfo(
"G4cout") <<
"Dump of " << str <<
" Logical Volume "
140 << lv->GetName() <<
" Solid: "
141 << lv->GetSolid()->GetName() <<
" Material: "
142 << lv->GetMaterial()->GetName();
void checkPV(G4VPhysicalVolume *pv, unsigned int leafDepth)
T getUntrackedParameter(std::string const &, T const &) const
void checkHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth)
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
void update(const BeginOfRun *run)
This routine will be called when the appropriate signal arrives.
void dumpLV(G4LogicalVolume *lv, std::string str)
std::vector< G4LogicalVolume * > topLV
Container::value_type value_type
std::vector< std::string > nodeNames
CheckOverlap(edm::ParameterSet const &p)
G4VPhysicalVolume * getTopPV()