18 #include "G4PhysicalVolumeStore.hh" 19 #include "G4LogicalVolumeStore.hh" 20 #include "G4VPhysicalVolume.hh" 21 #include "G4LogicalVolume.hh" 22 #include "G4VSolid.hh" 23 #include "G4Material.hh" 24 #include "G4NavigationHistory.hh" 26 #include "G4VisAttributes.hh" 27 #include "G4UserLimits.hh" 28 #include "G4TransportationManager.hh" 48 void fillLV(G4LogicalVolume* lv);
62 std::vector<G4VSolid*>
sls_;
63 std::vector<G4VPhysicalVolume*>
pvs_;
64 std::map<DDSolidShape, std::pair<int, int>>
kount_;
68 std::vector<std::string> defNames;
69 nodeNames_ =
p.getUntrackedParameter<std::vector<std::string>>(
"NodeNames", defNames);
70 G4cout <<
"PrintGeomSummary:: initialised for " <<
nodeNames_.size() <<
" nodes:" << G4endl;
98 G4cout <<
"PrintGeomSummary::Initialize ESGetToken for DDCompactView" << G4endl;
104 const auto& gra = cpv->
graph();
110 for (
adjl_iterator git = gra.begin(); git != gra.end(); ++git) {
115 for (Graph::edge_list::const_iterator cit = git->begin(); cit != git->end(); ++cit) {
121 G4cout <<
"Finds " <<
solidMap_.size() <<
" different solids in the tree" << G4endl;
136 G4cout <<
" Number of G4VPhysicalVolume's for " <<
name <<
": " <<
pvs_.size() << G4endl;
139 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
140 std::vector<G4LogicalVolume*>::const_iterator lvcite;
141 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
142 if ((*lvcite)->GetName() == (G4String)(
nodeNames_[
k])) {
150 const G4PhysicalVolumeStore*
pvs = G4PhysicalVolumeStore::GetInstance();
151 std::vector<G4VPhysicalVolume*>::const_iterator pvcite;
152 for (pvcite =
pvs->begin(); pvcite !=
pvs->end(); pvcite++) {
153 if ((*pvcite)->GetName() == (G4String)(
nodeNames_[
k])) {
165 std::map<DDSolidShape, std::string>::iterator it =
solidShape_.find(solid.
shape());
177 G4VSolid* sl = lv->GetSolid();
181 for (
int ii = 0;
ii < (
int)(lv->GetNoDaughters());
ii++)
182 fillLV(lv->GetDaughter(
ii)->GetLogicalVolume());
188 for (
int ii = 0;
ii < (
int)(
pv->GetLogicalVolume()->GetNoDaughters());
ii++)
189 fillPV(
pv->GetLogicalVolume()->GetDaughter(
ii));
194 out << G4endl << G4endl <<
"@@@@@@@@@@@@@@@@@@ Dumping Summary For Node " <<
name << G4endl;
195 out <<
" Number of G4VSolid's: " <<
sls_.size() << G4endl;
196 out <<
" Number of G4LogicalVolume's: " <<
lvs_.size() << G4endl;
197 out <<
" Number of Touchable's: " <<
touch_.size() << G4endl;
199 out << G4endl <<
"Occurence of each type of shape among Solids" << G4endl;
201 for (std::vector<G4VSolid*>::iterator it =
sls_.begin(); it !=
sls_.end(); ++it) {
207 out << G4endl <<
"Occurence of each type of shape among Logical Volumes" << G4endl;
209 for (std::vector<G4LogicalVolume*>::iterator it =
lvs_.begin(); it !=
lvs_.end(); ++it) {
215 out << G4endl <<
"Occurence of each type of shape among Touchables" << G4endl;
217 for (std::vector<G4LogicalVolume*>::iterator it =
touch_.begin(); it !=
touch_.end(); ++it) {
225 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
230 if (
name.find(
"_refl") <
name.size()) {
234 std::map<std::string, DDSolidShape>::const_iterator jt =
solidMap_.find(
name);
237 if (itr ==
kount_.end()) {
238 kount_[
shape] = (
refl) ? std::pair<int, int>(0, 1) : std::pair<int, int>(1, 0);
240 kount_[
shape] = (
refl) ? std::pair<int, int>(((itr->second).first), ++((itr->second).second))
241 : std::pair<int, int>(++((itr->second).
first), ((itr->second).
second));
249 out <<
"Shape [" <<
k <<
"] " <<
shape <<
" # " << (itr->second).
first <<
" : " << (itr->second).second << G4endl;
math::Graph< DDLogicalPart, DDPosData * > Graph
#define DEFINE_SIMWATCHER(type)
void update(const BeginOfRun *run) override
This routine will be called when the appropriate signal arrives.
void addName(std::string name)
void addSolid(const DDLogicalPart &part)
void fillPV(G4VPhysicalVolume *pv)
void printSummary(std::ostream &out)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::map< DDSolidShape, std::string > solidShape_
uint32_t cc[maxCellsPerHit]
G4VPhysicalVolume * getTopPV()
G4VPhysicalVolume * theTopPV_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Compact representation of the geometrical detector hierarchy.
A DDSolid represents the shape of a part.
void beginRun(edm::EventSetup const &) override
U second(std::pair< T, U > const &p)
void registerConsumes(edm::ConsumesCollector) override
const std::string & name() const
Returns the name.
std::vector< G4LogicalVolume * > touch_
~PrintGeomSummary() override=default
PrintGeomSummary(edm::ParameterSet const &p)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Graph::const_adj_iterator adjl_iterator
edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddcompToken_
std::vector< std::string > nodeNames_
void fillLV(G4LogicalVolume *lv)
DDSolidShape shape(void) const
The type of the solid.
std::vector< G4VSolid * > sls_
void dumpSummary(std::ostream &out, std::string name)
std::vector< G4VPhysicalVolume * > pvs_
std::vector< G4LogicalVolume * > lvs_
adj_list::const_iterator const_adj_iterator
const Graph & graph() const
Provides read-only access to the data structure of the compact-view.
std::map< std::string, DDSolidShape > solidMap_
std::map< DDSolidShape, std::pair< int, int > > kount_