CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrintSensitive Class Reference

#include <PrintSensitive.h>

Inheritance diagram for PrintSensitive:
SimWatcher Observer< const BeginOfRun * >

Public Member Functions

 PrintSensitive (edm::ParameterSet const &p)
 
 ~PrintSensitive ()
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun *iT)
 
virtual ~Observer ()
 

Private Member Functions

void dumpTouch (G4VPhysicalVolume *pv, unsigned int 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. More...
 

Private Attributes

G4NavigationHistory fHistory
 
std::string name
 
int nchar
 

Additional Inherited Members

Detailed Description

Definition at line 16 of file PrintSensitive.h.

Constructor & Destructor Documentation

PrintSensitive::PrintSensitive ( edm::ParameterSet const &  p)

Definition at line 14 of file PrintSensitive.cc.

References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), name, and nchar.

14  {
15  name = p.getUntrackedParameter<std::string>("Name","*");
16  nchar = name.find("*");
17  name.assign(name,0,nchar);
18  std::cout << "PrintSensitive:: Print position of all Sensitive Touchables: "
19  << " for names (0-" << nchar << ") = " << name << "\n";
20 }
std::string name
tuple cout
Definition: gather_cfg.py:41
PrintSensitive::~PrintSensitive ( )

Definition at line 22 of file PrintSensitive.cc.

22 {}

Member Function Documentation

void PrintSensitive::dumpTouch ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth,
bool  printIt,
std::ostream &  out = std::cout 
)
private

Definition at line 30 of file PrintSensitive.cc.

References fHistory, name, and nchar.

Referenced by update().

31  {
32 
33  if (leafDepth == 0) fHistory.SetFirstEntry(pv);
34  else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
35 
36  G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().
37  TransformPoint(G4ThreeVector(0,0,0));
38  G4LogicalVolume * lv = pv->GetLogicalVolume();
39 
40  std::string mother = "World";
41  if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
42  std::string lvname = lv->GetName();
43  lvname.assign(lvname,0,nchar);
44  if (lvname == name) printIt = true;
45 
46  if (lv->GetSensitiveDetector() && printIt) {
47  out << leafDepth << " ### VOLUME = " << lv->GetName()
48  << " Copy No " << pv->GetCopyNo() << " in " << mother
49  << " global position of centre " << globalpoint << " (r="
50  << globalpoint.perp() << ", phi=" << globalpoint.phi()/deg
51  << ")\n";
52  }
53 
54  int NoDaughters = lv->GetNoDaughters();
55  while ((NoDaughters--)>0) {
56  G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
57  if (!pvD->IsReplicated()) dumpTouch(pvD, leafDepth+1, printIt, out);
58  }
59 
60  if (leafDepth > 0) fHistory.BackLevel();
61 }
std::string name
G4NavigationHistory fHistory
tuple out
Definition: dbtoconf.py:99
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, std::ostream &out=std::cout)
G4VPhysicalVolume * PrintSensitive::getTopPV ( )
private

Definition at line 63 of file PrintSensitive.cc.

Referenced by update().

63  {
64  return G4TransportationManager::GetTransportationManager()
65  ->GetNavigatorForTracking()->GetWorldVolume();
66 }
void PrintSensitive::update ( const BeginOfRun )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 24 of file PrintSensitive.cc.

References gather_cfg::cout, dumpTouch(), and getTopPV().

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

24  {
25 
26  G4VPhysicalVolume * theTopPV = getTopPV();
27  dumpTouch(theTopPV, 0, false, std::cout);
28 }
G4VPhysicalVolume * getTopPV()
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, std::ostream &out=std::cout)
tuple cout
Definition: gather_cfg.py:41

Member Data Documentation

G4NavigationHistory PrintSensitive::fHistory
private

Definition at line 34 of file PrintSensitive.h.

Referenced by dumpTouch().

std::string PrintSensitive::name
private
int PrintSensitive::nchar
private

Definition at line 33 of file PrintSensitive.h.

Referenced by dumpTouch(), and PrintSensitive().