20 std::vector<std::string> nodeNames
21 =
p.getParameter<std::vector<std::string> >(
"NodeNames");
25 =
p.getUntrackedParameter<
double>(
"Tolerance", 0.0)*CLHEP::mm;
26 int nPoints =
p.getUntrackedParameter<
int>(
"Resolution", 10000);
27 bool verbose =
p.getUntrackedParameter<
bool>(
"Verbose",
true);
28 bool regionFlag =
p.getUntrackedParameter<
bool>(
"RegionFlag",
true);
29 bool gdmlFlag =
p.getUntrackedParameter<
bool>(
"gdmlFlag",
false);
30 int nPrints =
p.getUntrackedParameter<
int>(
"ErrorThreshold", 1);
31 int level =
p.getUntrackedParameter<
int>(
"Level", 0);
32 int depth =
p.getUntrackedParameter<
int>(
"Depth", -1);
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);
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);
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);
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;