CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrintGeomInfoAction Class Reference
Inheritance diagram for PrintGeomInfoAction:
SimWatcher Observer< const BeginOfRun * >

Public Member Functions

void beginRun (edm::EventSetup const &) override
 
 PrintGeomInfoAction (edm::ParameterSet const &p)
 
void registerConsumes (edm::ConsumesCollector) override
 
 ~PrintGeomInfoAction () override=default
 
- Public Member Functions inherited from SimWatcher
bool isMT () const
 
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 add1touchable (G4LogicalVolume *lv, int &nTouch)
 
int countNoTouchables ()
 
void dumpG4LVLeaf (G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=G4cout)
 
void dumpG4LVList (std::ostream &out=G4cout)
 
void dumpG4LVTree (std::ostream &out=G4cout)
 
void dumpHierarchyLeafPVLV (G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=G4cout)
 
void dumpHierarchyTreePVLV (std::ostream &out=G4cout)
 
void dumpInFile ()
 
void dumpLV (G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=G4cout)
 
void dumpMaterialList (std::ostream &out=G4cout)
 
void dumpPV (G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=G4cout)
 
void dumpSolid (G4VSolid *sol, unsigned int leafDepth, std::ostream &out=G4cout)
 
void dumpSummary (std::ostream &out=G4cout)
 
void dumpTouch (G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=G4cout)
 
G4LogicalVolume * getTopLV ()
 
G4VPhysicalVolume * getTopPV ()
 
void getTouch (G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector< std::string > &touches)
 
std::string spacesFromLeafDepth (unsigned int leafDepth)
 
void update (const BeginOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

bool dd4hep_
 
edm::ESGetToken
< cms::DDCompactView,
IdealGeometryRecord
dd4hepToken_
 
edm::ESGetToken< DDCompactView,
IdealGeometryRecord
dddToken_
 
bool dumpAtts_
 
bool dumpLV_
 
bool dumpLVList_
 
bool dumpLVTree_
 
bool dumpMaterial_
 
bool dumpPV_
 
bool dumpReplica_
 
bool dumpRotation_
 
bool dumpSense_
 
bool dumpSolid_
 
bool dumpSummary_
 
bool dumpTouch_
 
G4NavigationHistory fHistory_
 
bool fileDetail_
 
std::string fileLV_
 
std::string fileMat_
 
std::string filePV_
 
std::string fileSolid_
 
std::string fileTouch_
 
std::string name_
 
std::vector< std::string > names_
 
int nchar_
 
G4VPhysicalVolume * theTopPV_
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

Definition at line 45 of file PrintGeomInfoAction.cc.

Constructor & Destructor Documentation

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

Definition at line 91 of file PrintGeomInfoAction.cc.

References dd4hep_, dumpAtts_, dumpLV_, dumpLVList_, dumpLVTree_, dumpMaterial_, dumpPV_, dumpReplica_, dumpRotation_, dumpSense_, dumpSolid_, dumpSummary_, dumpTouch_, fileDetail_, fileLV_, fileMat_, filePV_, fileSolid_, fileTouch_, edm::ParameterSet::getUntrackedParameter(), mps_fire::i, name_, names_, nchar_, and AlCaHLTBitMon_QueryRunRegistry::string.

91  {
92  dumpSummary_ = p.getUntrackedParameter<bool>("DumpSummary", true);
93  dumpLVTree_ = p.getUntrackedParameter<bool>("DumpLVTree", true);
94  dumpLVList_ = p.getUntrackedParameter<bool>("DumpLVList", false);
95  dumpMaterial_ = p.getUntrackedParameter<bool>("DumpMaterial", false);
96  dumpLV_ = p.getUntrackedParameter<bool>("DumpLV", false);
97  dumpSolid_ = p.getUntrackedParameter<bool>("DumpSolid", false);
98  dumpAtts_ = p.getUntrackedParameter<bool>("DumpAttributes", false);
99  dumpPV_ = p.getUntrackedParameter<bool>("DumpPV", false);
100  dumpRotation_ = p.getUntrackedParameter<bool>("DumpRotation", false);
101  dumpReplica_ = p.getUntrackedParameter<bool>("DumpReplica", false);
102  dumpTouch_ = p.getUntrackedParameter<bool>("DumpTouch", false);
103  dumpSense_ = p.getUntrackedParameter<bool>("DumpSense", false);
104  dd4hep_ = p.getUntrackedParameter<bool>("DD4hep", false);
105  name_ = p.getUntrackedParameter<std::string>("Name", "*");
106  nchar_ = name_.find('*');
107  name_.assign(name_, 0, nchar_);
108  names_ = p.getUntrackedParameter<std::vector<std::string> >("Names");
109  fileMat_ = p.getUntrackedParameter<std::string>("MaterialFileName", "");
110  fileSolid_ = p.getUntrackedParameter<std::string>("SolidFileName", "");
111  fileLV_ = p.getUntrackedParameter<std::string>("LVFileName", "");
112  filePV_ = p.getUntrackedParameter<std::string>("PVFileName", "");
113  fileTouch_ = p.getUntrackedParameter<std::string>("TouchFileName", "");
114  fileDetail_ = p.getUntrackedParameter<bool>("FileDetail", false);
115  G4cout << "PrintGeomInfoAction:: initialised for dd4hep " << dd4hep_ << " with verbosity levels:"
116  << " Summary " << dumpSummary_ << " LVTree " << dumpLVTree_ << " LVList " << dumpLVList_ << " Material "
117  << dumpMaterial_ << G4endl << " "
118  << " LV " << dumpLV_ << " Solid " << dumpSolid_ << " Attribs " << dumpAtts_ << G4endl
119  << " "
120  << " PV " << dumpPV_ << " Rotation " << dumpRotation_ << " Replica " << dumpReplica_ << G4endl
121  << " "
122  << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_ << G4endl
123  << " "
124  << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" << fileLV_ << ":"
125  << filePV_ << ":" << fileTouch_ << " FileDetail " << fileDetail_ << G4endl
126  << " for " << names_.size() << " names:";
127  for (unsigned int i = 0; i < names_.size(); i++)
128  G4cout << " " << names_[i];
129  G4cout << G4endl;
130 }
std::vector< std::string > names_
PrintGeomInfoAction::~PrintGeomInfoAction ( )
overridedefault

Member Function Documentation

void PrintGeomInfoAction::add1touchable ( G4LogicalVolume *  lv,
int &  nTouch 
)
private

Definition at line 302 of file PrintGeomInfoAction.cc.

References cuy::ii.

Referenced by countNoTouchables().

302  {
303  int siz = lv->GetNoDaughters();
304  for (int ii = 0; ii < siz; ii++)
305  add1touchable(lv->GetDaughter(ii)->GetLogicalVolume(), ++nTouch);
306 }
void add1touchable(G4LogicalVolume *lv, int &nTouch)
int ii
Definition: cuy.py:589
void PrintGeomInfoAction::beginRun ( edm::EventSetup const &  es)
overridevirtual

Reimplemented from SimWatcher.

Definition at line 142 of file PrintGeomInfoAction.cc.

References angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), DDFilteredView::copyNumbers(), dd4hep_, dd4hepToken_, dddToken_, dumpSense_, alcazmumu_cfi::filter, DDFilteredView::firstChild(), cms::DDFilteredView::firstChild(), edm::EventSetup::getData(), mps_fire::i, isotrackApplyRegressor::k, log, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), cms::DDFilteredView::name(), names_, DDFilteredView::next(), sd, spacesFromLeafDepth(), AlCaHLTBitMon_QueryRunRegistry::string, DDFilteredView::translation(), and cms::DDFilteredView::translation().

142  {
143  if (dumpSense_) {
144  if (dd4hep_) {
145  const cms::DDCompactView *pDD = &es.getData(dd4hepToken_);
146 
147  G4cout << "PrintGeomInfoAction::Get Printout of Sensitive Volumes "
148  << "for " << names_.size() << " Readout Units" << G4endl;
149  for (unsigned int i = 0; i < names_.size(); i++) {
150  std::string sd = names_[i];
151  const cms::DDFilter filter("ReadOutName", sd);
152  cms::DDFilteredView fv(*pDD, filter);
153  G4cout << "PrintGeomInfoAction:: Get Filtered view for ReadOutName = " << sd << G4endl;
154  G4cout << "Lengths are in mm, angles in degrees" << G4endl;
155 
156  std::string spaces = spacesFromLeafDepth(1);
157 
158  while (fv.firstChild()) {
159  auto tran = fv.translation() / dd4hep::mm;
160  std::vector<int> copy = fv.copyNos();
161  auto lvname = fv.name();
162  unsigned int leafDepth = copy.size();
163  G4cout << leafDepth << spaces << "### VOLUME = " << lvname << " Copy No";
164  for (unsigned int k = 0; k < leafDepth; ++k)
165  G4cout << " " << copy[k];
166  G4cout << " Centre at " << tran << " (r = " << tran.Rho() << ", phi = " << convertRadToDeg(tran.phi()) << ")"
167  << G4endl;
168  }
169  }
170  } else {
171  const DDCompactView *pDD = &es.getData(dddToken_);
172 
173  G4cout << "PrintGeomInfoAction::Get Printout of Sensitive Volumes "
174  << "for " << names_.size() << " Readout Units" << G4endl;
175  for (unsigned int i = 0; i < names_.size(); i++) {
176  std::string attribute = "ReadOutName";
177  std::string sd = names_[i];
178  DDSpecificsMatchesValueFilter filter{DDValue(attribute, sd, 0)};
179  DDFilteredView fv(*pDD, filter);
180  G4cout << "PrintGeomInfoAction:: Get Filtered view for " << attribute << " = " << sd << G4endl;
181  G4cout << "Lengths are in mm, angles in degrees" << G4endl;
182  bool dodet = fv.firstChild();
183 
184  std::string spaces = spacesFromLeafDepth(1);
185 
186  while (dodet) {
187  const DDLogicalPart &log = fv.logicalPart();
188  std::string lvname = log.name().name();
189  DDTranslation tran = fv.translation();
190  std::vector<int> copy = fv.copyNumbers();
191 
192  unsigned int leafDepth = copy.size();
193  G4cout << leafDepth << spaces << "### VOLUME = " << lvname << " Copy No";
194  for (int k = leafDepth - 1; k >= 0; k--)
195  G4cout << " " << copy[k];
196  G4cout << " Centre at " << tran << " (r = " << tran.Rho() << ", phi = " << convertRadToDeg(tran.phi()) << ")"
197  << G4endl;
198  dodet = fv.next();
199  }
200  }
201  }
202  }
203 }
static std::vector< std::string > checklist log
const N & name() const
Definition: DDBase.h:59
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepToken_
std::vector< std::string > names_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::string spacesFromLeafDepth(unsigned int leafDepth)
double sd
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
edm::ESGetToken< DDCompactView, IdealGeometryRecord > dddToken_
int PrintGeomInfoAction::countNoTouchables ( )
private

Definition at line 295 of file PrintGeomInfoAction.cc.

References add1touchable(), and getTopLV().

Referenced by dumpSummary().

295  {
296  int nTouch = 0;
297  G4LogicalVolume *lv = getTopLV();
298  add1touchable(lv, nTouch);
299  return nTouch;
300 }
void add1touchable(G4LogicalVolume *lv, int &nTouch)
G4LogicalVolume * getTopLV()
void PrintGeomInfoAction::dumpG4LVLeaf ( G4LogicalVolume *  lv,
unsigned int  leafDepth,
unsigned int  count,
std::ostream &  out = G4cout 
)
private

Definition at line 273 of file PrintGeomInfoAction.cc.

References cuy::ii.

Referenced by dumpG4LVTree().

276  {
277  for (unsigned int ii = 0; ii < leafDepth; ii++)
278  out << " ";
279  out << " LV:(" << leafDepth << ") " << lv->GetName() << " (" << count << ")" << G4endl;
280  //--- If a volume is placed n types as daughter of this LV, it should only be counted once
281  std::map<G4LogicalVolume *, unsigned int> lvCount;
282  std::map<G4LogicalVolume *, unsigned int>::const_iterator cite;
283  int siz = lv->GetNoDaughters();
284  for (int ii = 0; ii < siz; ii++) {
285  cite = lvCount.find(lv->GetDaughter(ii)->GetLogicalVolume());
286  if (cite != lvCount.end())
287  lvCount[cite->first] = (cite->second) + 1;
288  else
289  lvCount.insert(std::pair<G4LogicalVolume *, unsigned int>(lv->GetDaughter(ii)->GetLogicalVolume(), 1));
290  }
291  for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
292  dumpG4LVLeaf((cite->first), leafDepth + 1, (cite->second), out);
293 }
void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=G4cout)
int ii
Definition: cuy.py:589
void PrintGeomInfoAction::dumpG4LVList ( std::ostream &  out = G4cout)
private

Definition at line 250 of file PrintGeomInfoAction.cc.

Referenced by update().

250  {
251  out << " @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << G4endl;
252  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
253  std::vector<G4LogicalVolume *>::const_iterator lvcite;
254  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
255  out << "LV:" << (*lvcite)->GetName() << "\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << G4endl;
256 }
void PrintGeomInfoAction::dumpG4LVTree ( std::ostream &  out = G4cout)
private

Definition at line 258 of file PrintGeomInfoAction.cc.

References dumpG4LVLeaf(), and getTopLV().

Referenced by update().

258  {
259  out << " @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl;
260  G4LogicalVolume *lv = getTopLV();
261  dumpG4LVLeaf(lv, 0, 1, out);
262 }
void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=G4cout)
G4LogicalVolume * getTopLV()
void PrintGeomInfoAction::dumpHierarchyLeafPVLV ( G4LogicalVolume *  lv,
unsigned int  leafDepth,
std::ostream &  out = G4cout 
)
private

Definition at line 326 of file PrintGeomInfoAction.cc.

References dumpLV(), and dumpPV().

Referenced by dumpHierarchyTreePVLV().

326  {
327  //----- Dump this LV
328  dumpLV(lv, leafDepth, out);
329 
330  //----- Get LV daughters from list of PV daughters
331  mmlvpv lvpvDaughters;
332  std::set<G4LogicalVolume *> lvDaughters;
333  int NoDaughters = lv->GetNoDaughters();
334  while ((NoDaughters--) > 0) {
335  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
336  lvpvDaughters.insert(mmlvpv::value_type(pvD->GetLogicalVolume(), pvD));
337  lvDaughters.insert(pvD->GetLogicalVolume());
338  }
339 
340  std::set<G4LogicalVolume *>::const_iterator scite;
341  mmlvpv::const_iterator mmcite;
342 
343  //----- Dump daughters PV and LV
344  for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
345  std::pair<mmlvpv::iterator, mmlvpv::iterator> mmER = lvpvDaughters.equal_range(*scite);
346  //----- Dump daughters PV of this LV
347  for (mmcite = mmER.first; mmcite != mmER.second; mmcite++)
348  dumpPV((*mmcite).second, leafDepth + 1, out);
349  //----- Dump daughters LV
350  dumpHierarchyLeafPVLV(*scite, leafDepth + 1, out);
351  }
352 }
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=G4cout)
void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=G4cout)
void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=G4cout)
void PrintGeomInfoAction::dumpHierarchyTreePVLV ( std::ostream &  out = G4cout)
private

Definition at line 308 of file PrintGeomInfoAction.cc.

References dumpHierarchyLeafPVLV(), dumpPV(), dumpTouch(), dumpTouch_, getTopLV(), and theTopPV_.

Referenced by update().

308  {
309  //dumps in the following order:
310  // 1) a LV with details
311  // 2) list of PVs daughters of this LV with details
312  // 3) list of LVs daughters of this LV and for each go to 1)
313 
314  //----- Get top PV
315  G4LogicalVolume *topLV = getTopLV();
316 
317  //----- Dump this leaf (it will recursively dump all the tree)
318  dumpHierarchyLeafPVLV(topLV, 0, out);
319  dumpPV(theTopPV_, 0, out);
320 
321  //----- Dump the touchables (it will recursively dump all the tree)
322  if (dumpTouch_)
323  dumpTouch(theTopPV_, 0, out);
324 }
G4VPhysicalVolume * theTopPV_
void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=G4cout)
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=G4cout)
G4LogicalVolume * getTopLV()
void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=G4cout)
void PrintGeomInfoAction::dumpInFile ( )
private

Definition at line 486 of file PrintGeomInfoAction.cc.

References dd4hep_, fileDetail_, fileLV_, fileMat_, filePV_, fileSolid_, fileTouch_, groupFilesInBlocks::fout, getTouch(), and theTopPV_.

Referenced by update().

486  {
487  //---------- Dump number objects of each class in a file
488  if (theTopPV_ != nullptr) {
489  if (!fileMat_.empty()) {
490  const G4MaterialTable *matTab = G4Material::GetMaterialTable();
491  std::ofstream fout(fileMat_.c_str());
492  for (std::vector<G4Material *>::const_iterator matite = matTab->begin(); matite != matTab->end(); matite++) {
493  if (!fileDetail_)
494  fout << (*matite)->GetName() << G4endl;
495  else
496  fout << (*matite)->GetName() << " " << (*matite)->GetRadlen() << " " << (*matite)->GetNuclearInterLength()
497  << G4endl;
498  }
499  fout.close();
500  }
501  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
502  if (!fileSolid_.empty()) {
503  std::ofstream fout(fileSolid_.c_str());
504  for (std::vector<G4LogicalVolume *>::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
505  if (!fileDetail_)
506  fout << (*lvcite)->GetSolid()->GetName() << G4endl;
507  else
508  fout << (*lvcite)->GetSolid()->GetName() << " " << (*lvcite)->GetSolid()->GetCubicVolume() << G4endl;
509  fout.close();
510  }
511  if (!fileLV_.empty()) {
512  std::ofstream fout(fileLV_.c_str());
513  for (std::vector<G4LogicalVolume *>::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
514  if (!fileDetail_)
515  fout << (*lvcite)->GetName() << G4endl;
516  else
517  fout << (*lvcite)->GetName() << " " << (*lvcite)->GetMass(false, false) << G4endl;
518  fout.close();
519  }
520  if (!filePV_.empty()) {
521  const G4PhysicalVolumeStore *pvs = G4PhysicalVolumeStore::GetInstance();
522  std::ofstream fout(filePV_.c_str());
523  for (std::vector<G4VPhysicalVolume *>::const_iterator pvcite = pvs->begin(); pvcite != pvs->end(); pvcite++) {
524  if (fileDetail_) {
525  if (dd4hep_)
526  fout << (*pvcite)->GetName() << " " << (*pvcite)->GetTranslation().x() << " "
527  << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << G4endl;
528  else
529  fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << " " << (*pvcite)->GetTranslation().x()
530  << " " << (*pvcite)->GetTranslation().y() << " " << (*pvcite)->GetTranslation().z() << G4endl;
531  } else {
532  if (dd4hep_)
533  fout << (*pvcite)->GetName() << G4endl;
534  else
535  fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << G4endl;
536  }
537  }
538  fout.close();
539  }
540  if (!fileTouch_.empty()) {
541  std::ofstream fout(fileTouch_.c_str());
542  std::vector<std::string> touches;
543  getTouch(theTopPV_, 0, 1, touches);
544  std::sort(touches.begin(), touches.end());
545  for (const auto &touch : touches)
546  fout << touch << G4endl;
547  fout.close();
548  }
549  }
550 }
G4VPhysicalVolume * theTopPV_
void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector< std::string > &touches)
void PrintGeomInfoAction::dumpLV ( G4LogicalVolume *  lv,
unsigned int  leafDepth,
std::ostream &  out = G4cout 
)
private

Definition at line 354 of file PrintGeomInfoAction.cc.

References dumpAtts_, dumpLV_, dumpSolid(), dumpSolid_, submitPVResolutionJobs::out, spacesFromLeafDepth(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dumpHierarchyLeafPVLV().

354  {
355  std::string spaces = spacesFromLeafDepth(leafDepth);
356 
357  //----- dump name
358  if (dumpLV_) {
359  out << leafDepth << spaces << "$$$ VOLUME = " << lv->GetName() << " Solid: " << lv->GetSolid()->GetName()
360  << " MATERIAL: " << lv->GetMaterial()->GetName() << G4endl;
361  if (dumpSolid_)
362  dumpSolid(lv->GetSolid(), leafDepth, out); //----- dump solid
363 
364  //----- dump LV info
365  //--- material
366  if (dumpAtts_) {
367  //--- Visualisation attributes
368  const G4VisAttributes *fVA = lv->GetVisAttributes();
369  if (fVA != nullptr) {
370  out << spaces << " VISUALISATION ATTRIBUTES: " << G4endl;
371  out << spaces << " IsVisible " << fVA->IsVisible() << G4endl;
372  out << spaces << " IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << G4endl;
373  out << spaces << " Colour " << fVA->GetColour() << G4endl;
374  out << spaces << " LineStyle " << fVA->GetLineStyle() << G4endl;
375  out << spaces << " LineWidth " << fVA->GetLineWidth() << G4endl;
376  out << spaces << " IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << G4endl;
377  out << spaces << " ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << G4endl;
378  }
379 
380  //--- User Limits
381  G4UserLimits *fUL = lv->GetUserLimits();
382  G4Track dummy;
383  if (fUL != nullptr) {
384  out << spaces << " MaxAllowedStep " << fUL->GetMaxAllowedStep(dummy) << G4endl;
385  out << spaces << " UserMaxTrackLength " << fUL->GetUserMaxTrackLength(dummy) << G4endl;
386  out << spaces << " UserMaxTime " << fUL->GetUserMaxTime(dummy) << G4endl;
387  out << spaces << " UserMinEkine " << fUL->GetUserMinEkine(dummy) << G4endl;
388  out << spaces << " UserMinRange " << fUL->GetUserMinRange(dummy) << G4endl;
389  }
390 
391  //--- other LV info
392  if (lv->GetSensitiveDetector())
393  out << spaces << " IS SENSITIVE DETECTOR " << G4endl;
394  if (lv->GetFieldManager())
395  out << spaces << " FIELD ON " << G4endl;
396 
397  // Pointer (possibly NULL) to optimisation info objects.
398  out << spaces << " Quality for optimisation, average number of voxels to be spent per content "
399  << lv->GetSmartless() << G4endl;
400 
401  // Pointer (possibly NULL) to G4FastSimulationManager object.
402  if (lv->GetFastSimulationManager())
403  out << spaces << " Logical Volume is an envelope for a FastSimulationManager " << G4endl;
404  out << spaces << " Weight used in the event biasing technique = " << lv->GetBiasWeight() << G4endl;
405  }
406  }
407 }
void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out=G4cout)
std::string spacesFromLeafDepth(unsigned int leafDepth)
void PrintGeomInfoAction::dumpMaterialList ( std::ostream &  out = G4cout)
private

Definition at line 264 of file PrintGeomInfoAction.cc.

Referenced by update().

264  {
265  out << " @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
266  const G4MaterialTable *matTab = G4Material::GetMaterialTable();
267  out << " with " << matTab->size() << " materials " << G4endl;
268  std::vector<G4Material *>::const_iterator matite;
269  for (matite = matTab->begin(); matite != matTab->end(); matite++)
270  out << "Material: " << (*matite) << G4endl;
271 }
void PrintGeomInfoAction::dumpPV ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth,
std::ostream &  out = G4cout 
)
private

Definition at line 409 of file PrintGeomInfoAction.cc.

References dumpPV_, dumpReplica_, dumpRotation_, hltrates_dqm_sourceclient-live_cfg::offset, spacesFromLeafDepth(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dumpHierarchyLeafPVLV(), and dumpHierarchyTreePVLV().

409  {
410  std::string spaces = spacesFromLeafDepth(leafDepth);
411 
412  //----- PV info
413  if (dumpPV_) {
414  std::string mother = "World";
415  if (pv->GetMotherLogical())
416  mother = pv->GetMotherLogical()->GetName();
417  out << leafDepth << spaces << "### VOLUME = " << pv->GetName() << " Copy No " << pv->GetCopyNo() << " in " << mother
418  << " at " << pv->GetTranslation();
419  }
420  if (!pv->IsReplicated()) {
421  if (dumpPV_) {
422  if (pv->GetRotation() == nullptr)
423  out << " with no rotation" << G4endl;
424  else if (!dumpRotation_)
425  out << " with rotation" << G4endl; //just rotation name
426  else
427  out << " with rotation " << *(pv->GetRotation()) << G4endl;
428  }
429  } else {
430  if (dumpReplica_) {
431  out << spaces << " It is replica: " << G4endl;
432  EAxis axis;
433  int nReplicas;
434  double width;
435  double offset;
436  bool consuming;
437  pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
438  out << spaces << " axis " << axis << G4endl << spaces << " nReplicas " << nReplicas << G4endl;
439  if (pv->GetParameterisation() != nullptr)
440  out << spaces << " It is parameterisation " << G4endl;
441  else
442  out << spaces << " width " << width << G4endl << spaces << " offset " << offset << G4endl << spaces
443  << " consuming" << consuming << G4endl;
444  if (pv->GetParameterisation() != nullptr)
445  out << spaces << " It is parameterisation " << G4endl;
446  }
447  }
448 }
std::string spacesFromLeafDepth(unsigned int leafDepth)
void PrintGeomInfoAction::dumpSolid ( G4VSolid *  sol,
unsigned int  leafDepth,
std::ostream &  out = G4cout 
)
private

Definition at line 450 of file PrintGeomInfoAction.cc.

References mkfit::Const::sol, spacesFromLeafDepth(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dumpLV().

450  {
451  std::string spaces = spacesFromLeafDepth(leafDepth);
452  out << spaces << *(sol) << G4endl;
453 }
std::string spacesFromLeafDepth(unsigned int leafDepth)
constexpr float sol
Definition: Config.h:48
void PrintGeomInfoAction::dumpSummary ( std::ostream &  out = G4cout)
private

Definition at line 227 of file PrintGeomInfoAction.cc.

References countNoTouchables(), and theTopPV_.

Referenced by update().

227  {
228  //---------- Dump number of objects of each class
229  out << " @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
230  if (theTopPV_ == nullptr) {
231  out << " No volume created " << G4endl;
232  return;
233  }
234  out << " @@@ Geometry built inside world volume: " << theTopPV_->GetName() << G4endl;
235  // Get number of solids (< # LV if several LV share a solid)
236  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
237  std::vector<G4LogicalVolume *>::const_iterator lvcite;
238  std::set<G4VSolid *> theSolids;
239  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
240  theSolids.insert((*lvcite)->GetSolid());
241  out << " Number of G4VSolid's: " << theSolids.size() << G4endl;
242  out << " Number of G4LogicalVolume's: " << lvs->size() << G4endl;
243  const G4PhysicalVolumeStore *pvs = G4PhysicalVolumeStore::GetInstance();
244  out << " Number of G4VPhysicalVolume's: " << pvs->size() << G4endl;
245  out << " Number of Touchable's: " << countNoTouchables() << G4endl;
246  const G4MaterialTable *matTab = G4Material::GetMaterialTable();
247  out << " Number of G4Material's: " << matTab->size() << G4endl;
248 }
G4VPhysicalVolume * theTopPV_
void PrintGeomInfoAction::dumpTouch ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth,
std::ostream &  out = G4cout 
)
private

Definition at line 455 of file PrintGeomInfoAction.cc.

References angle_units::operators::convertRadToDeg(), fHistory_, name_, nchar_, spacesFromLeafDepth(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dumpHierarchyTreePVLV().

455  {
456  std::string spaces = spacesFromLeafDepth(leafDepth);
457  if (leafDepth == 0)
458  fHistory_.SetFirstEntry(pv);
459  else
460  fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo());
461 
462  G4ThreeVector globalpoint = fHistory_.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
463  G4LogicalVolume *lv = pv->GetLogicalVolume();
464 
465  std::string mother = "World";
466  if (pv->GetMotherLogical())
467  mother = pv->GetMotherLogical()->GetName();
468  std::string lvname = lv->GetName();
469  lvname.assign(lvname, 0, nchar_);
470  if (lvname == name_)
471  out << leafDepth << spaces << "### VOLUME = " << lv->GetName() << " Copy No " << pv->GetCopyNo() << " in " << mother
472  << " global position of centre " << globalpoint << " (r = " << globalpoint.perp()
473  << ", phi = " << convertRadToDeg(globalpoint.phi()) << ")" << G4endl;
474 
475  int NoDaughters = lv->GetNoDaughters();
476  while ((NoDaughters--) > 0) {
477  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
478  if (!pvD->IsReplicated())
479  dumpTouch(pvD, leafDepth + 1, out);
480  }
481 
482  if (leafDepth > 0)
483  fHistory_.BackLevel();
484 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
G4NavigationHistory fHistory_
std::string spacesFromLeafDepth(unsigned int leafDepth)
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=G4cout)
G4LogicalVolume * PrintGeomInfoAction::getTopLV ( )
private

Definition at line 596 of file PrintGeomInfoAction.cc.

References theTopPV_.

Referenced by countNoTouchables(), dumpG4LVTree(), and dumpHierarchyTreePVLV().

596 { return theTopPV_->GetLogicalVolume(); }
G4VPhysicalVolume * theTopPV_
G4VPhysicalVolume * PrintGeomInfoAction::getTopPV ( )
private

Definition at line 592 of file PrintGeomInfoAction.cc.

Referenced by update().

592  {
593  return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
594 }
void PrintGeomInfoAction::getTouch ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth,
unsigned int  copym,
std::vector< std::string > &  touches 
)
private

Definition at line 552 of file PrintGeomInfoAction.cc.

References filterCSVwithJSON::copy, fHistory_, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

Referenced by dumpInFile().

555  {
556  if (leafDepth == 0)
557  fHistory_.SetFirstEntry(pv);
558  else
559  fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo());
560 
561  std::string mother = "World";
562  if (pv->GetMotherLogical())
563  mother = static_cast<std::string>(dd4hep::dd::noNamespace(pv->GetMotherLogical()->GetName()));
564 
565  G4LogicalVolume *lv = pv->GetLogicalVolume();
566  std::string lvname = static_cast<std::string>(dd4hep::dd::noNamespace(lv->GetName()));
567  unsigned int copy = static_cast<unsigned int>(pv->GetCopyNo());
568 
569  std::string name = lvname + ":" + std::to_string(copy) + "_" + mother + ":" + std::to_string(copym);
570  touches.emplace_back(name);
571 
572  int NoDaughters = lv->GetNoDaughters();
573  while ((NoDaughters--) > 0) {
574  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
575  if (!pvD->IsReplicated())
576  getTouch(pvD, leafDepth + 1, copy, touches);
577  }
578 
579  if (leafDepth > 0)
580  fHistory_.BackLevel();
581 }
void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector< std::string > &touches)
std::string to_string(const V &value)
Definition: OMSAccess.h:71
G4NavigationHistory fHistory_
void PrintGeomInfoAction::registerConsumes ( edm::ConsumesCollector  cc)
overridevirtual

Reimplemented from SimWatcher.

Definition at line 132 of file PrintGeomInfoAction.cc.

References edm::BeginRun, dd4hep_, dd4hepToken_, dddToken_, and edm::ConsumesCollector::esConsumes().

132  {
133  if (dd4hep_) {
135  G4cout << "PrintGeomInfoAction::Initialize ESGetToken for cms::DDCompactView" << G4endl;
136  } else {
138  G4cout << "PrintGeomInfoAction::Initialize ESGetToken for DDCompactView" << G4endl;
139  }
140 }
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > dddToken_
std::string PrintGeomInfoAction::spacesFromLeafDepth ( unsigned int  leafDepth)
private

Definition at line 583 of file PrintGeomInfoAction.cc.

References cuy::ii, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by beginRun(), dumpLV(), dumpPV(), dumpSolid(), and dumpTouch().

583  {
584  std::string spaces;
585  unsigned int ii;
586  for (ii = 0; ii < leafDepth; ii++) {
587  spaces += " ";
588  }
589  return spaces;
590 }
int ii
Definition: cuy.py:589
void PrintGeomInfoAction::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 205 of file PrintGeomInfoAction.cc.

References dumpG4LVList(), dumpG4LVTree(), dumpHierarchyTreePVLV(), dumpInFile(), dumpLV_, dumpLVList_, dumpLVTree_, dumpMaterial_, dumpMaterialList(), dumpPV_, dumpSummary(), dumpSummary_, dumpTouch_, getTopPV(), and theTopPV_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

205  {
206  //Now take action
207  theTopPV_ = getTopPV();
208 
209  if (dumpSummary_)
210  dumpSummary(G4cout);
211  if (dumpLVTree_)
212  dumpG4LVTree(G4cout);
213 
214  //---------- Dump list of objects of each class with detail of parameters
215  if (dumpMaterial_)
216  dumpMaterialList(G4cout);
217  if (dumpLVList_)
218  dumpG4LVList(G4cout);
219 
220  //---------- Dump LV and PV information
221  if (dumpLV_ || dumpPV_ || dumpTouch_)
222  dumpHierarchyTreePVLV(G4cout);
223 
224  dumpInFile();
225 }
G4VPhysicalVolume * theTopPV_
void dumpG4LVTree(std::ostream &out=G4cout)
void dumpSummary(std::ostream &out=G4cout)
G4VPhysicalVolume * getTopPV()
void dumpMaterialList(std::ostream &out=G4cout)
void dumpG4LVList(std::ostream &out=G4cout)
void dumpHierarchyTreePVLV(std::ostream &out=G4cout)

Member Data Documentation

bool PrintGeomInfoAction::dd4hep_
private

Definition at line 81 of file PrintGeomInfoAction.cc.

Referenced by beginRun(), dumpInFile(), PrintGeomInfoAction(), and registerConsumes().

edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> PrintGeomInfoAction::dd4hepToken_
private

Definition at line 75 of file PrintGeomInfoAction.cc.

Referenced by beginRun(), and registerConsumes().

edm::ESGetToken<DDCompactView, IdealGeometryRecord> PrintGeomInfoAction::dddToken_
private

Definition at line 76 of file PrintGeomInfoAction.cc.

Referenced by beginRun(), and registerConsumes().

bool PrintGeomInfoAction::dumpAtts_
private

Definition at line 79 of file PrintGeomInfoAction.cc.

Referenced by dumpLV(), and PrintGeomInfoAction().

bool PrintGeomInfoAction::dumpLV_
private

Definition at line 79 of file PrintGeomInfoAction.cc.

Referenced by dumpLV(), PrintGeomInfoAction(), and update().

bool PrintGeomInfoAction::dumpLVList_
private

Definition at line 78 of file PrintGeomInfoAction.cc.

Referenced by PrintGeomInfoAction(), and update().

bool PrintGeomInfoAction::dumpLVTree_
private

Definition at line 78 of file PrintGeomInfoAction.cc.

Referenced by PrintGeomInfoAction(), and update().

bool PrintGeomInfoAction::dumpMaterial_
private

Definition at line 78 of file PrintGeomInfoAction.cc.

Referenced by PrintGeomInfoAction(), and update().

bool PrintGeomInfoAction::dumpPV_
private

Definition at line 79 of file PrintGeomInfoAction.cc.

Referenced by dumpPV(), PrintGeomInfoAction(), and update().

bool PrintGeomInfoAction::dumpReplica_
private

Definition at line 80 of file PrintGeomInfoAction.cc.

Referenced by dumpPV(), and PrintGeomInfoAction().

bool PrintGeomInfoAction::dumpRotation_
private

Definition at line 80 of file PrintGeomInfoAction.cc.

Referenced by dumpPV(), and PrintGeomInfoAction().

bool PrintGeomInfoAction::dumpSense_
private

Definition at line 81 of file PrintGeomInfoAction.cc.

Referenced by beginRun(), and PrintGeomInfoAction().

bool PrintGeomInfoAction::dumpSolid_
private

Definition at line 79 of file PrintGeomInfoAction.cc.

Referenced by dumpLV(), and PrintGeomInfoAction().

bool PrintGeomInfoAction::dumpSummary_
private

Definition at line 78 of file PrintGeomInfoAction.cc.

Referenced by PrintGeomInfoAction(), and update().

bool PrintGeomInfoAction::dumpTouch_
private

Definition at line 80 of file PrintGeomInfoAction.cc.

Referenced by dumpHierarchyTreePVLV(), PrintGeomInfoAction(), and update().

G4NavigationHistory PrintGeomInfoAction::fHistory_
private

Definition at line 88 of file PrintGeomInfoAction.cc.

Referenced by dumpTouch(), and getTouch().

bool PrintGeomInfoAction::fileDetail_
private

Definition at line 85 of file PrintGeomInfoAction.cc.

Referenced by dumpInFile(), and PrintGeomInfoAction().

std::string PrintGeomInfoAction::fileLV_
private

Definition at line 84 of file PrintGeomInfoAction.cc.

Referenced by dumpInFile(), and PrintGeomInfoAction().

std::string PrintGeomInfoAction::fileMat_
private

Definition at line 84 of file PrintGeomInfoAction.cc.

Referenced by dumpInFile(), and PrintGeomInfoAction().

std::string PrintGeomInfoAction::filePV_
private

Definition at line 84 of file PrintGeomInfoAction.cc.

Referenced by dumpInFile(), and PrintGeomInfoAction().

std::string PrintGeomInfoAction::fileSolid_
private

Definition at line 84 of file PrintGeomInfoAction.cc.

Referenced by dumpInFile(), and PrintGeomInfoAction().

std::string PrintGeomInfoAction::fileTouch_
private

Definition at line 84 of file PrintGeomInfoAction.cc.

Referenced by dumpInFile(), and PrintGeomInfoAction().

std::string PrintGeomInfoAction::name_
private

Definition at line 82 of file PrintGeomInfoAction.cc.

Referenced by dumpTouch(), and PrintGeomInfoAction().

std::vector<std::string> PrintGeomInfoAction::names_
private

Definition at line 86 of file PrintGeomInfoAction.cc.

Referenced by beginRun(), and PrintGeomInfoAction().

int PrintGeomInfoAction::nchar_
private

Definition at line 83 of file PrintGeomInfoAction.cc.

Referenced by dumpTouch(), and PrintGeomInfoAction().

G4VPhysicalVolume* PrintGeomInfoAction::theTopPV_
private