6 #include "G4VPhysicalVolume.hh" 7 #include "G4LogicalVolume.hh" 8 #include "G4TransportationManager.hh" 13 using namespace CLHEP;
17 nchar =
name.find(
"*");
19 std::cout <<
"PrintSensitive:: Print position of all Sensitive Touchables: " 20 <<
" for names (0-" << nchar <<
") = " <<
name <<
"\n";
27 G4VPhysicalVolume * theTopPV = getTopPV();
32 bool printIt, std::ostream &
out) {
34 if (leafDepth == 0) fHistory.SetFirstEntry(pv);
35 else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
37 G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().
38 TransformPoint(G4ThreeVector(0,0,0));
39 G4LogicalVolume * lv = pv->GetLogicalVolume();
42 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
44 lvname.assign(lvname,0,nchar);
45 if (lvname ==
name) printIt =
true;
47 if (lv->GetSensitiveDetector() && printIt) {
48 out << leafDepth <<
" ### VOLUME = " << lv->GetName()
49 <<
" Copy No " << pv->GetCopyNo() <<
" in " << mother
50 <<
" global position of centre " << globalpoint <<
" (r=" 51 << globalpoint.perp() <<
", phi=" << globalpoint.phi()/deg
55 int NoDaughters = lv->GetNoDaughters();
56 while ((NoDaughters--)>0) {
57 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
58 if (!pvD->IsReplicated()) dumpTouch(pvD, leafDepth+1, printIt, out);
61 if (leafDepth > 0) fHistory.BackLevel();
65 return G4TransportationManager::GetTransportationManager()
66 ->GetNavigatorForTracking()->GetWorldVolume();
T getUntrackedParameter(std::string const &, T const &) const
PrintSensitive(edm::ParameterSet const &p)
void update(const BeginOfRun *run) override
This routine will be called when the appropriate signal arrives.
G4VPhysicalVolume * getTopPV()
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, std::ostream &out=std::cout)
~PrintSensitive() override