#include <Validation/CheckOverlap/interface/CheckOverlap.h>
Public Member Functions | |
CheckOverlap (edm::ParameterSet const &p) | |
~CheckOverlap () | |
Private Member Functions | |
void | checkHierarchyLeafPVLV (G4LogicalVolume *lv, uint leafDepth) |
void | checkPV (G4VPhysicalVolume *pv, uint leafDepth) |
void | dumpLV (G4LogicalVolume *lv, std::string str) |
G4VPhysicalVolume * | getTopPV () |
void | update (const BeginOfRun *run) |
This routine will be called when the appropriate signal arrives. | |
Private Attributes | |
std::string | nodeName |
int | nPoints |
G4LogicalVolume * | topLV |
Definition at line 19 of file CheckOverlap.h.
CheckOverlap::CheckOverlap | ( | edm::ParameterSet const & | p | ) |
Definition at line 21 of file CheckOverlap.cc.
References edm::ParameterSet::getUntrackedParameter(), nodeName, and nPoints.
00021 : topLV(0) { 00022 nodeName = p.getUntrackedParameter<std::string>("NodeName", ""); 00023 nPoints = p.getUntrackedParameter<int>("Resolution", 1000); 00024 edm::LogInfo("G4cout") << "CheckOverlap:: initialised with Node Name " 00025 << " " << nodeName << " and Resolution " 00026 << nPoints; 00027 }
CheckOverlap::~CheckOverlap | ( | ) |
void CheckOverlap::checkHierarchyLeafPVLV | ( | G4LogicalVolume * | lv, | |
uint | leafDepth | |||
) | [private] |
Definition at line 57 of file CheckOverlap.cc.
References checkPV().
Referenced by update().
00058 { 00059 00060 //----- Get LV daughters from list of PV daughters 00061 mmlvpv lvpvDaughters; 00062 std::set< G4LogicalVolume * > lvDaughters; 00063 int NoDaughters = lv->GetNoDaughters(); 00064 while ((NoDaughters--)>0) { 00065 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters); 00066 lvpvDaughters.insert(mmlvpv::value_type(pvD->GetLogicalVolume(), pvD)); 00067 lvDaughters.insert(pvD->GetLogicalVolume()); 00068 } 00069 00070 std::set< G4LogicalVolume * >::const_iterator scite; 00071 mmlvpv::const_iterator mmcite; 00072 00073 //----- Check daughters of LV 00074 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) { 00075 std::pair< mmlvpv::iterator, mmlvpv::iterator > mmER = lvpvDaughters.equal_range(*scite); 00076 //----- Check daughters PV of this LV 00077 for (mmcite = mmER.first ; mmcite != mmER.second; mmcite++) 00078 checkPV((*mmcite).second, leafDepth+1); 00079 //----- Check daughters LV 00080 checkHierarchyLeafPVLV(*scite, leafDepth+1); 00081 } 00082 }
void CheckOverlap::checkPV | ( | G4VPhysicalVolume * | pv, | |
uint | leafDepth | |||
) | [private] |
Definition at line 84 of file CheckOverlap.cc.
References dumpLV(), lv, and nPoints.
Referenced by checkHierarchyLeafPVLV().
00084 { 00085 00086 //----- PV info 00087 #ifndef G4V7 00088 std::string mother = "World"; 00089 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName(); 00090 if (!pv->IsReplicated()) { 00091 G4PVPlacement* pvplace = dynamic_cast<G4PVPlacement* >(pv); 00092 G4bool ok = pvplace->CheckOverlaps(nPoints); 00093 edm::LogInfo("G4cout") << "Placed PV " << pvplace->GetName() 00094 << " Number " << pvplace->GetCopyNo() 00095 << " in mother " << mother << " at depth " 00096 << leafDepth << " Status " << ok; 00097 if (ok) { 00098 if(pv->GetRotation() == 0) { 00099 edm::LogInfo("G4cout") << "Translation " << pv->GetTranslation() 00100 << " and with no rotation"; 00101 } else { 00102 edm::LogInfo("G4cout") << "Translation " << pv->GetTranslation() 00103 << " and with rotation "<< *(pv->GetRotation()); 00104 } 00105 G4LogicalVolume* lv = pv->GetLogicalVolume(); 00106 dumpLV(lv, "Self"); 00107 if (pv->GetMotherLogical()) { 00108 lv = pv->GetMotherLogical(); 00109 dumpLV (lv, "Mother"); 00110 } 00111 } 00112 } else { 00113 if (pv->GetParameterisation() != 0) { 00114 G4PVParameterised* pvparam = dynamic_cast<G4PVParameterised* >(pv); 00115 G4bool ok = pvparam->CheckOverlaps(nPoints); 00116 edm::LogInfo("G4cout") << "Parametrized PV " << pvparam->GetName() 00117 << " in mother " << mother << " at depth " 00118 << leafDepth << " Status " << ok; 00119 } 00120 } 00121 #endif 00122 }
void CheckOverlap::dumpLV | ( | G4LogicalVolume * | lv, | |
std::string | str | |||
) | [private] |
Definition at line 129 of file CheckOverlap.cc.
Referenced by checkPV().
00129 { 00130 edm::LogInfo("G4cout") << "Dump of " << str << " Logical Volume " 00131 << lv->GetName() << " Solid: " 00132 << lv->GetSolid()->GetName() << " Material: " 00133 << lv->GetMaterial()->GetName(); 00134 edm::LogInfo("G4cout") << *(lv->GetSolid()); 00135 }
G4VPhysicalVolume * CheckOverlap::getTopPV | ( | ) | [private] |
Definition at line 124 of file CheckOverlap.cc.
Referenced by update().
00124 { 00125 return G4TransportationManager::GetTransportationManager() 00126 ->GetNavigatorForTracking()->GetWorldVolume(); 00127 }
void CheckOverlap::update | ( | const BeginOfRun * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfRun * >.
Definition at line 31 of file CheckOverlap.cc.
References checkHierarchyLeafPVLV(), getTopPV(), i, nodeName, and topLV.
00031 { 00032 00033 edm::LogInfo("G4cout") << "Node Name " << nodeName; 00034 if (nodeName != "") { 00035 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance(); 00036 std::vector<G4VPhysicalVolume *>::const_iterator pvcite; 00037 int i = 0; 00038 for (pvcite = pvs->begin(); pvcite != pvs->end(); pvcite++) { 00039 edm::LogInfo("G4cout") << "Name of node " << (++i) << " : " 00040 << (*pvcite)->GetName(); 00041 if ((*pvcite)->GetName() == (G4String)(nodeName)) { 00042 topLV = (*pvcite)->GetLogicalVolume(); 00043 break; 00044 } 00045 } 00046 } else { 00047 G4VPhysicalVolume * theTopPV = getTopPV(); 00048 topLV = theTopPV->GetLogicalVolume(); 00049 } 00050 if (topLV != 0) edm::LogInfo("G4cout") << "Top LV Name " << topLV->GetName(); 00051 else edm::LogInfo("G4cout") << "No Top LV Found"; 00052 //---------- Check all PV's 00053 if (topLV) 00054 checkHierarchyLeafPVLV(topLV, 0); 00055 }
std::string CheckOverlap::nodeName [private] |
int CheckOverlap::nPoints [private] |
G4LogicalVolume* CheckOverlap::topLV [private] |