#include <SimG4Core/PrintGeomInfo/interface/PrintSensitive.h>
Public Member Functions | |
PrintSensitive (edm::ParameterSet const &p) | |
~PrintSensitive () | |
Private Member Functions | |
void | dumpTouch (G4VPhysicalVolume *pv, uint leafDepth, bool printIt, std::ostream &out=std::cout) |
G4VPhysicalVolume * | getTopPV () |
void | update (const BeginOfRun *run) |
This routine will be called when the appropriate signal arrives. | |
Private Attributes | |
G4NavigationHistory | fHistory |
std::string | name |
int | nchar |
Definition at line 16 of file PrintSensitive.h.
PrintSensitive::PrintSensitive | ( | edm::ParameterSet const & | p | ) |
Definition at line 14 of file PrintSensitive.cc.
References GenMuonPlsPt100GeV_cfg::cout, edm::ParameterSet::getUntrackedParameter(), name, and nchar.
00014 { 00015 name = p.getUntrackedParameter<std::string>("Name","*"); 00016 nchar = name.find("*"); 00017 name.assign(name,0,nchar); 00018 std::cout << "PrintSensitive:: Print position of all Sensitive Touchables: " 00019 << " for names (0-" << nchar << ") = " << name << "\n"; 00020 }
PrintSensitive::~PrintSensitive | ( | ) |
void PrintSensitive::dumpTouch | ( | G4VPhysicalVolume * | pv, | |
uint | leafDepth, | |||
bool | printIt, | |||
std::ostream & | out = std::cout | |||
) | [private] |
Definition at line 30 of file PrintSensitive.cc.
References fHistory, lv, name, nchar, and PV3DBase< T, PVType, FrameType >::perp().
Referenced by update().
00031 { 00032 00033 if (leafDepth == 0) fHistory.SetFirstEntry(pv); 00034 else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo()); 00035 00036 G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse(). 00037 TransformPoint(G4ThreeVector(0,0,0)); 00038 G4LogicalVolume * lv = pv->GetLogicalVolume(); 00039 00040 std::string mother = "World"; 00041 if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName(); 00042 std::string lvname = lv->GetName(); 00043 lvname.assign(lvname,0,nchar); 00044 if (lvname == name) printIt = true; 00045 00046 if (lv->GetSensitiveDetector() && printIt) { 00047 out << leafDepth << " ### VOLUME = " << lv->GetName() 00048 << " Copy No " << pv->GetCopyNo() << " in " << mother 00049 << " global position of centre " << globalpoint << " (r=" 00050 << globalpoint.perp() << ", phi=" << globalpoint.phi()/deg 00051 << ")\n"; 00052 } 00053 00054 int NoDaughters = lv->GetNoDaughters(); 00055 while ((NoDaughters--)>0) { 00056 G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters); 00057 if (!pvD->IsReplicated()) dumpTouch(pvD, leafDepth+1, printIt, out); 00058 } 00059 00060 if (leafDepth > 0) fHistory.BackLevel(); 00061 }
G4VPhysicalVolume * PrintSensitive::getTopPV | ( | ) | [private] |
Definition at line 63 of file PrintSensitive.cc.
Referenced by update().
00063 { 00064 return G4TransportationManager::GetTransportationManager() 00065 ->GetNavigatorForTracking()->GetWorldVolume(); 00066 }
void PrintSensitive::update | ( | const BeginOfRun * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfRun * >.
Definition at line 24 of file PrintSensitive.cc.
References GenMuonPlsPt100GeV_cfg::cout, dumpTouch(), and getTopPV().
00024 { 00025 00026 G4VPhysicalVolume * theTopPV = getTopPV(); 00027 dumpTouch(theTopPV, 0, false, std::cout); 00028 }
G4NavigationHistory PrintSensitive::fHistory [private] |
std::string PrintSensitive::name [private] |
int PrintSensitive::nchar [private] |