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"
56 nchar = name.find(
"*");
57 name.assign(name,0,nchar);
59 std::cout <<
"size of _lvNames2Dump = " << _lvNames2Dump.size()
61 <<
" size of _zLayer = " << _zLayer.size() << std::endl;
62 std::cout <<
"PrintGeomMatInfo:: initialised with verbosity levels:"
63 <<
" Summary " <<
_dumpSummary <<
" LVTree " << _dumpLVTree
66 <<
" LVMatBudget " << _dumpLVMatBudget <<
" for";
69 _lvNames2Dump.size() == _zLayer.size()) {
70 for (
unsigned int i=0;
i<_lvNames2Dump.size();
i++) {
79 <<
" Problem with unequal sizes!! Fix and rerun";
84 <<
" LV " << _dumpLV <<
" Solid " << _dumpSolid
85 <<
" Attribs " << _dumpAtts
87 <<
" PV " << _dumpPV <<
" Rotation " << _dumpRotation
88 <<
" Replica " << _dumpReplica
90 <<
" Touchable " << _dumpTouch <<
" for names (0-" << nchar
93 <<
" Sensitive " << _dumpSense <<
" for " <<
names.size()
105 (*job)()->get<IdealGeometryRecord>().get(pDD);
107 std::cout <<
"PrintGeomMatInfo::Get Printout of Sensitive Volumes "
108 <<
"for " <<
names.size() <<
" Readout Units" << std::endl;
109 for (
unsigned int i=0;
i<
names.size();
i++) {
116 std::cout <<
"PrintGeomMatInfo:: Get Filtered view for "
117 << attribute <<
" = " << sd << std::endl;
129 unsigned int leafDepth = copy.size();
130 std::cout << leafDepth << spaces <<
"### VOLUME = " << lvname
132 for (
int k=leafDepth-1;
k>=0;
k--)
std::cout <<
" " << copy[
k];
133 std::cout <<
" Centre at " << tran <<
" (r = " << tran.Rho()
134 <<
", phi = " << tran.phi()/deg <<
")" << std::endl;
160 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << std::endl;
163 out <<
" No volume created " << std::endl;
166 out <<
" @@@ Geometry built inside world volume: " <<
theTopPV->GetName() << std::endl;
168 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
169 std::vector<G4LogicalVolume *>::const_iterator lvcite;
170 std::set<G4VSolid *> theSolids;
171 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
172 theSolids.insert((*lvcite)->GetSolid());
173 out <<
" Number of G4VSolid's: " << theSolids.size() << std::endl;
174 out <<
" Number of G4LogicalVolume's: " << lvs->size() << std::endl;
175 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
176 out <<
" Number of G4VPhysicalVolume's: " << pvs->size() << std::endl;
178 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
179 out <<
" Number of G4Material's: " << matTab->size() << std::endl;
184 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << std::endl;
185 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
186 std::vector<G4LogicalVolume*>::const_iterator lvcite;
187 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
188 out <<
"LV:" << (*lvcite)->GetName() <<
"\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << std::endl;
193 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << std::endl;
200 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
201 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
202 out <<
" with " << matTab->size() <<
" materials " << std::endl;
203 std::vector<G4Material*>::const_iterator matite;
204 for (matite = matTab->begin(); matite != matTab->end(); matite++)
205 out <<
"Material: " << (*matite) << std::endl;
210 for (
unsigned int ii=0;
ii < leafDepth;
ii++) out <<
" ";
211 out <<
" LV:(" << leafDepth <<
") " << lv->GetName() <<
" (" << count
214 std::map<G4LogicalVolume*, unsigned int> lvCount;
215 std::map<G4LogicalVolume*, unsigned int>::const_iterator cite;
216 for (
int ii = 0;
ii < lv->GetNoDaughters();
ii++) {
217 cite = lvCount.find(lv->GetDaughter(
ii)->GetLogicalVolume());
218 if (cite != lvCount.end()) lvCount[cite->first] = (cite->second) + 1;
219 else lvCount.insert(std::pair< G4LogicalVolume*,unsigned int>(lv->GetDaughter(
ii)->GetLogicalVolume(),1));
221 for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
222 dumpG4LVLeaf((cite->first), leafDepth+1, (cite->second), out);
227 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Material Budget Tree " << std::endl;
252 unsigned int total_multipler = 1;
255 for (
unsigned int ii=0;
ii < leafDepth;
ii++) out <<
" ";
259 out <<
" LV::" << leafDepth <<
": " << lv->GetName() <<
" :" << count
260 <<
": " << lv->GetSolid()->GetName() <<
" :" << lv->GetSolid()->GetCubicVolume()
261 <<
": "<< lv->GetMaterial()->GetName() <<
" :" << lv->GetMaterial()->GetRadlen()
262 <<
":" <<
" :" << total_multipler <<
":"
263 <<
" thk :" << thick <<
": x/X0 :" << thick/lv->GetMaterial()->GetRadlen()
264 <<
":" <<
" Kg : " << lv->GetMass()/kg << std::endl;
266 for (
unsigned int ii=0;
ii < leafDepth;
ii++) out <<
" ";
267 out <<
" LV:(" << leafDepth <<
") " << lv->GetName() <<
" (" << count <<
")" << std::endl;
271 std::map<G4LogicalVolume*, unsigned int> lvCount;
272 std::map<G4LogicalVolume*, unsigned int>::const_iterator cite;
273 for (
int ii = 0;
ii < lv->GetNoDaughters();
ii++) {
274 cite = lvCount.find(lv->GetDaughter(
ii)->GetLogicalVolume());
275 if (cite != lvCount.end()) lvCount[cite->first] = (cite->second) + 1;
276 else lvCount.insert(std::pair< G4LogicalVolume*,unsigned int>(lv->GetDaughter(
ii)->GetLogicalVolume(),1));
278 for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
294 int siz = lv->GetNoDaughters();
295 for(
int ii = 0;
ii < siz;
ii++)
307 G4LogicalVolume* topLV =
getTopLV();
320 dumpLV(lv, leafDepth, out);
324 std::set< G4LogicalVolume * > lvDaughters;
325 int NoDaughters = lv->GetNoDaughters();
326 while ((NoDaughters--)>0)
328 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
330 lvDaughters.insert(pvD->GetLogicalVolume());
333 std::set< G4LogicalVolume * >::const_iterator scite;
334 mmlvpv::const_iterator mmcite;
337 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++)
339 std::pair< mmlvpv::iterator, mmlvpv::iterator > mmER = lvpvDaughters.equal_range(*scite);
341 for (mmcite = mmER.first ; mmcite != mmER.second; mmcite++)
342 dumpPV((*mmcite).second, leafDepth+1, out);
354 out << leafDepth << spaces <<
"$$$ VOLUME = " << lv->GetName()
355 <<
" Solid: " << lv->GetSolid()->GetName() <<
" MATERIAL: "
356 << lv->GetMaterial()->GetName() << std::endl;
364 const G4VisAttributes * fVA = lv->GetVisAttributes();
366 out << spaces <<
" VISUALISATION ATTRIBUTES: " << std::endl;
367 out << spaces <<
" IsVisible " << fVA->IsVisible() << std::endl;
368 out << spaces <<
" IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << std::endl;
369 out << spaces <<
" Colour " << fVA->GetColour() << std::endl;
370 out << spaces <<
" LineStyle " << fVA->GetLineStyle() << std::endl;
371 out << spaces <<
" LineWidth " << fVA->GetLineWidth() << std::endl;
372 out << spaces <<
" IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << std::endl;
373 out << spaces <<
" ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << std::endl;
377 G4UserLimits * fUL = lv->GetUserLimits();
380 out << spaces <<
" MaxAllowedStep " << fUL->GetMaxAllowedStep(dummy) << std::endl;
381 out << spaces <<
" UserMaxTrackLength " << fUL->GetUserMaxTrackLength(dummy) << std::endl;
382 out << spaces <<
" UserMaxTime " << fUL->GetUserMaxTime(dummy) << std::endl;
383 out << spaces <<
" UserMinEkine " << fUL->GetUserMinEkine(dummy) << std::endl;
384 out << spaces <<
" UserMinRange " << fUL->GetUserMinRange(dummy) << std::endl;
388 if (lv->GetSensitiveDetector())
389 out << spaces <<
" IS SENSITIVE DETECTOR " << std::endl;
390 if (lv->GetFieldManager())
391 out << spaces <<
" FIELD ON " << std::endl;
395 <<
" Quality for optimisation, average number of voxels to be spent per content "
396 << lv->GetSmartless() << std::endl;
399 if (lv->GetFastSimulationManager())
400 out << spaces <<
" Logical Volume is an envelope for a FastSimulationManager "
402 out << spaces <<
" Weight used in the event biasing technique = "
403 << lv->GetBiasWeight() << std::endl;
416 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
417 out << leafDepth << spaces <<
"### VOLUME = " << pv->GetName()
418 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
419 <<
" at " << pv->GetTranslation();
421 if (!pv->IsReplicated())
425 if(pv->GetRotation() == 0) out <<
" with no rotation" << std::endl;
426 else if(!
_dumpRotation) out <<
" with rotation" << std::endl;
427 else out <<
" with rotation " << *(pv->GetRotation()) << std::endl;
434 out << spaces <<
" It is replica: " << std::endl;
440 pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
441 out << spaces <<
" axis " << axis << std::endl
442 << spaces <<
" nReplicas " << nReplicas << std::endl;
443 if (pv->GetParameterisation() != 0)
444 out << spaces <<
" It is parameterisation " << std::endl;
446 out << spaces <<
" width " << width << std::endl
447 << spaces <<
" offset " << offset << std::endl
448 << spaces <<
" consuming" << consuming << std::endl;
449 if (pv->GetParameterisation() != 0)
450 out << spaces <<
" It is parameterisation " << std::endl;
458 if (leafDepth == 0)
fHistory.SetFirstEntry(pv);
459 else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
461 G4ThreeVector globalpoint =
fHistory.GetTopTransform().Inverse().
462 TransformPoint(G4ThreeVector(0,0,0));
463 G4LogicalVolume * lv = pv->GetLogicalVolume();
466 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
468 lvname.assign(lvname,0,
nchar);
470 out << leafDepth << spaces <<
"### VOLUME = " << lv->GetName()
471 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
472 <<
" global position of centre " << globalpoint <<
" (r = "
473 << globalpoint.perp() <<
", phi = " << globalpoint.phi()/deg
476 int NoDaughters = lv->GetNoDaughters();
477 while ((NoDaughters--)>0)
479 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
480 if (!pvD->IsReplicated())
dumpTouch(pvD, leafDepth+1, out);
483 if (leafDepth > 0)
fHistory.BackLevel();
490 for(ii = 0; ii < leafDepth; ii++) { spaces +=
" "; }
497 out << spaces << *(sol) << std::endl;
502 return G4TransportationManager::GetTransportationManager()
503 ->GetNavigatorForTracking()->GetWorldVolume();
507 {
return theTopPV->GetLogicalVolume(); }
T getUntrackedParameter(std::string const &, T const &) const
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
G4VPhysicalVolume * getTopPV()
void dumpG4LVTree(std::ostream &out=std::cout)
void addFilter(const DDFilter &, log_op op=AND)
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
void dumpG4LVLeafWithMat(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=std::cout)
std::vector< double > _radiusLayer
nav_type copyNumbers() const
return the stack of copy numbers
std::vector< std::string > names
void dumpMaterialList(std::ostream &out=std::cout)
G4VPhysicalVolume * theTopPV
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
void add1touchable(G4LogicalVolume *lv, int &nTouch)
void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
void dumpG4LVList(std::ostream &out=std::cout)
std::vector< double > _areaLayer
void dumpG4LVMatBudget(std::ostream &out=std::cout)
std::vector< double > _zLayer
void dumpHierarchyTreePVLV(std::ostream &out=std::cout)
void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
bool next()
set current node to the next node in the filtered tree
std::string spacesFromLeafDepth(unsigned int leafDepth)
void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
unsigned int offset(bool)
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
Container::value_type value_type
void dumpSummary(std::ostream &out=std::cout)
G4LogicalVolume * getTopLV()
PrintGeomMatInfo(edm::ParameterSet const &p)
void update(const BeginOfJob *job)
This routine will be called when the appropriate signal arrives.
std::vector< std::string > _lvNames2Dump
void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out=std::cout)
bool firstChild()
set the current node to the first child ...
void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=std::cout)
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
const DDTranslation & translation() const
The absolute translation of the current node.
unsigned int _maxLevelsCounted
std::vector< unsigned int > _countsPerLevel
G4NavigationHistory fHistory
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.