11 #include "G4ExtrudedSolid.hh" 12 #include "G4Polycone.hh" 13 #include "G4Polyhedra.hh" 17 #include "G4LogicalVolumeStore.hh" 18 #include "G4LogicalVolume.hh" 19 #include "G4VSolid.hh" 20 #include "G4NavigationHistory.hh" 21 #include "G4PhysicalVolumeStore.hh" 22 #include "G4TransportationManager.hh" 23 #include "G4VPhysicalVolume.hh" 49 const std::vector<std::string>
types_;
54 : dd4hep_(
p.getUntrackedParameter<
bool>(
"dd4hep")),
57 G4cout <<
"PrintG4Solids:: initialised for printing information about G4VSolids for version dd4heP:" <<
dd4hep_ 70 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
72 out <<
" No volume created " << G4endl;
75 out <<
" @@@ Geometry built inside world volume: " <<
theTopPV_->GetName() << G4endl;
77 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
78 std::vector<G4LogicalVolume *>::const_iterator lvcite;
79 std::set<G4VSolid *> theSolids;
80 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
81 G4VSolid *solid = (*lvcite)->GetSolid();
87 theSolids.insert(solid);
89 out <<
" Number of G4VSolid's: " << theSolids.size() << G4endl;
90 std::set<G4VSolid *>::const_iterator solid;
91 for (solid = theSolids.begin(); solid != theSolids.end(); solid++) {
92 G4String
type = (*solid)->GetEntityType();
96 out <<
name <<
":" <<
type <<
" Volume " << (*solid)->GetCubicVolume();
97 if (
type ==
"G4Box") {
98 const G4Box *box =
static_cast<const G4Box *
>(*solid);
99 out <<
" dx:dy:dz " << box->GetXHalfLength() <<
":" << box->GetYHalfLength() <<
":" << box->GetZHalfLength();
100 }
else if (
type ==
"G4Tubs") {
101 const G4Tubs *tube =
static_cast<const G4Tubs *
>(*solid);
102 out <<
" rin:rout:dz:phistart:dphi " << tube->GetInnerRadius() <<
":" << tube->GetOuterRadius() <<
":" 103 << tube->GetZHalfLength() <<
":" <<
convertRadToDeg(tube->GetStartPhiAngle()) <<
":" 105 }
else if (
type ==
"G4Cons") {
106 const G4Cons *
cone =
static_cast<const G4Cons *
>(*solid);
107 out <<
" rinminus:routminus:rinplus:routplus:dz:phistart:dphi " <<
cone->GetInnerRadiusMinusZ() <<
":" 108 <<
cone->GetOuterRadiusMinusZ() <<
":" <<
cone->GetInnerRadiusPlusZ() <<
":" <<
cone->GetOuterRadiusPlusZ()
111 }
else if (
type ==
"G4Trap") {
112 const G4Trap *trap =
static_cast<const G4Trap *
>(*solid);
113 out <<
" zhalf:yl1:xl11:xl12:tana1:yl2:xl21:xl22:tana2 " << trap->GetZHalfLength() <<
":" 114 << trap->GetYHalfLength1() <<
":" << trap->GetXHalfLength1() <<
":" << trap->GetXHalfLength2() <<
":" 115 << trap->GetTanAlpha1() <<
":" << trap->GetYHalfLength2() <<
":" << trap->GetXHalfLength3() <<
":" 116 << trap->GetXHalfLength4() <<
":" << trap->GetTanAlpha2();
117 }
else if (
type ==
"G4Trd") {
118 const G4Trd *trd =
static_cast<const G4Trd *
>(*solid);
119 out <<
" xl1:xl2:yl1:yl2:zhalf " << trd->GetXHalfLength1() <<
":" << trd->GetXHalfLength2() <<
":" 120 << trd->GetYHalfLength1() <<
":" << trd->GetYHalfLength2() <<
":" << trd->GetZHalfLength();
121 }
else if (
type ==
"G4Polycone") {
122 const G4Polycone *
cone =
static_cast<const G4Polycone *
>(*solid);
123 const auto hist =
cone->GetOriginalParameters();
126 <<
num <<
" planes:";
127 for (
int k = 0;
k <
num; ++
k)
128 out <<
" [" <<
k <<
"] " <<
hist->Z_values[
k] <<
":" <<
hist->Rmin[
k] <<
":" <<
hist->Rmax[
k];
129 }
else if (
type ==
"G4Polyhedra") {
130 const G4Polyhedra *pgon =
static_cast<const G4Polyhedra *
>(*solid);
131 const auto hist = pgon->GetOriginalParameters();
134 <<
hist->numSide <<
" sides and " <<
num <<
" planes:";
135 for (
int k = 0;
k <
num; ++
k)
136 out <<
" [" <<
k <<
"] " <<
hist->Z_values[
k] <<
":" <<
hist->Rmin[
k] <<
":" <<
hist->Rmax[
k];
137 }
else if (
type ==
"G4ExtrudedSolid") {
138 const G4ExtrudedSolid *pgon =
static_cast<const G4ExtrudedSolid *
>(*solid);
139 int vert = pgon->GetNofVertices();
140 int numz = pgon->GetNofZSections();
141 out <<
" " << vert <<
" vertices:";
142 for (
int k = 0;
k < vert; ++
k)
143 out <<
" [" <<
k <<
"] " << pgon->GetVertex(
k);
144 out <<
"; and " << numz <<
" z-sections:";
145 for (
int k = 0;
k < numz; ++
k) {
146 const auto &zsec = pgon->GetZSection(
k);
147 out <<
" [" <<
k <<
"] " << zsec.fZ <<
":" << zsec.fScale <<
":" << zsec.fOffset;
155 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
160 uint32_t
first = ((
name.find(
':') == std::string::npos) ? 0 : (
name.find(
':') + 1));
164 if (
name.find(
'_', loc) == std::string::npos)
166 if (((loc + 5) <
name.size()) && (
name.substr(loc, 5) ==
"shape")) {
170 loc =
name.find(
'_', loc) + 1;
171 if (loc >
name.size())
#define DEFINE_SIMWATCHER(type)
void dumpSummary(std::ostream &out=G4cout)
const std::vector< std::string > types_
std::string reducedName(const std::string &name)
constexpr NumType convertRadToDeg(NumType radians)
G4VPhysicalVolume * theTopPV_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
~PrintG4Solids() override=default
bool select(const std::string &name, const std::string &shape) const
PrintG4Solids(edm::ParameterSet const &p)
const std::vector< std::string > solids_
void update(const BeginOfRun *run) override
This routine will be called when the appropriate signal arrives.
G4VPhysicalVolume * getTopPV()