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 std::cout <<
"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 std::cout <<
"PrintGeomInfoAction::Get Printout of Sensitive Volumes " 79 <<
"for " <<
names.size() <<
" Readout Units" << std::endl;
80 for (
unsigned int i=0;
i<
names.size();
i++) {
87 std::cout <<
"PrintGeomInfoAction:: Get Filtered view for " 88 << attribute <<
" = " << sd << std::endl;
100 unsigned int leafDepth = copy.size();
101 std::cout << leafDepth << spaces <<
"### VOLUME = " << lvname
103 for (
int k=leafDepth-1;
k>=0;
k--)
std::cout <<
" " << copy[
k];
104 std::cout <<
" Centre at " << tran <<
" (r = " << tran.Rho()
105 <<
", phi = " << tran.phi()/deg <<
")" << std::endl;
114 theTopPV = getTopPV();
116 if (_dumpSummary) dumpSummary(
std::cout);
117 if (_dumpLVTree) dumpG4LVTree(
std::cout);
120 if (_dumpMaterial) dumpMaterialList(
std::cout);
121 if (_dumpLVList) dumpG4LVList(
std::cout);
124 if (_dumpLV || _dumpPV || _dumpTouch) dumpHierarchyTreePVLV(
std::cout);
130 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << std::endl;
132 out <<
" No volume created " << std::endl;
135 out <<
" @@@ Geometry built inside world volume: " << theTopPV->GetName() << std::endl;
137 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
138 std::vector<G4LogicalVolume *>::const_iterator lvcite;
139 std::set<G4VSolid *> theSolids;
140 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
141 theSolids.insert((*lvcite)->GetSolid());
142 out <<
" Number of G4VSolid's: " << theSolids.size() << std::endl;
143 out <<
" Number of G4LogicalVolume's: " << lvs->size() << std::endl;
144 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
145 out <<
" Number of G4VPhysicalVolume's: " << pvs->size() << std::endl;
146 out <<
" Number of Touchable's: " << countNoTouchables() << std::endl;
147 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
148 out <<
" Number of G4Material's: " << matTab->size() << std::endl;
153 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << std::endl;
154 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
155 std::vector<G4LogicalVolume*>::const_iterator lvcite;
156 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
157 out <<
"LV:" << (*lvcite)->GetName() <<
"\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << std::endl;
162 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << std::endl;
163 G4LogicalVolume * lv = getTopLV();
164 dumpG4LVLeaf(lv,0,1,out);
169 out <<
" @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
170 const G4MaterialTable * matTab = G4Material::GetMaterialTable();
171 out <<
" with " << matTab->size() <<
" materials " << std::endl;
172 std::vector<G4Material*>::const_iterator matite;
173 for (matite = matTab->begin(); matite != matTab->end(); matite++)
174 out <<
"Material: " << (*matite) << std::endl;
179 for (
unsigned int ii=0;
ii < leafDepth;
ii++) out <<
" ";
180 out <<
" LV:(" << leafDepth <<
") " << lv->GetName() <<
" (" << count
183 std::map<G4LogicalVolume*, unsigned int> lvCount;
184 std::map<G4LogicalVolume*, unsigned int>::const_iterator cite;
185 for (
int ii = 0;
ii < lv->GetNoDaughters();
ii++) {
186 cite = lvCount.find(lv->GetDaughter(
ii)->GetLogicalVolume());
187 if (cite != lvCount.end()) lvCount[cite->first] = (cite->second) + 1;
188 else lvCount.insert(std::pair< G4LogicalVolume*,unsigned int>(lv->GetDaughter(
ii)->GetLogicalVolume(),1));
190 for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
191 dumpG4LVLeaf((cite->first), leafDepth+1, (cite->second), out);
197 G4LogicalVolume * lv = getTopLV();
198 add1touchable(lv, nTouch);
204 int siz = lv->GetNoDaughters();
205 for(
int ii = 0;
ii < siz;
ii++)
206 add1touchable(lv->GetDaughter(
ii)->GetLogicalVolume(), ++nTouch);
217 G4LogicalVolume* topLV = getTopLV();
220 dumpHierarchyLeafPVLV(topLV, 0, out);
221 dumpPV(theTopPV, 0, out);
224 if (_dumpTouch) dumpTouch(theTopPV, 0, out);
230 dumpLV(lv, leafDepth, out);
234 std::set< G4LogicalVolume * > lvDaughters;
235 int NoDaughters = lv->GetNoDaughters();
236 while ((NoDaughters--)>0) {
237 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
239 lvDaughters.insert(pvD->GetLogicalVolume());
242 std::set< G4LogicalVolume * >::const_iterator scite;
243 mmlvpv::const_iterator mmcite;
246 for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
247 std::pair< mmlvpv::iterator, mmlvpv::iterator > mmER = lvpvDaughters.equal_range(*scite);
249 for (mmcite = mmER.first ; mmcite != mmER.second; mmcite++)
250 dumpPV((*mmcite).second, leafDepth+1, out);
252 dumpHierarchyLeafPVLV(*scite, leafDepth+1, out );
258 std::string spaces = spacesFromLeafDepth(leafDepth);
262 out << leafDepth << spaces <<
"$$$ VOLUME = " << lv->GetName()
263 <<
" Solid: " << lv->GetSolid()->GetName() <<
" MATERIAL: " 264 << lv->GetMaterial()->GetName() << std::endl;
266 dumpSolid(lv->GetSolid(), leafDepth,
out);
272 const G4VisAttributes * fVA = lv->GetVisAttributes();
274 out << spaces <<
" VISUALISATION ATTRIBUTES: " << std::endl;
275 out << spaces <<
" IsVisible " << fVA->IsVisible() << std::endl;
276 out << spaces <<
" IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << std::endl;
277 out << spaces <<
" Colour " << fVA->GetColour() << std::endl;
278 out << spaces <<
" LineStyle " << fVA->GetLineStyle() << std::endl;
279 out << spaces <<
" LineWidth " << fVA->GetLineWidth() << std::endl;
280 out << spaces <<
" IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << std::endl;
281 out << spaces <<
" ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << std::endl;
285 G4UserLimits * fUL = lv->GetUserLimits();
288 out << spaces <<
" MaxAllowedStep " << fUL->GetMaxAllowedStep(dummy) << std::endl;
289 out << spaces <<
" UserMaxTrackLength " << fUL->GetUserMaxTrackLength(dummy) << std::endl;
290 out << spaces <<
" UserMaxTime " << fUL->GetUserMaxTime(dummy) << std::endl;
291 out << spaces <<
" UserMinEkine " << fUL->GetUserMinEkine(dummy) << std::endl;
292 out << spaces <<
" UserMinRange " << fUL->GetUserMinRange(dummy) << std::endl;
296 if (lv->GetSensitiveDetector())
297 out << spaces <<
" IS SENSITIVE DETECTOR " << std::endl;
298 if (lv->GetFieldManager())
299 out << spaces <<
" FIELD ON " << std::endl;
303 <<
" Quality for optimisation, average number of voxels to be spent per content " 304 << lv->GetSmartless() << std::endl;
307 if (lv->GetFastSimulationManager())
308 out << spaces <<
" Logical Volume is an envelope for a FastSimulationManager " 310 out << spaces <<
" Weight used in the event biasing technique = " 311 << lv->GetBiasWeight() << std::endl;
318 std::string spaces = spacesFromLeafDepth(leafDepth);
323 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
324 out << leafDepth << spaces <<
"### VOLUME = " << pv->GetName()
325 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
326 <<
" at " << pv->GetTranslation();
328 if (!pv->IsReplicated()) {
330 if(pv->GetRotation() == 0) out <<
" with no rotation" << std::endl;
331 else if(!_dumpRotation) out <<
" with rotation" << std::endl;
332 else out <<
" with rotation " << *(pv->GetRotation()) << std::endl;
336 out << spaces <<
" It is replica: " << std::endl;
342 pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
343 out << spaces <<
" axis " << axis << std::endl
344 << spaces <<
" nReplicas " << nReplicas << std::endl;
345 if (pv->GetParameterisation() != 0)
346 out << spaces <<
" It is parameterisation " << std::endl;
348 out << spaces <<
" width " << width << std::endl
349 << spaces <<
" offset " << offset << std::endl
350 << spaces <<
" consuming" << consuming << std::endl;
351 if (pv->GetParameterisation() != 0)
352 out << spaces <<
" It is parameterisation " << std::endl;
359 std::string spaces = spacesFromLeafDepth(leafDepth);
360 if (leafDepth == 0) fHistory.SetFirstEntry(pv);
361 else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
363 G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0,0,0));
364 G4LogicalVolume * lv = pv->GetLogicalVolume();
367 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
369 lvname.assign(lvname,0,nchar);
371 out << leafDepth << spaces <<
"### VOLUME = " << lv->GetName()
372 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
373 <<
" global position of centre " << globalpoint <<
" (r = " 374 << globalpoint.perp() <<
", phi = " << globalpoint.phi()/deg
377 int NoDaughters = lv->GetNoDaughters();
378 while ((NoDaughters--)>0) {
379 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
380 if (!pvD->IsReplicated()) dumpTouch(pvD, leafDepth+1, out);
383 if (leafDepth > 0) fHistory.BackLevel();
390 for(ii = 0; ii < leafDepth; ii++) { spaces +=
" "; }
396 std::string spaces = spacesFromLeafDepth(leafDepth);
397 out << spaces << *(sol) << std::endl;
402 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
406 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.