17 #include "G4PhysicalVolumeStore.hh" 18 #include "G4LogicalVolumeStore.hh" 19 #include "G4VPhysicalVolume.hh" 20 #include "G4LogicalVolume.hh" 21 #include "G4VSolid.hh" 22 #include "G4Material.hh" 24 #include "G4VisAttributes.hh" 25 #include "G4UserLimits.hh" 26 #include "G4TransportationManager.hh" 31 using namespace CLHEP;
47 nchar = name.find(
"*");
48 name.assign(name, 0, nchar);
50 G4cout <<
"PrintGeomInfoAction:: initialised with verbosity levels:" 51 <<
" Summary " << _dumpSummary <<
" LVTree " << _dumpLVTree <<
" LVList " << _dumpLVList <<
" Material " 52 << _dumpMaterial <<
"\n " 53 <<
" LV " << _dumpLV <<
" Solid " << _dumpSolid <<
" Attribs " << _dumpAtts
55 <<
" PV " << _dumpPV <<
" Rotation " << _dumpRotation <<
" Replica " << _dumpReplica
57 <<
" Touchable " << _dumpTouch <<
" for names (0-" << nchar <<
") = " << name
59 <<
" Sensitive " << _dumpSense <<
" for " <<
names.size() <<
" namess";
60 for (
unsigned int i = 0;
i <
names.size();
i++)
70 (*job)()->get<IdealGeometryRecord>().get(pDD);
72 G4cout <<
"PrintGeomInfoAction::Get Printout of Sensitive Volumes " 73 <<
"for " <<
names.size() <<
" Readout Units" << G4endl;
74 for (
unsigned int i = 0;
i <
names.size();
i++) {
79 G4cout <<
"PrintGeomInfoAction:: Get Filtered view for " << attribute <<
" = " << sd << G4endl;
90 unsigned int leafDepth = copy.size();
91 G4cout << leafDepth << spaces <<
"### VOLUME = " << lvname <<
" Copy No";
92 for (
int k = leafDepth - 1;
k >= 0;
k--)
94 G4cout <<
" Centre at " << tran <<
" (r = " << tran.Rho() <<
", phi = " << tran.phi() / deg <<
")" << G4endl;
102 theTopPV = getTopPV();
116 if (_dumpLV || _dumpPV || _dumpTouch)
117 dumpHierarchyTreePVLV(
G4cout);
122 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
123 if (theTopPV ==
nullptr) {
124 out <<
" No volume created " << G4endl;
127 out <<
" @@@ Geometry built inside world volume: " << theTopPV->GetName() << G4endl;
129 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
130 std::vector<G4LogicalVolume *>::const_iterator lvcite;
131 std::set<G4VSolid *> theSolids;
132 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
133 theSolids.insert((*lvcite)->GetSolid());
134 out <<
" Number of G4VSolid's: " << theSolids.size() << G4endl;
135 out <<
" Number of G4LogicalVolume's: " << lvs->size() << G4endl;
136 const G4PhysicalVolumeStore *
pvs = G4PhysicalVolumeStore::GetInstance();
137 out <<
" Number of G4VPhysicalVolume's: " << pvs->size() << G4endl;
138 out <<
" Number of Touchable's: " << countNoTouchables() << G4endl;
139 const G4MaterialTable *matTab = G4Material::GetMaterialTable();
140 out <<
" Number of G4Material's: " << matTab->size() << G4endl;
144 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << G4endl;
145 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
146 std::vector<G4LogicalVolume *>::const_iterator lvcite;
147 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
148 out <<
"LV:" << (*lvcite)->GetName() <<
"\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << G4endl;
152 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl;
153 G4LogicalVolume *lv = getTopLV();
154 dumpG4LVLeaf(lv, 0, 1, out);
158 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
159 const G4MaterialTable *matTab = G4Material::GetMaterialTable();
160 out <<
" with " << matTab->size() <<
" materials " << G4endl;
161 std::vector<G4Material *>::const_iterator matite;
162 for (matite = matTab->begin(); matite != matTab->end(); matite++)
163 out <<
"Material: " << (*matite) << G4endl;
167 unsigned int leafDepth,
170 for (
unsigned int ii = 0;
ii < leafDepth;
ii++)
172 out <<
" LV:(" << leafDepth <<
") " << lv->GetName() <<
" (" << count <<
")" << G4endl;
174 std::map<G4LogicalVolume *, unsigned int> lvCount;
175 std::map<G4LogicalVolume *, unsigned int>::const_iterator cite;
176 for (
int ii = 0;
ii < lv->GetNoDaughters();
ii++) {
177 cite = lvCount.find(lv->GetDaughter(
ii)->GetLogicalVolume());
178 if (cite != lvCount.end())
179 lvCount[cite->first] = (cite->second) + 1;
181 lvCount.insert(std::pair<G4LogicalVolume *, unsigned int>(lv->GetDaughter(
ii)->GetLogicalVolume(), 1));
183 for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
184 dumpG4LVLeaf((cite->first), leafDepth + 1, (cite->second), out);
189 G4LogicalVolume *lv = getTopLV();
190 add1touchable(lv, nTouch);
195 int siz = lv->GetNoDaughters();
196 for (
int ii = 0;
ii < siz;
ii++)
197 add1touchable(lv->GetDaughter(
ii)->GetLogicalVolume(), ++nTouch);
207 G4LogicalVolume *topLV = getTopLV();
210 dumpHierarchyLeafPVLV(topLV, 0, out);
211 dumpPV(theTopPV, 0, out);
215 dumpTouch(theTopPV, 0, out);
220 dumpLV(lv, leafDepth, out);
224 std::set<G4LogicalVolume *> lvDaughters;
225 int NoDaughters = lv->GetNoDaughters();
226 while ((NoDaughters--) > 0) {
227 G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
229 lvDaughters.insert(pvD->GetLogicalVolume());
232 std::set<G4LogicalVolume *>::const_iterator scite;
233 mmlvpv::const_iterator mmcite;
236 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
237 std::pair<mmlvpv::iterator, mmlvpv::iterator> mmER = lvpvDaughters.equal_range(*scite);
239 for (mmcite = mmER.first; mmcite != mmER.second; mmcite++)
240 dumpPV((*mmcite).second, leafDepth + 1, out);
242 dumpHierarchyLeafPVLV(*scite, leafDepth + 1, out);
247 std::string spaces = spacesFromLeafDepth(leafDepth);
251 out << leafDepth << spaces <<
"$$$ VOLUME = " << lv->GetName() <<
" Solid: " << lv->GetSolid()->GetName()
252 <<
" MATERIAL: " << lv->GetMaterial()->GetName() << G4endl;
254 dumpSolid(lv->GetSolid(), leafDepth,
out);
260 const G4VisAttributes *fVA = lv->GetVisAttributes();
261 if (fVA !=
nullptr) {
262 out << spaces <<
" VISUALISATION ATTRIBUTES: " << G4endl;
263 out << spaces <<
" IsVisible " << fVA->IsVisible() << G4endl;
264 out << spaces <<
" IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << G4endl;
265 out << spaces <<
" Colour " << fVA->GetColour() << G4endl;
266 out << spaces <<
" LineStyle " << fVA->GetLineStyle() << G4endl;
267 out << spaces <<
" LineWidth " << fVA->GetLineWidth() << G4endl;
268 out << spaces <<
" IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << G4endl;
269 out << spaces <<
" ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << G4endl;
273 G4UserLimits *fUL = lv->GetUserLimits();
275 if (fUL !=
nullptr) {
276 out << spaces <<
" MaxAllowedStep " << fUL->GetMaxAllowedStep(dummy) << G4endl;
277 out << spaces <<
" UserMaxTrackLength " << fUL->GetUserMaxTrackLength(dummy) << G4endl;
278 out << spaces <<
" UserMaxTime " << fUL->GetUserMaxTime(dummy) << G4endl;
279 out << spaces <<
" UserMinEkine " << fUL->GetUserMinEkine(dummy) << G4endl;
280 out << spaces <<
" UserMinRange " << fUL->GetUserMinRange(dummy) << G4endl;
284 if (lv->GetSensitiveDetector())
285 out << spaces <<
" IS SENSITIVE DETECTOR " << G4endl;
286 if (lv->GetFieldManager())
287 out << spaces <<
" FIELD ON " << G4endl;
290 out << spaces <<
" Quality for optimisation, average number of voxels to be spent per content " 291 << lv->GetSmartless() << G4endl;
294 if (lv->GetFastSimulationManager())
295 out << spaces <<
" Logical Volume is an envelope for a FastSimulationManager " << G4endl;
296 out << spaces <<
" Weight used in the event biasing technique = " << lv->GetBiasWeight() << G4endl;
302 std::string spaces = spacesFromLeafDepth(leafDepth);
307 if (pv->GetMotherLogical())
308 mother = pv->GetMotherLogical()->GetName();
309 out << leafDepth << spaces <<
"### VOLUME = " << pv->GetName() <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
310 <<
" at " << pv->GetTranslation();
312 if (!pv->IsReplicated()) {
314 if (pv->GetRotation() ==
nullptr)
315 out <<
" with no rotation" << G4endl;
316 else if (!_dumpRotation)
317 out <<
" with rotation" << G4endl;
319 out <<
" with rotation " << *(pv->GetRotation()) << G4endl;
323 out << spaces <<
" It is replica: " << G4endl;
329 pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
330 out << spaces <<
" axis " << axis << G4endl << spaces <<
" nReplicas " << nReplicas << G4endl;
331 if (pv->GetParameterisation() !=
nullptr)
332 out << spaces <<
" It is parameterisation " << G4endl;
334 out << spaces <<
" width " << width << G4endl << spaces <<
" offset " << offset << G4endl << spaces
335 <<
" consuming" << consuming << G4endl;
336 if (pv->GetParameterisation() !=
nullptr)
337 out << spaces <<
" It is parameterisation " << G4endl;
343 std::string spaces = spacesFromLeafDepth(leafDepth);
345 fHistory.SetFirstEntry(pv);
347 fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
349 G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
350 G4LogicalVolume *lv = pv->GetLogicalVolume();
353 if (pv->GetMotherLogical())
354 mother = pv->GetMotherLogical()->GetName();
356 lvname.assign(lvname, 0, nchar);
358 out << leafDepth << spaces <<
"### VOLUME = " << lv->GetName() <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
359 <<
" global position of centre " << globalpoint <<
" (r = " << globalpoint.perp()
360 <<
", phi = " << globalpoint.phi() / deg <<
")" << G4endl;
362 int NoDaughters = lv->GetNoDaughters();
363 while ((NoDaughters--) > 0) {
364 G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
365 if (!pvD->IsReplicated())
366 dumpTouch(pvD, leafDepth + 1, out);
370 fHistory.BackLevel();
376 for (ii = 0; ii < leafDepth; ii++) {
383 std::string spaces = spacesFromLeafDepth(leafDepth);
384 out << spaces << *(sol) << G4endl;
388 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
void add1touchable(G4LogicalVolume *lv, int &nTouch)
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
T getUntrackedParameter(std::string const &, T const &) const
void dumpMaterialList(std::ostream &out=std::cout)
void dumpSummary(std::ostream &out=std::cout)
PrintGeomInfoAction(edm::ParameterSet const &p)
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
nav_type copyNumbers() const
return the stack of copy numbers
void dumpHierarchyTreePVLV(std::ostream &out=std::cout)
const std::string names[nVars_]
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Container::value_type value_type
void dumpG4LVTree(std::ostream &out=std::cout)
bool next()
set current node to the next node in the filtered tree
void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out=std::cout)
void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
std::string spacesFromLeafDepth(unsigned int leafDepth)
G4VPhysicalVolume * getTopPV()
void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
G4LogicalVolume * getTopLV()
void dumpG4LVList(std::ostream &out=std::cout)
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
void update(const BeginOfJob *job) override
This routine will be called when the appropriate signal arrives.
bool firstChild()
set the current node to the first child ...
const DDTranslation & translation() const
The absolute translation of the current node.
const std::string & name() const
Returns the name.
void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=std::cout)
~PrintGeomInfoAction() override