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