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 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
39 unsigned int numPV = pvs->size();
40 unsigned int numLV = lvs->size();
41 unsigned int nn = nodeNames.size();
43 std::vector<G4String> savedgdml;
45 G4cout <<
"G4OverlapCheck is initialised with " 46 << nodeNames.size() <<
" nodes; " <<
" nPoints= " << nPoints
47 <<
"; tolerance= " <<
tolerance/mm <<
" mm; verbose: " 49 <<
" RegionFlag: " << regionFlag
50 <<
" PVname: " <<
PVname <<
" LVname: " <<
LVname <<
"\n" 51 <<
" Nlv= " << numLV <<
" Npv= " << numPV << G4endl;
54 for (
unsigned int ii=0;
ii<
nn; ++
ii) {
55 if(
"" == nodeNames[
ii] ||
"world" == nodeNames[
ii] ||
"World" == nodeNames[
ii] ) {
56 nodeNames[
ii] =
"DDDWorld";
57 G4cout <<
"### Check overlaps for DDDWorld " << G4endl;
58 G4VPhysicalVolume*
pv = pvs->GetVolume(
"DDDWorld");
60 test.SetErrorsThreshold(nPrints);
62 }
else if(regionFlag) {
63 G4cout <<
"---------------------------------------------------------------" << G4endl;
64 G4cout <<
"### Check overlaps for G4Region Node[" << ii <<
"] : " << nodeNames[
ii]
66 G4Region* reg = regStore->GetRegion((G4String)nodeNames[ii]);
68 G4cout <<
"### NO G4Region found - EXIT" << G4endl;
71 std::vector<G4LogicalVolume*>::iterator rootLVItr
72 = reg->GetRootLogicalVolumeIterator();
73 unsigned int numRootLV = reg->GetNumberOfRootVolumes();
74 G4cout <<
" " << numRootLV <<
" Root Logical Volumes in this region" << G4endl;
76 for(
unsigned int iLV=0; iLV < numRootLV; ++iLV, ++rootLVItr ) {
79 G4cout <<
"### Check overlaps for G4LogicalVolume " << lv->GetName() << G4endl;
80 for(
unsigned int i=0;
i<numPV; ++
i) {
81 if(((*pvs)[
i])->GetLogicalVolume() == lv) {
82 G4String pvname = ((*pvs)[
i])->GetName();
84 for(
unsigned int k=0;
k<savedgdml.size(); ++
k) {
85 if(pvname == savedgdml[
k]) {
91 G4cout <<
"### Check overlaps for PhysVolume " << pvname
92 <<
" is skipted because was already done" << G4endl;
95 savedgdml.push_back(pvname);
96 G4cout <<
"### Check overlaps for PhysVolume " << pvname
101 gdml.Write(pvname+
".gdml", (*pvs)[i],
true);
104 test.SetErrorsThreshold(nPrints);
111 G4cout <<
"### Check overlaps for PhysVolume Node[" << ii <<
"] : " << nodeNames[
ii]
113 G4VPhysicalVolume* pv = pvs->GetVolume((G4String)nodeNames[ii]);
115 test.SetErrorsThreshold(nPrints);
121 G4cout <<
"----------- List of PhysVolumes by name -----------------" << G4endl;
122 for (
unsigned int i=0; i<numPV; ++
i) {
123 if(
PVname == ((*pvs)[i])->GetName()) {
124 G4cout <<
" ##### PhysVolume " <<
PVname <<
" [" << ((*pvs)[
i])->GetCopyNo()
125 <<
"] LV: " << ((*pvs)[
i])->GetLogicalVolume()->GetName()
126 <<
" Mother LV: " << ((*pvs)[
i])->GetMotherLogical()->GetName() << G4endl;
127 G4cout <<
" Translation: " << ((*pvs)[
i])->GetObjectTranslation() << G4endl;
128 G4cout <<
" Rotation: " << ((*pvs)[
i])->GetObjectRotationValue() << G4endl;
131 gdml.Write(
PVname+
".gdml", (*pvs)[i],
true);
137 G4cout <<
"---------- List of Logical Volumes by name ------------------" << G4endl;
138 for (
unsigned int i=0; i<numLV; ++
i) {
139 if(
LVname == ((*lvs)[i])->GetName()) {
140 G4int
np = ((*lvs)[
i])->GetNoDaughters();
141 G4cout <<
" ##### LogVolume " <<
LVname <<
" " << np <<
" daughters" << G4endl;
142 for (G4int j=0; j<
np; ++j) {
143 G4VPhysicalVolume* pv = ((*lvs)[
i])->GetDaughter(j);
145 G4cout <<
" PV: " << pv->GetName() <<
" [" << pv->GetCopyNo() <<
"]" 146 <<
" type: " << pv->VolumeType() <<
" multiplicity: " 147 << pv->GetMultiplicity() <<
" LV: " 148 << pv->GetLogicalVolume()->GetName() << G4endl;
149 G4cout <<
" Translation: " << pv->GetObjectTranslation() << G4endl;
150 G4cout <<
" Rotation: " << pv->GetObjectRotationValue() << G4endl;
156 G4cout <<
"---------------- End of overlap checks ---------------------" << G4endl;