5 #include "G4RegionStore.hh"
7 #include "G4LogicalVolumeStore.hh"
8 #include "G4PhysicalVolumeStore.hh"
9 #include "G4VPhysicalVolume.hh"
10 #include "G4LogicalVolume.hh"
11 #include "G4GeomTestVolume.hh"
13 #include "G4SystemOfUnits.hh"
14 #include "G4GDMLParser.hh"
20 std::vector<std::string> nodeNames
21 = p.
getParameter<std::vector<std::string> >(
"NodeNames");
34 const G4RegionStore* regStore = G4RegionStore::GetInstance();
37 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
38 unsigned int numPV = pvs->size();
40 unsigned int nn = nodeNames.size();
41 G4cout <<
"G4OverlapCheck is initialised with "
42 << nodeNames.size() <<
" nodes; " <<
" nPoints= " << nPoints
43 <<
"; tolerance= " << tolerance/mm <<
" mm; verbose: "
45 <<
" RegionFlag: " << regionFlag
46 <<
" PVname: " << PVname <<
" LVname: " << LVname << G4endl;
49 for (
unsigned int ii=0;
ii<nn; ++
ii) {
50 if(
"" == nodeNames[
ii] ||
"world" == nodeNames[
ii] ||
"World" == nodeNames[
ii] ) {
51 nodeNames[
ii] =
"DDDWorld";
52 G4cout <<
"### Check overlaps for DDDWorld " << G4endl;
53 G4VPhysicalVolume*
pv = pvs->GetVolume(
"DDDWorld");
54 G4GeomTestVolume
test(pv, tolerance, nPoints, verbose);
55 test.SetErrorsThreshold(nPrints);
56 test.TestRecursiveOverlap(level, depth);
57 }
else if(regionFlag) {
58 G4cout <<
"---------------------------------------------------------------" << G4endl;
59 G4cout <<
"### Check overlaps for G4Region Node[" << ii <<
"] : " << nodeNames[
ii]
61 G4Region* reg = regStore->GetRegion((G4String)nodeNames[ii]);
63 G4cout <<
"### NO G4Region found - EXIT" << G4endl;
66 std::vector<G4LogicalVolume*>::iterator rootLVItr
67 = reg->GetRootLogicalVolumeIterator();
68 unsigned int numRootLV = reg->GetNumberOfRootVolumes();
70 for(
unsigned int iLV=0; iLV < numRootLV; ++iLV, ++rootLVItr ) {
73 G4cout <<
"### Check overlaps for G4LogicalVolume " << lv->GetName() << G4endl;
74 for(
unsigned int i=0;
i<numPV; ++
i) {
75 if(((*pvs)[
i])->GetLogicalVolume() == lv) {
76 G4cout <<
"### Check overlaps for PhysVolume " << ((*pvs)[
i])->GetName()
81 gdml.Write(((*pvs)[i])->GetName()+
".gdml", (*pvs)[i],
true);
85 G4GeomTestVolume
test(((*pvs)[i]), tolerance, nPoints, verbose);
86 test.SetErrorsThreshold(nPrints);
87 test.TestRecursiveOverlap(level, depth);
93 G4cout <<
"### Check overlaps for PhysVolume Node[" << ii <<
"] : " << nodeNames[
ii]
95 G4VPhysicalVolume*
pv = pvs->GetVolume((G4String)nodeNames[ii]);
96 G4GeomTestVolume
test(pv, tolerance, nPoints, verbose);
97 test.SetErrorsThreshold(nPrints);
98 test.TestRecursiveOverlap(level, depth);
103 G4cout <<
"----------- List of PhysVolumes by name -----------------" << G4endl;
104 for (
unsigned int i=0;
i<numPV; ++
i) {
105 if(PVname == ((*pvs)[
i])->GetName()) {
106 G4cout <<
" ##### PhysVolume " << PVname <<
" [" << ((*pvs)[
i])->GetCopyNo()
107 <<
"] LV: " << ((*pvs)[
i])->GetLogicalVolume()->GetName()
108 <<
" Mother LV: " << ((*pvs)[
i])->GetMotherLogical()->GetName() << G4endl;
109 G4cout <<
" Translation: " << ((*pvs)[
i])->GetObjectTranslation() << G4endl;
110 G4cout <<
" Rotation: " << ((*pvs)[
i])->GetObjectRotationValue() << G4endl;
115 G4cout <<
"---------- List of Logical Volumes by name ------------------" << G4endl;
116 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
117 unsigned int numLV = lvs->size();
118 for (
unsigned int i=0;
i<numLV; ++
i) {
119 if(LVname == ((*lvs)[
i])->GetName()) {
120 G4int
np = ((*lvs)[
i])->GetNoDaughters();
121 G4cout <<
" ##### LogVolume " << LVname <<
" " << np <<
" daughters" << G4endl;
122 for (G4int
j=0;
j<
np; ++
j) {
123 G4VPhysicalVolume*
pv = ((*lvs)[
i])->GetDaughter(
j);
125 G4cout <<
" PV: " << pv->GetName() <<
" [" << pv->GetCopyNo() <<
"]"
126 <<
" type: " << pv->VolumeType() <<
" multiplicity: "
127 << pv->GetMultiplicity() <<
" LV: "
128 << pv->GetLogicalVolume()->GetName() << G4endl;
129 G4cout <<
" Translation: " << pv->GetObjectTranslation() << G4endl;
130 G4cout <<
" Rotation: " << pv->GetObjectRotationValue() << G4endl;
136 G4cout <<
"---------------- End of overlap checks ---------------------" << G4endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
G4CheckOverlap(edm::ParameterSet const &p)