11 #include "G4LogicalVolumeStore.hh" 12 #include "G4LogicalVolume.hh" 13 #include "G4VSolid.hh" 14 #include "G4Material.hh" 15 #include "G4NavigationHistory.hh" 16 #include "G4PhysicalVolumeStore.hh" 17 #include "G4Region.hh" 18 #include "G4RegionStore.hh" 21 #include "G4TransportationManager.hh" 22 #include "G4UserLimits.hh" 23 #include "G4VisAttributes.hh" 24 #include "G4VPhysicalVolume.hh" 46 void getTouch(G4VPhysicalVolume *
pv,
unsigned int leafDepth,
unsigned int copym, std::vector<std::string> &touches);
57 dd4hep_ =
p.getUntrackedParameter<
bool>(
"dd4hep",
false);
58 verbosity_ =
p.getUntrackedParameter<
bool>(
"verbosity",
false);
59 G4cout <<
"PrintG4Touch:: initialised for dd4hep " <<
dd4hep_ <<
" with verbosity levels:" <<
verbosity_ << G4endl;
68 std::vector<std::string> touches;
70 std::sort(touches.begin(), touches.end());
71 for (
const auto &touch : touches)
81 out <<
" @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
83 out <<
" No volume created " << G4endl;
86 out <<
" @@@ Geometry built inside world volume: " 89 const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
90 std::vector<G4LogicalVolume *>::const_iterator lvcite;
91 std::set<G4VSolid *> theSolids;
92 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
93 theSolids.insert((*lvcite)->GetSolid());
94 out <<
" Number of G4VSolid's: " << theSolids.size() << G4endl;
95 out <<
" Number of G4LogicalVolume's: " << lvs->size() << G4endl;
96 const G4PhysicalVolumeStore *
pvs = G4PhysicalVolumeStore::GetInstance();
97 out <<
" Number of G4VPhysicalVolume's: " <<
pvs->size() << G4endl;
99 const G4MaterialTable *matTab = G4Material::GetMaterialTable();
100 out <<
" Number of G4Material's: " << matTab->size() << G4endl;
101 const G4RegionStore *regs = G4RegionStore::GetInstance();
102 out <<
" Number of G4Region's: " << regs->size() << G4endl;
113 int siz = lv->GetNoDaughters();
114 for (
int ii = 0;
ii < siz;
ii++)
124 G4LogicalVolume *lv =
pv->GetLogicalVolume();
126 G4ThreeVector globalpoint =
fHistory_.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
129 static_cast<std::string>(
pv->GetMotherLogical()->GetSolid()->GetName()),
dd4hep_))
132 out << leafDepth <<
"### VOLUME = " << lvname <<
" Copy No " <<
pv->GetCopyNo() <<
" in " << mother
133 <<
" global position of centre " << globalpoint <<
" (r = " << globalpoint.perp()
136 int NoDaughters = lv->GetNoDaughters();
137 while ((NoDaughters--) > 0) {
138 G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
139 if (!pvD->IsReplicated())
148 unsigned int leafDepth,
150 std::vector<std::string> &touches) {
158 static_cast<std::string>(
pv->GetMotherLogical()->GetSolid()->GetName()),
dd4hep_))
161 G4LogicalVolume *lv =
pv->GetLogicalVolume();
163 unsigned int copy =
static_cast<unsigned int>(
pv->GetCopyNo());
168 touches.emplace_back(
name);
170 int NoDaughters = lv->GetNoDaughters();
171 while ((NoDaughters--) > 0) {
172 G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
173 if (!pvD->IsReplicated())
182 return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
G4VPhysicalVolume * theTopPV_
#define DEFINE_SIMWATCHER(type)
G4LogicalVolume * getTopLV()
void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector< std::string > &touches)
void add1touchable(G4LogicalVolume *lv, int &nTouch)
std::string_view namePV(const std::string &name, bool dd4hep)
constexpr NumType convertRadToDeg(NumType radians)
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=G4cout)
static std::string to_string(const XMLCh *ch)
~PrintG4Touch() override=default
void update(const BeginOfRun *run) override
This routine will be called when the appropriate signal arrives.
void dumpSummary(std::ostream &out=G4cout)
G4VPhysicalVolume * getTopPV()
G4NavigationHistory fHistory_
std::string nameSolid(const std::string &name, bool dd4hep)
PrintG4Touch(edm::ParameterSet const &p)