CMS 3D CMS Logo

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 () override
 
- Public Member Functions inherited from SimWatcher
const SimWatcheroperator= (const SimWatcher &)=delete
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
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) override
 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::CheckOverlap ( edm::ParameterSet const &  p)

Definition at line 20 of file CheckOverlap.cc.

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 " << nodeNames.size() << " Node Names and Resolution " << nPoints
25  << " the names are:" << G4endl;
26  for (unsigned int ii = 0; ii < nodeNames.size(); ii++)
27  G4cout << "CheckOverlap:: Node[" << ii << "] : " << nodeNames[ii] << G4endl;
28 }

References ecalTB2006H4_GenSimDigiReco_cfg::G4cout, cuy::ii, nodeNames, nPoints, and AlCaHLTBitMon_ParallelJobs::p.

◆ ~CheckOverlap()

CheckOverlap::~CheckOverlap ( )
override

Definition at line 30 of file CheckOverlap.cc.

30 {}

Member Function Documentation

◆ checkHierarchyLeafPVLV()

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

Definition at line 64 of file CheckOverlap.cc.

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

References checkPV().

Referenced by update().

◆ checkPV()

void CheckOverlap::checkPV ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth 
)
private

Definition at line 89 of file CheckOverlap.cc.

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

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

Referenced by checkHierarchyLeafPVLV().

◆ dumpLV()

void CheckOverlap::dumpLV ( G4LogicalVolume *  lv,
std::string  str 
)
private

Definition at line 128 of file CheckOverlap.cc.

128  {
129  G4cout << "Dump of " << str << " Logical Volume " << lv->GetName() << " Solid: " << lv->GetSolid()->GetName()
130  << " Material: " << lv->GetMaterial()->GetName() << G4endl;
131  G4cout << *(lv->GetSolid()) << G4endl;
132 }

References ecalTB2006H4_GenSimDigiReco_cfg::G4cout, and str.

Referenced by checkPV().

◆ getTopPV()

G4VPhysicalVolume * CheckOverlap::getTopPV ( )
private

Definition at line 124 of file CheckOverlap.cc.

124  {
125  return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
126 }

Referenced by update().

◆ update()

void CheckOverlap::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 32 of file CheckOverlap.cc.

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

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

Referenced by MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ nodeNames

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

Definition at line 31 of file CheckOverlap.h.

Referenced by CheckOverlap(), and update().

◆ nPoints

int CheckOverlap::nPoints
private

Definition at line 32 of file CheckOverlap.h.

Referenced by CheckOverlap(), and checkPV().

◆ topLV

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

Definition at line 33 of file CheckOverlap.h.

Referenced by update().

mps_fire.i
i
Definition: mps_fire.py:428
mmlvpv
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
Definition: PrintGeomInfoAction.h:19
CheckOverlap::nPoints
int nPoints
Definition: CheckOverlap.h:32
CheckOverlap::getTopPV
G4VPhysicalVolume * getTopPV()
Definition: CheckOverlap.cc:124
CheckOverlap::topLV
std::vector< G4LogicalVolume * > topLV
Definition: CheckOverlap.h:33
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
str
#define str(s)
Definition: TestProcessor.cc:53
CheckOverlap::checkPV
void checkPV(G4VPhysicalVolume *pv, unsigned int leafDepth)
Definition: CheckOverlap.cc:89
CheckOverlap::dumpLV
void dumpLV(G4LogicalVolume *lv, std::string str)
Definition: CheckOverlap.cc:128
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CheckOverlap::nodeNames
std::vector< std::string > nodeNames
Definition: CheckOverlap.h:31
CheckOverlap::checkHierarchyLeafPVLV
void checkHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth)
Definition: CheckOverlap.cc:64
ecalTB2006H4_GenSimDigiReco_cfg.G4cout
G4cout
Definition: ecalTB2006H4_GenSimDigiReco_cfg.py:285
cuy.ii
ii
Definition: cuy.py:589