18 #include "G4PhysicalVolumeStore.hh"
19 #include "G4LogicalVolumeStore.hh"
20 #include "G4VPhysicalVolume.hh"
21 #include "G4LogicalVolume.hh"
22 #include "G4VSolid.hh"
23 #include "G4Material.hh"
25 #include "G4VisAttributes.hh"
26 #include "G4UserLimits.hh"
27 #include "G4TransportationManager.hh"
32 using namespace CLHEP;
49 nchar = name.find(
"*");
50 name.assign(name,0,nchar);
52 std::cout <<
"PrintGeomInfoAction:: initialised with verbosity levels:"
53 <<
" Summary " << _dumpSummary <<
" LVTree " << _dumpLVTree
54 <<
" LVList " << _dumpLVList <<
" Material " << _dumpMaterial
56 <<
" LV " << _dumpLV <<
" Solid " << _dumpSolid
57 <<
" Attribs " << _dumpAtts
59 <<
" PV " << _dumpPV <<
" Rotation " << _dumpRotation
60 <<
" Replica " << _dumpReplica
62 <<
" Touchable " << _dumpTouch <<
" for names (0-" << nchar
65 <<
" Sensitive " << _dumpSense <<
" for " <<
names.size()
77 (*job)()->get<IdealGeometryRecord>().get(pDD);
79 std::cout <<
"PrintGeomInfoAction::Get Printout of Sensitive Volumes "
80 <<
"for " <<
names.size() <<
" Readout Units" << std::endl;
81 for (
unsigned int i=0;
i<
names.size();
i++) {
88 std::cout <<
"PrintGeomInfoAction:: Get Filtered view for "
89 << attribute <<
" = " << sd << std::endl;
101 unsigned int leafDepth = copy.size();
102 std::cout << leafDepth << spaces <<
"### VOLUME = " << lvname
104 for (
int k=leafDepth-1;
k>=0;
k--)
std::cout <<
" " << copy[
k];
105 std::cout <<
" Centre at " << tran <<
" (r = " << tran.Rho()
106 <<
", phi = " << tran.phi()/deg <<
")" << std::endl;
115 theTopPV = getTopPV();
117 if (_dumpSummary) dumpSummary(
std::cout);
118 if (_dumpLVTree) dumpG4LVTree(
std::cout);
121 if (_dumpMaterial) dumpMaterialList(
std::cout);
122 if (_dumpLVList) dumpG4LVList(
std::cout);
125 if (_dumpLV || _dumpPV || _dumpTouch) dumpHierarchyTreePVLV(
std::cout);
131 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << std::endl;
133 out <<
" No volume created " << std::endl;
136 out <<
" @@@ Geometry built inside world volume: " << theTopPV->GetName() << std::endl;
138 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
139 std::vector<G4LogicalVolume *>::const_iterator lvcite;
140 std::set<G4VSolid *> theSolids;
141 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
142 theSolids.insert((*lvcite)->GetSolid());
143 out <<
" Number of G4VSolid's: " << theSolids.size() << std::endl;
144 out <<
" Number of G4LogicalVolume's: " << lvs->size() << std::endl;
145 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
146 out <<
" Number of G4VPhysicalVolume's: " << pvs->size() << std::endl;
147 out <<
" Number of Touchable's: " << countNoTouchables() << std::endl;
148 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
149 out <<
" Number of G4Material's: " << matTab->size() << std::endl;
154 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << std::endl;
155 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
156 std::vector<G4LogicalVolume*>::const_iterator lvcite;
157 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
158 out <<
"LV:" << (*lvcite)->GetName() <<
"\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << std::endl;
163 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << std::endl;
164 G4LogicalVolume * lv = getTopLV();
165 dumpG4LVLeaf(lv,0,1,out);
170 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
171 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
172 out <<
" with " << matTab->size() <<
" materials " << std::endl;
173 std::vector<G4Material*>::const_iterator matite;
174 for (matite = matTab->begin(); matite != matTab->end(); matite++)
175 out <<
"Material: " << (*matite) << std::endl;
180 for (
unsigned int ii=0;
ii < leafDepth;
ii++) out <<
" ";
181 out <<
" LV:(" << leafDepth <<
") " << lv->GetName() <<
" (" << count
184 std::map<G4LogicalVolume*, unsigned int> lvCount;
185 std::map<G4LogicalVolume*, unsigned int>::const_iterator cite;
186 for (
int ii = 0;
ii < lv->GetNoDaughters();
ii++) {
187 cite = lvCount.find(lv->GetDaughter(
ii)->GetLogicalVolume());
188 if (cite != lvCount.end()) lvCount[cite->first] = (cite->second) + 1;
189 else lvCount.insert(std::pair< G4LogicalVolume*,unsigned int>(lv->GetDaughter(
ii)->GetLogicalVolume(),1));
191 for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
192 dumpG4LVLeaf((cite->first), leafDepth+1, (cite->second), out);
198 G4LogicalVolume * lv = getTopLV();
199 add1touchable(lv, nTouch);
205 int siz = lv->GetNoDaughters();
206 for(
int ii = 0;
ii < siz;
ii++)
207 add1touchable(lv->GetDaughter(
ii)->GetLogicalVolume(), ++nTouch);
218 G4LogicalVolume* topLV = getTopLV();
221 dumpHierarchyLeafPVLV(topLV, 0, out);
222 dumpPV(theTopPV, 0, out);
225 if (_dumpTouch) dumpTouch(theTopPV, 0, out);
231 dumpLV(lv, leafDepth, out);
235 std::set< G4LogicalVolume * > lvDaughters;
236 int NoDaughters = lv->GetNoDaughters();
237 while ((NoDaughters--)>0) {
238 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
240 lvDaughters.insert(pvD->GetLogicalVolume());
243 std::set< G4LogicalVolume * >::const_iterator scite;
244 mmlvpv::const_iterator mmcite;
247 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
248 std::pair< mmlvpv::iterator, mmlvpv::iterator > mmER = lvpvDaughters.equal_range(*scite);
250 for (mmcite = mmER.first ; mmcite != mmER.second; mmcite++)
251 dumpPV((*mmcite).second, leafDepth+1, out);
253 dumpHierarchyLeafPVLV(*scite, leafDepth+1, out );
259 std::string spaces = spacesFromLeafDepth(leafDepth);
263 out << leafDepth << spaces <<
"$$$ VOLUME = " << lv->GetName()
264 <<
" Solid: " << lv->GetSolid()->GetName() <<
" MATERIAL: "
265 << lv->GetMaterial()->GetName() << std::endl;
267 dumpSolid(lv->GetSolid(), leafDepth,
out);
273 const G4VisAttributes * fVA = lv->GetVisAttributes();
275 out << spaces <<
" VISUALISATION ATTRIBUTES: " << std::endl;
276 out << spaces <<
" IsVisible " << fVA->IsVisible() << std::endl;
277 out << spaces <<
" IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << std::endl;
278 out << spaces <<
" Colour " << fVA->GetColour() << std::endl;
279 out << spaces <<
" LineStyle " << fVA->GetLineStyle() << std::endl;
280 out << spaces <<
" LineWidth " << fVA->GetLineWidth() << std::endl;
281 out << spaces <<
" IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << std::endl;
282 out << spaces <<
" ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << std::endl;
286 G4UserLimits * fUL = lv->GetUserLimits();
289 out << spaces <<
" MaxAllowedStep " << fUL->GetMaxAllowedStep(dummy) << std::endl;
290 out << spaces <<
" UserMaxTrackLength " << fUL->GetUserMaxTrackLength(dummy) << std::endl;
291 out << spaces <<
" UserMaxTime " << fUL->GetUserMaxTime(dummy) << std::endl;
292 out << spaces <<
" UserMinEkine " << fUL->GetUserMinEkine(dummy) << std::endl;
293 out << spaces <<
" UserMinRange " << fUL->GetUserMinRange(dummy) << std::endl;
297 if (lv->GetSensitiveDetector())
298 out << spaces <<
" IS SENSITIVE DETECTOR " << std::endl;
299 if (lv->GetFieldManager())
300 out << spaces <<
" FIELD ON " << std::endl;
304 <<
" Quality for optimisation, average number of voxels to be spent per content "
305 << lv->GetSmartless() << std::endl;
308 if (lv->GetFastSimulationManager())
309 out << spaces <<
" Logical Volume is an envelope for a FastSimulationManager "
311 out << spaces <<
" Weight used in the event biasing technique = "
312 << lv->GetBiasWeight() << std::endl;
319 std::string spaces = spacesFromLeafDepth(leafDepth);
324 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
325 out << leafDepth << spaces <<
"### VOLUME = " << pv->GetName()
326 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
327 <<
" at " << pv->GetTranslation();
329 if (!pv->IsReplicated()) {
331 if(pv->GetRotation() == 0) out <<
" with no rotation" << std::endl;
332 else if(!_dumpRotation) out <<
" with rotation" << std::endl;
333 else out <<
" with rotation " << *(pv->GetRotation()) << std::endl;
337 out << spaces <<
" It is replica: " << std::endl;
343 pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
344 out << spaces <<
" axis " << axis << std::endl
345 << spaces <<
" nReplicas " << nReplicas << std::endl;
346 if (pv->GetParameterisation() != 0)
347 out << spaces <<
" It is parameterisation " << std::endl;
349 out << spaces <<
" width " << width << std::endl
350 << spaces <<
" offset " << offset << std::endl
351 << spaces <<
" consuming" << consuming << std::endl;
352 if (pv->GetParameterisation() != 0)
353 out << spaces <<
" It is parameterisation " << std::endl;
360 std::string spaces = spacesFromLeafDepth(leafDepth);
361 if (leafDepth == 0) fHistory.SetFirstEntry(pv);
362 else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
364 G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0,0,0));
365 G4LogicalVolume * lv = pv->GetLogicalVolume();
368 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
370 lvname.assign(lvname,0,nchar);
372 out << leafDepth << spaces <<
"### VOLUME = " << lv->GetName()
373 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
374 <<
" global position of centre " << globalpoint <<
" (r = "
375 << globalpoint.perp() <<
", phi = " << globalpoint.phi()/deg
378 int NoDaughters = lv->GetNoDaughters();
379 while ((NoDaughters--)>0) {
380 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
381 if (!pvD->IsReplicated()) dumpTouch(pvD, leafDepth+1, out);
384 if (leafDepth > 0) fHistory.BackLevel();
391 for(ii = 0; ii < leafDepth; ii++) { spaces +=
" "; }
397 std::string spaces = spacesFromLeafDepth(leafDepth);
398 out << spaces << *(sol) << std::endl;
403 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
407 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
void addFilter(const DDFilter &, DDLogOp op=DDLogOp::AND)
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
void update(const BeginOfJob *job)
This routine will be called when the appropriate signal arrives.
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)
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 setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=std::cout)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.