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;
48 nchar = name.find(
"*");
49 name.assign(name,0,nchar);
51 G4cout <<
"PrintGeomInfoAction:: initialised with verbosity levels:" 52 <<
" Summary " << _dumpSummary <<
" LVTree " << _dumpLVTree
53 <<
" LVList " << _dumpLVList <<
" Material " << _dumpMaterial
55 <<
" LV " << _dumpLV <<
" Solid " << _dumpSolid
56 <<
" Attribs " << _dumpAtts
58 <<
" PV " << _dumpPV <<
" Rotation " << _dumpRotation
59 <<
" Replica " << _dumpReplica
61 <<
" Touchable " << _dumpTouch <<
" for names (0-" << nchar
64 <<
" Sensitive " << _dumpSense <<
" for " <<
names.size()
76 (*job)()->get<IdealGeometryRecord>().get(pDD);
78 G4cout <<
"PrintGeomInfoAction::Get Printout of Sensitive Volumes " 79 <<
"for " <<
names.size() <<
" Readout Units" << G4endl;
80 for (
unsigned int i=0;
i<
names.size();
i++) {
85 G4cout <<
"PrintGeomInfoAction:: Get Filtered view for " 86 << attribute <<
" = " << sd << G4endl;
97 unsigned int leafDepth = copy.size();
98 G4cout << leafDepth << spaces <<
"### VOLUME = " << lvname
100 for (
int k=leafDepth-1;
k>=0;
k--)
G4cout <<
" " << copy[
k];
101 G4cout <<
" Centre at " << tran <<
" (r = " << tran.Rho()
102 <<
", phi = " << tran.phi()/deg <<
")" << G4endl;
111 theTopPV = getTopPV();
113 if (_dumpSummary) dumpSummary(
G4cout);
114 if (_dumpLVTree) dumpG4LVTree(
G4cout);
117 if (_dumpMaterial) dumpMaterialList(
G4cout);
118 if (_dumpLVList) dumpG4LVList(
G4cout);
121 if (_dumpLV || _dumpPV || _dumpTouch) dumpHierarchyTreePVLV(
G4cout);
127 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
128 if (theTopPV ==
nullptr) {
129 out <<
" No volume created " << G4endl;
132 out <<
" @@@ Geometry built inside world volume: " << theTopPV->GetName() << G4endl;
134 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
135 std::vector<G4LogicalVolume *>::const_iterator lvcite;
136 std::set<G4VSolid *> theSolids;
137 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
138 theSolids.insert((*lvcite)->GetSolid());
139 out <<
" Number of G4VSolid's: " << theSolids.size() << G4endl;
140 out <<
" Number of G4LogicalVolume's: " << lvs->size() << G4endl;
141 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
142 out <<
" Number of G4VPhysicalVolume's: " << pvs->size() << G4endl;
143 out <<
" Number of Touchable's: " << countNoTouchables() << G4endl;
144 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
145 out <<
" Number of G4Material's: " << matTab->size() << G4endl;
150 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << G4endl;
151 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
152 std::vector<G4LogicalVolume*>::const_iterator lvcite;
153 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
154 out <<
"LV:" << (*lvcite)->GetName() <<
"\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << G4endl;
159 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl;
160 G4LogicalVolume * lv = getTopLV();
161 dumpG4LVLeaf(lv,0,1,out);
166 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
167 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
168 out <<
" with " << matTab->size() <<
" materials " << G4endl;
169 std::vector<G4Material*>::const_iterator matite;
170 for (matite = matTab->begin(); matite != matTab->end(); matite++)
171 out <<
"Material: " << (*matite) << G4endl;
176 for (
unsigned int ii=0;
ii < leafDepth;
ii++) out <<
" ";
177 out <<
" LV:(" << leafDepth <<
") " << lv->GetName() <<
" (" << count
180 std::map<G4LogicalVolume*, unsigned int> lvCount;
181 std::map<G4LogicalVolume*, unsigned int>::const_iterator cite;
182 for (
int ii = 0;
ii < lv->GetNoDaughters();
ii++) {
183 cite = lvCount.find(lv->GetDaughter(
ii)->GetLogicalVolume());
184 if (cite != lvCount.end()) lvCount[cite->first] = (cite->second) + 1;
185 else lvCount.insert(std::pair< G4LogicalVolume*,unsigned int>(lv->GetDaughter(
ii)->GetLogicalVolume(),1));
187 for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
188 dumpG4LVLeaf((cite->first), leafDepth+1, (cite->second), out);
194 G4LogicalVolume * lv = getTopLV();
195 add1touchable(lv, nTouch);
201 int siz = lv->GetNoDaughters();
202 for(
int ii = 0;
ii < siz;
ii++)
203 add1touchable(lv->GetDaughter(
ii)->GetLogicalVolume(), ++nTouch);
214 G4LogicalVolume* topLV = getTopLV();
217 dumpHierarchyLeafPVLV(topLV, 0, out);
218 dumpPV(theTopPV, 0, out);
221 if (_dumpTouch) dumpTouch(theTopPV, 0, out);
227 dumpLV(lv, leafDepth, out);
231 std::set< G4LogicalVolume * > lvDaughters;
232 int NoDaughters = lv->GetNoDaughters();
233 while ((NoDaughters--)>0) {
234 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
236 lvDaughters.insert(pvD->GetLogicalVolume());
239 std::set< G4LogicalVolume * >::const_iterator scite;
240 mmlvpv::const_iterator mmcite;
243 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
244 std::pair< mmlvpv::iterator, mmlvpv::iterator > mmER = lvpvDaughters.equal_range(*scite);
246 for (mmcite = mmER.first ; mmcite != mmER.second; mmcite++)
247 dumpPV((*mmcite).second, leafDepth+1, out);
249 dumpHierarchyLeafPVLV(*scite, leafDepth+1, out );
255 std::string spaces = spacesFromLeafDepth(leafDepth);
259 out << leafDepth << spaces <<
"$$$ VOLUME = " << lv->GetName()
260 <<
" Solid: " << lv->GetSolid()->GetName() <<
" MATERIAL: " 261 << lv->GetMaterial()->GetName() << G4endl;
263 dumpSolid(lv->GetSolid(), leafDepth,
out);
269 const G4VisAttributes * fVA = lv->GetVisAttributes();
271 out << spaces <<
" VISUALISATION ATTRIBUTES: " << G4endl;
272 out << spaces <<
" IsVisible " << fVA->IsVisible() << G4endl;
273 out << spaces <<
" IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << G4endl;
274 out << spaces <<
" Colour " << fVA->GetColour() << G4endl;
275 out << spaces <<
" LineStyle " << fVA->GetLineStyle() << G4endl;
276 out << spaces <<
" LineWidth " << fVA->GetLineWidth() << G4endl;
277 out << spaces <<
" IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << G4endl;
278 out << spaces <<
" ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << G4endl;
282 G4UserLimits * fUL = lv->GetUserLimits();
285 out << spaces <<
" MaxAllowedStep " << fUL->GetMaxAllowedStep(dummy) << G4endl;
286 out << spaces <<
" UserMaxTrackLength " << fUL->GetUserMaxTrackLength(dummy) << G4endl;
287 out << spaces <<
" UserMaxTime " << fUL->GetUserMaxTime(dummy) << G4endl;
288 out << spaces <<
" UserMinEkine " << fUL->GetUserMinEkine(dummy) << G4endl;
289 out << spaces <<
" UserMinRange " << fUL->GetUserMinRange(dummy) << G4endl;
293 if (lv->GetSensitiveDetector())
294 out << spaces <<
" IS SENSITIVE DETECTOR " << G4endl;
295 if (lv->GetFieldManager())
296 out << spaces <<
" FIELD ON " << G4endl;
300 <<
" Quality for optimisation, average number of voxels to be spent per content " 301 << lv->GetSmartless() << G4endl;
304 if (lv->GetFastSimulationManager())
305 out << spaces <<
" Logical Volume is an envelope for a FastSimulationManager " 307 out << spaces <<
" Weight used in the event biasing technique = " 308 << lv->GetBiasWeight() << G4endl;
315 std::string spaces = spacesFromLeafDepth(leafDepth);
320 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
321 out << leafDepth << spaces <<
"### VOLUME = " << pv->GetName()
322 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
323 <<
" at " << pv->GetTranslation();
325 if (!pv->IsReplicated()) {
327 if(pv->GetRotation() ==
nullptr) out <<
" with no rotation" << G4endl;
328 else if(!_dumpRotation) out <<
" with rotation" << G4endl;
329 else out <<
" with rotation " << *(pv->GetRotation()) << G4endl;
333 out << spaces <<
" It is replica: " << G4endl;
339 pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
340 out << spaces <<
" axis " << axis << G4endl
341 << spaces <<
" nReplicas " << nReplicas << G4endl;
342 if (pv->GetParameterisation() !=
nullptr)
343 out << spaces <<
" It is parameterisation " << G4endl;
345 out << spaces <<
" width " << width << G4endl
346 << spaces <<
" offset " << offset << G4endl
347 << spaces <<
" consuming" << consuming << G4endl;
348 if (pv->GetParameterisation() !=
nullptr)
349 out << spaces <<
" It is parameterisation " << G4endl;
356 std::string spaces = spacesFromLeafDepth(leafDepth);
357 if (leafDepth == 0) fHistory.SetFirstEntry(pv);
358 else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
360 G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0,0,0));
361 G4LogicalVolume * lv = pv->GetLogicalVolume();
364 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
366 lvname.assign(lvname,0,nchar);
368 out << leafDepth << spaces <<
"### VOLUME = " << lv->GetName()
369 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
370 <<
" global position of centre " << globalpoint <<
" (r = " 371 << globalpoint.perp() <<
", phi = " << globalpoint.phi()/deg
374 int NoDaughters = lv->GetNoDaughters();
375 while ((NoDaughters--)>0) {
376 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
377 if (!pvD->IsReplicated()) dumpTouch(pvD, leafDepth+1, out);
380 if (leafDepth > 0) fHistory.BackLevel();
387 for(ii = 0; ii < leafDepth; ii++) { spaces +=
" "; }
393 std::string spaces = spacesFromLeafDepth(leafDepth);
394 out << spaces << *(sol) << G4endl;
399 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
403 return theTopPV->GetLogicalVolume();
void add1touchable(G4LogicalVolume *lv, int &nTouch)
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)
static const HistoName names[]
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
nav_type copyNumbers() const
return the stack of copy numbers
void dumpHierarchyTreePVLV(std::ostream &out=std::cout)
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