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
CheckOverlap Class Reference

#include <CheckOverlap.h>

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

Public Member Functions

 CheckOverlap (edm::ParameterSet const &p)
 
 ~CheckOverlap ()
 
- 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 checkHierarchyLeafPVLV (G4LogicalVolume *lv, unsigned int leafDepth)
 
void checkPV (G4VPhysicalVolume *pv, unsigned int leafDepth)
 
void dumpLV (G4LogicalVolume *lv, std::string str)
 
G4VPhysicalVolume * getTopPV ()
 
void update (const BeginOfRun *run)
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

std::vector< std::string > nodeNames
 
int nPoints
 
std::vector< G4LogicalVolume * > topLV
 

Additional Inherited Members

Detailed Description

Definition at line 18 of file CheckOverlap.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file CheckOverlap.cc.

References edm::ParameterSet::getUntrackedParameter(), cuy::ii, nodeNames, and nPoints.

20  : topLV(0) {
21  std::vector<std::string> defNames;
22  nodeNames = p.getUntrackedParameter<std::vector<std::string> >("NodeNames", defNames);
23  nPoints = p.getUntrackedParameter<int>("Resolution", 1000);
24  G4cout << "CheckOverlap:: initialised with "
25  << nodeNames.size() << " Node Names and Resolution "
26  << nPoints << " the names are:" << G4endl;
27  for (unsigned int ii=0; ii<nodeNames.size(); ii++)
28  G4cout << "CheckOverlap:: Node[" << ii << "] : " << nodeNames[ii] << G4endl;
29 }
int ii
Definition: cuy.py:588
std::vector< G4LogicalVolume * > topLV
Definition: CheckOverlap.h:38
std::vector< std::string > nodeNames
Definition: CheckOverlap.h:36
CheckOverlap::~CheckOverlap ( )

Definition at line 31 of file CheckOverlap.cc.

31 {}

Member Function Documentation

void CheckOverlap::checkHierarchyLeafPVLV ( G4LogicalVolume *  lv,
unsigned int  leafDepth 
)
private

Definition at line 66 of file CheckOverlap.cc.

References checkPV().

Referenced by update().

67  {
68 
69  //----- Get LV daughters from list of PV daughters
70  mmlvpv lvpvDaughters;
71  std::set< G4LogicalVolume * > lvDaughters;
72  int NoDaughters = lv->GetNoDaughters();
73  while ((NoDaughters--)>0) {
74  G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
75  lvpvDaughters.insert(mmlvpv::value_type(pvD->GetLogicalVolume(), pvD));
76  lvDaughters.insert(pvD->GetLogicalVolume());
77  }
78 
79  std::set< G4LogicalVolume * >::const_iterator scite;
80  mmlvpv::const_iterator mmcite;
81 
82  //----- Check daughters of LV
83  for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
84  std::pair< mmlvpv::iterator, mmlvpv::iterator > mmER = lvpvDaughters.equal_range(*scite);
85  //----- Check daughters PV of this LV
86  for (mmcite = mmER.first ; mmcite != mmER.second; mmcite++)
87  checkPV((*mmcite).second, leafDepth+1);
88  //----- Check daughters LV
89  checkHierarchyLeafPVLV(*scite, leafDepth+1);
90  }
91 }
void checkPV(G4VPhysicalVolume *pv, unsigned int leafDepth)
Definition: CheckOverlap.cc:93
void checkHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth)
Definition: CheckOverlap.cc:66
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
void CheckOverlap::checkPV ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth 
)
private

Definition at line 93 of file CheckOverlap.cc.

References dumpLV(), nPoints, convertSQLiteXML::ok, MetAnalyzer::pv(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by checkHierarchyLeafPVLV().

93  {
94 
95  //----- PV info
96 #ifndef G4V7
97  std::string mother = "DDDWorld";
98  if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
99  if (!pv->IsReplicated()) {
100  G4PVPlacement* pvplace = dynamic_cast<G4PVPlacement* >(pv);
101  G4bool ok = pvplace->CheckOverlaps(nPoints);
102  G4cout << "Placed PV " << pvplace->GetName()
103  << " Number " << pvplace->GetCopyNo()
104  << " in mother " << mother << " at depth "
105  << leafDepth << " Status " << ok << G4endl;
106  if (ok) {
107  if(pv->GetRotation() == 0) {
108  G4cout << "Translation " << pv->GetTranslation()
109  << " and with no rotation" << G4endl;
110  } else {
111  G4cout << "Translation " << pv->GetTranslation()
112  << " and with rotation "<< *(pv->GetRotation()) << G4endl;
113  }
114  G4LogicalVolume* lv = pv->GetLogicalVolume();
115  dumpLV(lv, "Self");
116  if (pv->GetMotherLogical()) {
117  lv = pv->GetMotherLogical();
118  dumpLV (lv, "Mother");
119  }
120  }
121  } else {
122  if (pv->GetParameterisation() != 0) {
123  G4PVParameterised* pvparam = dynamic_cast<G4PVParameterised* >(pv);
124  G4bool ok = pvparam->CheckOverlaps(nPoints);
125  G4cout << "Parametrized PV " << pvparam->GetName()
126  << " in mother " << mother << " at depth "
127  << leafDepth << " Status " << ok << G4endl;
128  }
129  }
130 #endif
131 }
void dumpLV(G4LogicalVolume *lv, std::string str)
void CheckOverlap::dumpLV ( G4LogicalVolume *  lv,
std::string  str 
)
private

Definition at line 138 of file CheckOverlap.cc.

Referenced by checkPV().

138  {
139  G4cout << "Dump of " << str << " Logical Volume "
140  << lv->GetName() << " Solid: "
141  << lv->GetSolid()->GetName() << " Material: "
142  << lv->GetMaterial()->GetName() << G4endl;
143  G4cout << *(lv->GetSolid()) << G4endl;
144 }
G4VPhysicalVolume * CheckOverlap::getTopPV ( )
private

Definition at line 133 of file CheckOverlap.cc.

Referenced by update().

133  {
134  return G4TransportationManager::GetTransportationManager()
135  ->GetNavigatorForTracking()->GetWorldVolume();
136 }
void CheckOverlap::update ( const BeginOfRun )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 33 of file CheckOverlap.cc.

References checkHierarchyLeafPVLV(), getTopPV(), i, cuy::ii, nodeNames, and topLV.

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

33  {
34 
35  if (nodeNames.size() > 0) {
36  const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
37  G4cout << "CheckOverlap::update nLV= " << lvs->size() << G4endl;
38  std::vector<G4LogicalVolume *>::const_iterator lvcite;
39  int i = 0;
40  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
41  for (unsigned int ii=0; ii<nodeNames.size(); ii++) {
42  if ((*lvcite)->GetName() == (G4String)(nodeNames[ii])) {
43  topLV.push_back((*lvcite));
44  break;
45  }
46  }
47  G4cout << "Name of node " << (++i) << " : "
48  << (*lvcite)->GetName() << G4endl;
49  if (topLV.size() == nodeNames.size()) break;
50  }
51  } else {
52  G4VPhysicalVolume * theTopPV = getTopPV();
53  topLV.push_back(theTopPV->GetLogicalVolume());
54  }
55 
56  if (topLV.size() == 0) {
57  G4cout << "No Top LV Found" << G4endl;
58  } else {
59  for (unsigned int ii=0; ii<topLV.size(); ++ii) {
60  G4cout << "Top LV Name " << topLV[ii]->GetName() << G4endl;
62  }
63  }
64 }
int i
Definition: DBlmapReader.cc:9
void checkHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth)
Definition: CheckOverlap.cc:66
int ii
Definition: cuy.py:588
std::vector< G4LogicalVolume * > topLV
Definition: CheckOverlap.h:38
std::vector< std::string > nodeNames
Definition: CheckOverlap.h:36
G4VPhysicalVolume * getTopPV()

Member Data Documentation

std::vector<std::string> CheckOverlap::nodeNames
private

Definition at line 36 of file CheckOverlap.h.

Referenced by CheckOverlap(), and update().

int CheckOverlap::nPoints
private

Definition at line 37 of file CheckOverlap.h.

Referenced by CheckOverlap(), and checkPV().

std::vector<G4LogicalVolume*> CheckOverlap::topLV
private

Definition at line 38 of file CheckOverlap.h.

Referenced by update().