19 #include "G4PhysicalVolumeStore.hh"
20 #include "G4LogicalVolumeStore.hh"
21 #include "G4VPhysicalVolume.hh"
22 #include "G4LogicalVolume.hh"
23 #include "G4VSolid.hh"
24 #include "G4Material.hh"
26 #include "G4VisAttributes.hh"
27 #include "G4UserLimits.hh"
28 #include "G4TransportationManager.hh"
34 dumpSummary_ =
p.getUntrackedParameter<
bool>(
"DumpSummary",
true);
35 dumpLVTree_ =
p.getUntrackedParameter<
bool>(
"DumpLVTree",
true);
36 dumpLVList_ =
p.getUntrackedParameter<
bool>(
"DumpLVList",
false);
37 dumpMaterial_ =
p.getUntrackedParameter<
bool>(
"DumpMaterial",
false);
38 dumpLV_ =
p.getUntrackedParameter<
bool>(
"DumpLV",
false);
39 dumpSolid_ =
p.getUntrackedParameter<
bool>(
"DumpSolid",
false);
40 dumpAtts_ =
p.getUntrackedParameter<
bool>(
"DumpAttributes",
false);
41 dumpPV_ =
p.getUntrackedParameter<
bool>(
"DumpPV",
false);
42 dumpRotation_ =
p.getUntrackedParameter<
bool>(
"DumpRotation",
false);
43 dumpReplica_ =
p.getUntrackedParameter<
bool>(
"DumpReplica",
false);
44 dumpTouch_ =
p.getUntrackedParameter<
bool>(
"DumpTouch",
false);
45 dumpSense_ =
p.getUntrackedParameter<
bool>(
"DumpSense",
false);
46 dd4hep_ =
p.getUntrackedParameter<
bool>(
"DD4Hep",
false);
50 names_ =
p.getUntrackedParameter<std::vector<std::string> >(
"Names");
51 G4cout <<
"PrintGeomInfoAction:: initialised for dd4hep " <<
dd4hep_ <<
" with verbosity levels:"
61 for (
unsigned int i = 0;
i <
names_.size();
i++)
72 (*job)()->get<IdealGeometryRecord>().get(pDD);
74 G4cout <<
"PrintGeomInfoAction::Get Printout of Sensitive Volumes "
75 <<
"for " <<
names_.size() <<
" Readout Units" << G4endl;
76 for (
unsigned int i = 0;
i <
names_.size();
i++) {
80 G4cout <<
"PrintGeomInfoAction:: Get Filtered view for ReadOutName = " <<
sd << G4endl;
87 auto lvname = fv.
name();
88 unsigned int leafDepth =
copy.size();
89 G4cout << leafDepth << spaces <<
"### VOLUME = " << lvname <<
" Copy No";
90 for (
unsigned int k = 0;
k < leafDepth; ++
k)
92 G4cout <<
" Centre at " << tran <<
" (r = " << tran.Rho() <<
", phi = " << tran.phi() / CLHEP::deg <<
")"
98 (*job)()->get<IdealGeometryRecord>().get(pDD);
100 G4cout <<
"PrintGeomInfoAction::Get Printout of Sensitive Volumes "
101 <<
"for " <<
names_.size() <<
" Readout Units" << G4endl;
102 for (
unsigned int i = 0;
i <
names_.size();
i++) {
107 G4cout <<
"PrintGeomInfoAction:: Get Filtered view for " << attribute <<
" = " <<
sd << G4endl;
118 unsigned int leafDepth =
copy.size();
119 G4cout << leafDepth << spaces <<
"### VOLUME = " << lvname <<
" Copy No";
120 for (
int k = leafDepth - 1;
k >= 0;
k--)
122 G4cout <<
" Centre at " << tran <<
" (r = " << tran.Rho() <<
", phi = " << tran.phi() / CLHEP::deg <<
")"
152 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
154 out <<
" No volume created " << G4endl;
157 out <<
" @@@ Geometry built inside world volume: " <<
theTopPV_->GetName() << G4endl;
159 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
160 std::vector<G4LogicalVolume *>::const_iterator lvcite;
161 std::set<G4VSolid *> theSolids;
162 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
163 theSolids.insert((*lvcite)->GetSolid());
164 out <<
" Number of G4VSolid's: " << theSolids.size() << G4endl;
165 out <<
" Number of G4LogicalVolume's: " << lvs->size() << G4endl;
166 const G4PhysicalVolumeStore *
pvs = G4PhysicalVolumeStore::GetInstance();
167 out <<
" Number of G4VPhysicalVolume's: " <<
pvs->size() << G4endl;
169 const G4MaterialTable *matTab = G4Material::GetMaterialTable();
170 out <<
" Number of G4Material's: " << matTab->size() << G4endl;
174 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << G4endl;
175 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
176 std::vector<G4LogicalVolume *>::const_iterator lvcite;
177 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
178 out <<
"LV:" << (*lvcite)->GetName() <<
"\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << G4endl;
182 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl;
188 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
189 const G4MaterialTable *matTab = G4Material::GetMaterialTable();
190 out <<
" with " << matTab->size() <<
" materials " << G4endl;
191 std::vector<G4Material *>::const_iterator matite;
192 for (matite = matTab->begin(); matite != matTab->end(); matite++)
193 out <<
"Material: " << (*matite) << G4endl;
197 unsigned int leafDepth,
200 for (
unsigned int ii = 0;
ii < leafDepth;
ii++)
202 out <<
" LV:(" << leafDepth <<
") " << lv->GetName() <<
" (" <<
count <<
")" << G4endl;
204 std::map<G4LogicalVolume *, unsigned int> lvCount;
205 std::map<G4LogicalVolume *, unsigned int>::const_iterator cite;
206 int siz = lv->GetNoDaughters();
207 for (
int ii = 0;
ii < siz;
ii++) {
208 cite = lvCount.find(lv->GetDaughter(
ii)->GetLogicalVolume());
209 if (cite != lvCount.end())
210 lvCount[cite->first] = (cite->second) + 1;
212 lvCount.insert(std::pair<G4LogicalVolume *, unsigned int>(lv->GetDaughter(
ii)->GetLogicalVolume(), 1));
214 for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
226 int siz = lv->GetNoDaughters();
227 for (
int ii = 0;
ii < siz;
ii++)
238 G4LogicalVolume *topLV =
getTopLV();
255 std::set<G4LogicalVolume *> lvDaughters;
256 int NoDaughters = lv->GetNoDaughters();
257 while ((NoDaughters--) > 0) {
258 G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
260 lvDaughters.insert(pvD->GetLogicalVolume());
263 std::set<G4LogicalVolume *>::const_iterator scite;
264 mmlvpv::const_iterator mmcite;
267 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
268 std::pair<mmlvpv::iterator, mmlvpv::iterator> mmER = lvpvDaughters.equal_range(*scite);
270 for (mmcite = mmER.first; mmcite != mmER.second; mmcite++)
271 dumpPV((*mmcite).second, leafDepth + 1,
out);
282 out << leafDepth << spaces <<
"$$$ VOLUME = " << lv->GetName() <<
" Solid: " << lv->GetSolid()->GetName()
283 <<
" MATERIAL: " << lv->GetMaterial()->GetName() << G4endl;
291 const G4VisAttributes *fVA = lv->GetVisAttributes();
292 if (fVA !=
nullptr) {
293 out << spaces <<
" VISUALISATION ATTRIBUTES: " << G4endl;
294 out << spaces <<
" IsVisible " << fVA->IsVisible() << G4endl;
295 out << spaces <<
" IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << G4endl;
296 out << spaces <<
" Colour " << fVA->GetColour() << G4endl;
297 out << spaces <<
" LineStyle " << fVA->GetLineStyle() << G4endl;
298 out << spaces <<
" LineWidth " << fVA->GetLineWidth() << G4endl;
299 out << spaces <<
" IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << G4endl;
300 out << spaces <<
" ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << G4endl;
304 G4UserLimits *fUL = lv->GetUserLimits();
306 if (fUL !=
nullptr) {
307 out << spaces <<
" MaxAllowedStep " << fUL->GetMaxAllowedStep(
dummy) << G4endl;
308 out << spaces <<
" UserMaxTrackLength " << fUL->GetUserMaxTrackLength(
dummy) << G4endl;
309 out << spaces <<
" UserMaxTime " << fUL->GetUserMaxTime(
dummy) << G4endl;
310 out << spaces <<
" UserMinEkine " << fUL->GetUserMinEkine(
dummy) << G4endl;
311 out << spaces <<
" UserMinRange " << fUL->GetUserMinRange(
dummy) << G4endl;
315 if (lv->GetSensitiveDetector())
316 out << spaces <<
" IS SENSITIVE DETECTOR " << G4endl;
317 if (lv->GetFieldManager())
318 out << spaces <<
" FIELD ON " << G4endl;
321 out << spaces <<
" Quality for optimisation, average number of voxels to be spent per content "
322 << lv->GetSmartless() << G4endl;
325 if (lv->GetFastSimulationManager())
326 out << spaces <<
" Logical Volume is an envelope for a FastSimulationManager " << G4endl;
327 out << spaces <<
" Weight used in the event biasing technique = " << lv->GetBiasWeight() << G4endl;
338 if (
pv->GetMotherLogical())
339 mother =
pv->GetMotherLogical()->GetName();
340 out << leafDepth << spaces <<
"### VOLUME = " <<
pv->GetName() <<
" Copy No " <<
pv->GetCopyNo() <<
" in " << mother
341 <<
" at " <<
pv->GetTranslation();
343 if (!
pv->IsReplicated()) {
345 if (
pv->GetRotation() ==
nullptr)
346 out <<
" with no rotation" << G4endl;
348 out <<
" with rotation" << G4endl;
350 out <<
" with rotation " << *(
pv->GetRotation()) << G4endl;
354 out << spaces <<
" It is replica: " << G4endl;
360 pv->GetReplicationData(axis, nReplicas,
width,
offset, consuming);
361 out << spaces <<
" axis " << axis << G4endl << spaces <<
" nReplicas " << nReplicas << G4endl;
362 if (
pv->GetParameterisation() !=
nullptr)
363 out << spaces <<
" It is parameterisation " << G4endl;
365 out << spaces <<
" width " <<
width << G4endl << spaces <<
" offset " <<
offset << G4endl << spaces
366 <<
" consuming" << consuming << G4endl;
367 if (
pv->GetParameterisation() !=
nullptr)
368 out << spaces <<
" It is parameterisation " << G4endl;
380 G4ThreeVector globalpoint =
fHistory_.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
381 G4LogicalVolume *lv =
pv->GetLogicalVolume();
384 if (
pv->GetMotherLogical())
385 mother =
pv->GetMotherLogical()->GetName();
387 lvname.assign(lvname, 0,
nchar_);
389 out << leafDepth << spaces <<
"### VOLUME = " << lv->GetName() <<
" Copy No " <<
pv->GetCopyNo() <<
" in " << mother
390 <<
" global position of centre " << globalpoint <<
" (r = " << globalpoint.perp()
391 <<
", phi = " << globalpoint.phi() / CLHEP::deg <<
")" << G4endl;
393 int NoDaughters = lv->GetNoDaughters();
394 while ((NoDaughters--) > 0) {
395 G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
396 if (!pvD->IsReplicated())
407 for (
ii = 0;
ii < leafDepth;
ii++) {
415 out << spaces << *(sol) << G4endl;
419 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();