CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrintGeomInfoAction Class Reference

#include <PrintGeomInfoAction.h>

Inheritance diagram for PrintGeomInfoAction:
SimWatcher Observer< const BeginOfJob * > Observer< const BeginOfRun * >

Public Member Functions

 PrintGeomInfoAction (edm::ParameterSet const &p)
 
 ~PrintGeomInfoAction () 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 BeginOfJob * >
 Observer ()
 
void slotForUpdate (const BeginOfJob * iT)
 
virtual ~Observer ()
 
- 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=std::cout)
 
void dumpG4LVList (std::ostream &out=std::cout)
 
void dumpG4LVTree (std::ostream &out=std::cout)
 
void dumpHierarchyLeafPVLV (G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
 
void dumpHierarchyTreePVLV (std::ostream &out=std::cout)
 
void dumpInFile ()
 
void dumpLV (G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
 
void dumpMaterialList (std::ostream &out=std::cout)
 
void dumpPV (G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
 
void dumpSolid (G4VSolid *sol, unsigned int leafDepth, std::ostream &out=std::cout)
 
void dumpSummary (std::ostream &out=std::cout)
 
void dumpTouch (G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
 
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 BeginOfJob *job) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

bool dd4hep_
 
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_
 
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

Detailed Description

Definition at line 23 of file PrintGeomInfoAction.h.

Constructor & Destructor Documentation

◆ PrintGeomInfoAction()

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

Definition at line 42 of file PrintGeomInfoAction.cc.

42  {
43  dumpSummary_ = p.getUntrackedParameter<bool>("DumpSummary", true);
44  dumpLVTree_ = p.getUntrackedParameter<bool>("DumpLVTree", true);
45  dumpLVList_ = p.getUntrackedParameter<bool>("DumpLVList", false);
46  dumpMaterial_ = p.getUntrackedParameter<bool>("DumpMaterial", false);
47  dumpLV_ = p.getUntrackedParameter<bool>("DumpLV", false);
48  dumpSolid_ = p.getUntrackedParameter<bool>("DumpSolid", false);
49  dumpAtts_ = p.getUntrackedParameter<bool>("DumpAttributes", false);
50  dumpPV_ = p.getUntrackedParameter<bool>("DumpPV", false);
51  dumpRotation_ = p.getUntrackedParameter<bool>("DumpRotation", false);
52  dumpReplica_ = p.getUntrackedParameter<bool>("DumpReplica", false);
53  dumpTouch_ = p.getUntrackedParameter<bool>("DumpTouch", false);
54  dumpSense_ = p.getUntrackedParameter<bool>("DumpSense", false);
55  dd4hep_ = p.getUntrackedParameter<bool>("DD4Hep", false);
56  name_ = p.getUntrackedParameter<std::string>("Name", "*");
57  nchar_ = name_.find('*');
58  name_.assign(name_, 0, nchar_);
59  names_ = p.getUntrackedParameter<std::vector<std::string> >("Names");
60  fileMat_ = p.getUntrackedParameter<std::string>("MaterialFileName", "");
61  fileSolid_ = p.getUntrackedParameter<std::string>("SolidFileName", "");
62  fileLV_ = p.getUntrackedParameter<std::string>("LVFileName", "");
63  filePV_ = p.getUntrackedParameter<std::string>("PVFileName", "");
64  fileTouch_ = p.getUntrackedParameter<std::string>("TouchFileName", "");
65  G4cout << "PrintGeomInfoAction:: initialised for dd4hep " << dd4hep_ << " with verbosity levels:"
66  << " Summary " << dumpSummary_ << " LVTree " << dumpLVTree_ << " LVList " << dumpLVList_ << " Material "
67  << dumpMaterial_ << "\n "
68  << " LV " << dumpLV_ << " Solid " << dumpSolid_ << " Attribs " << dumpAtts_
69  << "\n "
70  << " PV " << dumpPV_ << " Rotation " << dumpRotation_ << " Replica " << dumpReplica_
71  << "\n "
72  << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_
73  << "\n "
74  << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" << fileLV_ << ":"
75  << filePV_ << ":" << fileTouch_ << "\n "
76  << "for " << names_.size() << " names:";
77  for (unsigned int i = 0; i < names_.size(); i++)
78  G4cout << " " << names_[i];
79  G4cout << G4endl;
80 }

References dd4hep_, dumpAtts_, dumpLV_, dumpLVList_, dumpLVTree_, dumpMaterial_, dumpPV_, dumpReplica_, dumpRotation_, dumpSense_, dumpSolid_, dumpSummary_, dumpTouch_, fileLV_, fileMat_, filePV_, fileSolid_, fileTouch_, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, mps_fire::i, name_, names_, nchar_, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~PrintGeomInfoAction()

PrintGeomInfoAction::~PrintGeomInfoAction ( )
override

Definition at line 82 of file PrintGeomInfoAction.cc.

82 {}

Member Function Documentation

◆ add1touchable()

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

Definition at line 245 of file PrintGeomInfoAction.cc.

245  {
246  int siz = lv->GetNoDaughters();
247  for (int ii = 0; ii < siz; ii++)
248  add1touchable(lv->GetDaughter(ii)->GetLogicalVolume(), ++nTouch);
249 }

References cuy::ii.

Referenced by countNoTouchables().

◆ countNoTouchables()

int PrintGeomInfoAction::countNoTouchables ( )
private

Definition at line 238 of file PrintGeomInfoAction.cc.

238  {
239  int nTouch = 0;
240  G4LogicalVolume *lv = getTopLV();
241  add1touchable(lv, nTouch);
242  return nTouch;
243 }

References add1touchable(), and getTopLV().

Referenced by dumpSummary().

◆ dumpG4LVLeaf()

void PrintGeomInfoAction::dumpG4LVLeaf ( G4LogicalVolume *  lv,
unsigned int  leafDepth,
unsigned int  count,
std::ostream &  out = std::cout 
)
private

Definition at line 216 of file PrintGeomInfoAction.cc.

219  {
220  for (unsigned int ii = 0; ii < leafDepth; ii++)
221  out << " ";
222  out << " LV:(" << leafDepth << ") " << lv->GetName() << " (" << count << ")" << G4endl;
223  //--- If a volume is placed n types as daughter of this LV, it should only be counted once
224  std::map<G4LogicalVolume *, unsigned int> lvCount;
225  std::map<G4LogicalVolume *, unsigned int>::const_iterator cite;
226  int siz = lv->GetNoDaughters();
227  for (int ii = 0; ii < siz; ii++) {
228  cite = lvCount.find(lv->GetDaughter(ii)->GetLogicalVolume());
229  if (cite != lvCount.end())
230  lvCount[cite->first] = (cite->second) + 1;
231  else
232  lvCount.insert(std::pair<G4LogicalVolume *, unsigned int>(lv->GetDaughter(ii)->GetLogicalVolume(), 1));
233  }
234  for (cite = lvCount.begin(); cite != lvCount.end(); cite++)
235  dumpG4LVLeaf((cite->first), leafDepth + 1, (cite->second), out);
236 }

References submitPVResolutionJobs::count, cuy::ii, and MillePedeFileConverter_cfg::out.

Referenced by dumpG4LVTree().

◆ dumpG4LVList()

void PrintGeomInfoAction::dumpG4LVList ( std::ostream &  out = std::cout)
private

Definition at line 193 of file PrintGeomInfoAction.cc.

193  {
194  out << " @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's List " << G4endl;
195  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
196  std::vector<G4LogicalVolume *>::const_iterator lvcite;
197  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
198  out << "LV:" << (*lvcite)->GetName() << "\tMaterial: " << (*lvcite)->GetMaterial()->GetName() << G4endl;
199 }

References MillePedeFileConverter_cfg::out.

Referenced by update().

◆ dumpG4LVTree()

void PrintGeomInfoAction::dumpG4LVTree ( std::ostream &  out = std::cout)
private

Definition at line 201 of file PrintGeomInfoAction.cc.

201  {
202  out << " @@@@@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl;
203  G4LogicalVolume *lv = getTopLV();
204  dumpG4LVLeaf(lv, 0, 1, out);
205 }

References dumpG4LVLeaf(), getTopLV(), and MillePedeFileConverter_cfg::out.

Referenced by update().

◆ dumpHierarchyLeafPVLV()

void PrintGeomInfoAction::dumpHierarchyLeafPVLV ( G4LogicalVolume *  lv,
unsigned int  leafDepth,
std::ostream &  out = std::cout 
)
private

Definition at line 269 of file PrintGeomInfoAction.cc.

269  {
270  //----- Dump this LV
271  dumpLV(lv, leafDepth, out);
272 
273  //----- Get LV daughters from list of PV daughters
274  mmlvpv lvpvDaughters;
275  std::set<G4LogicalVolume *> lvDaughters;
276  int NoDaughters = lv->GetNoDaughters();
277  while ((NoDaughters--) > 0) {
278  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
279  lvpvDaughters.insert(mmlvpv::value_type(pvD->GetLogicalVolume(), pvD));
280  lvDaughters.insert(pvD->GetLogicalVolume());
281  }
282 
283  std::set<G4LogicalVolume *>::const_iterator scite;
284  mmlvpv::const_iterator mmcite;
285 
286  //----- Dump daughters PV and LV
287  for (scite = lvDaughters.begin(); scite != lvDaughters.end(); scite++) {
288  std::pair<mmlvpv::iterator, mmlvpv::iterator> mmER = lvpvDaughters.equal_range(*scite);
289  //----- Dump daughters PV of this LV
290  for (mmcite = mmER.first; mmcite != mmER.second; mmcite++)
291  dumpPV((*mmcite).second, leafDepth + 1, out);
292  //----- Dump daughters LV
293  dumpHierarchyLeafPVLV(*scite, leafDepth + 1, out);
294  }
295 }

References dumpLV(), dumpPV(), and MillePedeFileConverter_cfg::out.

Referenced by dumpHierarchyTreePVLV().

◆ dumpHierarchyTreePVLV()

void PrintGeomInfoAction::dumpHierarchyTreePVLV ( std::ostream &  out = std::cout)
private

Definition at line 251 of file PrintGeomInfoAction.cc.

251  {
252  //dumps in the following order:
253  // 1) a LV with details
254  // 2) list of PVs daughters of this LV with details
255  // 3) list of LVs daughters of this LV and for each go to 1)
256 
257  //----- Get top PV
258  G4LogicalVolume *topLV = getTopLV();
259 
260  //----- Dump this leaf (it will recursively dump all the tree)
261  dumpHierarchyLeafPVLV(topLV, 0, out);
262  dumpPV(theTopPV_, 0, out);
263 
264  //----- Dump the touchables (it will recursively dump all the tree)
265  if (dumpTouch_)
266  dumpTouch(theTopPV_, 0, out);
267 }

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

Referenced by update().

◆ dumpInFile()

void PrintGeomInfoAction::dumpInFile ( )
private

Definition at line 429 of file PrintGeomInfoAction.cc.

429  {
430  //---------- Dump number objects of each class in a file
431  if (theTopPV_ != nullptr) {
432  if (!fileMat_.empty()) {
433  const G4MaterialTable *matTab = G4Material::GetMaterialTable();
434  std::ofstream fout(fileMat_.c_str());
435  for (std::vector<G4Material *>::const_iterator matite = matTab->begin(); matite != matTab->end(); matite++)
436  fout << (*matite)->GetName() << "\n";
437  fout.close();
438  }
439  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
440  if (!fileSolid_.empty()) {
441  std::ofstream fout(fileSolid_.c_str());
442  for (std::vector<G4LogicalVolume *>::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
443  fout << (*lvcite)->GetSolid()->GetName() << "\n";
444  fout.close();
445  }
446  if (!fileLV_.empty()) {
447  std::ofstream fout(fileLV_.c_str());
448  for (std::vector<G4LogicalVolume *>::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
449  fout << (*lvcite)->GetName() << "\n";
450  fout.close();
451  }
452  if (!filePV_.empty()) {
453  const G4PhysicalVolumeStore *pvs = G4PhysicalVolumeStore::GetInstance();
454  std::ofstream fout(filePV_.c_str());
455  for (std::vector<G4VPhysicalVolume *>::const_iterator pvcite = pvs->begin(); pvcite != pvs->end(); pvcite++) {
456  if (dd4hep_)
457  fout << (*pvcite)->GetName() << "\n";
458  else
459  fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << "\n";
460  }
461  fout.close();
462  }
463  if (!fileTouch_.empty()) {
464  std::ofstream fout(fileTouch_.c_str());
465  std::vector<std::string> touches;
466  getTouch(theTopPV_, 0, 1, touches);
467  std::sort(touches.begin(), touches.end());
468  for (const auto &touch : touches)
469  fout << touch << "\n";
470  fout.close();
471  }
472  }
473 }

References dd4hep_, fileLV_, fileMat_, filePV_, fileSolid_, fileTouch_, groupFilesInBlocks::fout, getTouch(), FSQDQM_cfi::pvs, jetUpdater_cfi::sort, and theTopPV_.

Referenced by update().

◆ dumpLV()

void PrintGeomInfoAction::dumpLV ( G4LogicalVolume *  lv,
unsigned int  leafDepth,
std::ostream &  out = std::cout 
)
private

Definition at line 297 of file PrintGeomInfoAction.cc.

297  {
298  std::string spaces = spacesFromLeafDepth(leafDepth);
299 
300  //----- dump name
301  if (dumpLV_) {
302  out << leafDepth << spaces << "$$$ VOLUME = " << lv->GetName() << " Solid: " << lv->GetSolid()->GetName()
303  << " MATERIAL: " << lv->GetMaterial()->GetName() << G4endl;
304  if (dumpSolid_)
305  dumpSolid(lv->GetSolid(), leafDepth, out); //----- dump solid
306 
307  //----- dump LV info
308  //--- material
309  if (dumpAtts_) {
310  //--- Visualisation attributes
311  const G4VisAttributes *fVA = lv->GetVisAttributes();
312  if (fVA != nullptr) {
313  out << spaces << " VISUALISATION ATTRIBUTES: " << G4endl;
314  out << spaces << " IsVisible " << fVA->IsVisible() << G4endl;
315  out << spaces << " IsDaughtersInvisible " << fVA->IsDaughtersInvisible() << G4endl;
316  out << spaces << " Colour " << fVA->GetColour() << G4endl;
317  out << spaces << " LineStyle " << fVA->GetLineStyle() << G4endl;
318  out << spaces << " LineWidth " << fVA->GetLineWidth() << G4endl;
319  out << spaces << " IsForceDrawingStyle " << fVA->IsForceDrawingStyle() << G4endl;
320  out << spaces << " ForcedDrawingStyle " << fVA->GetForcedDrawingStyle() << G4endl;
321  }
322 
323  //--- User Limits
324  G4UserLimits *fUL = lv->GetUserLimits();
325  G4Track dummy;
326  if (fUL != nullptr) {
327  out << spaces << " MaxAllowedStep " << fUL->GetMaxAllowedStep(dummy) << G4endl;
328  out << spaces << " UserMaxTrackLength " << fUL->GetUserMaxTrackLength(dummy) << G4endl;
329  out << spaces << " UserMaxTime " << fUL->GetUserMaxTime(dummy) << G4endl;
330  out << spaces << " UserMinEkine " << fUL->GetUserMinEkine(dummy) << G4endl;
331  out << spaces << " UserMinRange " << fUL->GetUserMinRange(dummy) << G4endl;
332  }
333 
334  //--- other LV info
335  if (lv->GetSensitiveDetector())
336  out << spaces << " IS SENSITIVE DETECTOR " << G4endl;
337  if (lv->GetFieldManager())
338  out << spaces << " FIELD ON " << G4endl;
339 
340  // Pointer (possibly NULL) to optimisation info objects.
341  out << spaces << " Quality for optimisation, average number of voxels to be spent per content "
342  << lv->GetSmartless() << G4endl;
343 
344  // Pointer (possibly NULL) to G4FastSimulationManager object.
345  if (lv->GetFastSimulationManager())
346  out << spaces << " Logical Volume is an envelope for a FastSimulationManager " << G4endl;
347  out << spaces << " Weight used in the event biasing technique = " << lv->GetBiasWeight() << G4endl;
348  }
349  }
350 }

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

Referenced by dumpHierarchyLeafPVLV().

◆ dumpMaterialList()

void PrintGeomInfoAction::dumpMaterialList ( std::ostream &  out = std::cout)
private

Definition at line 207 of file PrintGeomInfoAction.cc.

207  {
208  out << " @@@@@@@@@@@@@@@@ DUMPING G4Material List ";
209  const G4MaterialTable *matTab = G4Material::GetMaterialTable();
210  out << " with " << matTab->size() << " materials " << G4endl;
211  std::vector<G4Material *>::const_iterator matite;
212  for (matite = matTab->begin(); matite != matTab->end(); matite++)
213  out << "Material: " << (*matite) << G4endl;
214 }

References MillePedeFileConverter_cfg::out.

Referenced by update().

◆ dumpPV()

void PrintGeomInfoAction::dumpPV ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth,
std::ostream &  out = std::cout 
)
private

Definition at line 352 of file PrintGeomInfoAction.cc.

352  {
353  std::string spaces = spacesFromLeafDepth(leafDepth);
354 
355  //----- PV info
356  if (dumpPV_) {
357  std::string mother = "World";
358  if (pv->GetMotherLogical())
359  mother = pv->GetMotherLogical()->GetName();
360  out << leafDepth << spaces << "### VOLUME = " << pv->GetName() << " Copy No " << pv->GetCopyNo() << " in " << mother
361  << " at " << pv->GetTranslation();
362  }
363  if (!pv->IsReplicated()) {
364  if (dumpPV_) {
365  if (pv->GetRotation() == nullptr)
366  out << " with no rotation" << G4endl;
367  else if (!dumpRotation_)
368  out << " with rotation" << G4endl; //just rotation name
369  else
370  out << " with rotation " << *(pv->GetRotation()) << G4endl;
371  }
372  } else {
373  if (dumpReplica_) {
374  out << spaces << " It is replica: " << G4endl;
375  EAxis axis;
376  int nReplicas;
377  double width;
378  double offset;
379  bool consuming;
380  pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
381  out << spaces << " axis " << axis << G4endl << spaces << " nReplicas " << nReplicas << G4endl;
382  if (pv->GetParameterisation() != nullptr)
383  out << spaces << " It is parameterisation " << G4endl;
384  else
385  out << spaces << " width " << width << G4endl << spaces << " offset " << offset << G4endl << spaces
386  << " consuming" << consuming << G4endl;
387  if (pv->GetParameterisation() != nullptr)
388  out << spaces << " It is parameterisation " << G4endl;
389  }
390  }
391 }

References dumpPV_, dumpReplica_, dumpRotation_, hltrates_dqm_sourceclient-live_cfg::offset, MillePedeFileConverter_cfg::out, MetAnalyzer::pv(), spacesFromLeafDepth(), AlCaHLTBitMon_QueryRunRegistry::string, and ApeEstimator_cff::width.

Referenced by dumpHierarchyLeafPVLV(), and dumpHierarchyTreePVLV().

◆ dumpSolid()

void PrintGeomInfoAction::dumpSolid ( G4VSolid *  sol,
unsigned int  leafDepth,
std::ostream &  out = std::cout 
)
private

Definition at line 393 of file PrintGeomInfoAction.cc.

393  {
394  std::string spaces = spacesFromLeafDepth(leafDepth);
395  out << spaces << *(sol) << G4endl;
396 }

References MillePedeFileConverter_cfg::out, spacesFromLeafDepth(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dumpLV().

◆ dumpSummary()

void PrintGeomInfoAction::dumpSummary ( std::ostream &  out = std::cout)
private

Definition at line 170 of file PrintGeomInfoAction.cc.

170  {
171  //---------- Dump number of objects of each class
172  out << " @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
173  if (theTopPV_ == nullptr) {
174  out << " No volume created " << G4endl;
175  return;
176  }
177  out << " @@@ Geometry built inside world volume: " << theTopPV_->GetName() << G4endl;
178  // Get number of solids (< # LV if several LV share a solid)
179  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
180  std::vector<G4LogicalVolume *>::const_iterator lvcite;
181  std::set<G4VSolid *> theSolids;
182  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
183  theSolids.insert((*lvcite)->GetSolid());
184  out << " Number of G4VSolid's: " << theSolids.size() << G4endl;
185  out << " Number of G4LogicalVolume's: " << lvs->size() << G4endl;
186  const G4PhysicalVolumeStore *pvs = G4PhysicalVolumeStore::GetInstance();
187  out << " Number of G4VPhysicalVolume's: " << pvs->size() << G4endl;
188  out << " Number of Touchable's: " << countNoTouchables() << G4endl;
189  const G4MaterialTable *matTab = G4Material::GetMaterialTable();
190  out << " Number of G4Material's: " << matTab->size() << G4endl;
191 }

References countNoTouchables(), MillePedeFileConverter_cfg::out, FSQDQM_cfi::pvs, and theTopPV_.

Referenced by update().

◆ dumpTouch()

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

Definition at line 398 of file PrintGeomInfoAction.cc.

398  {
399  std::string spaces = spacesFromLeafDepth(leafDepth);
400  if (leafDepth == 0)
401  fHistory_.SetFirstEntry(pv);
402  else
403  fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo());
404 
405  G4ThreeVector globalpoint = fHistory_.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
406  G4LogicalVolume *lv = pv->GetLogicalVolume();
407 
408  std::string mother = "World";
409  if (pv->GetMotherLogical())
410  mother = pv->GetMotherLogical()->GetName();
411  std::string lvname = lv->GetName();
412  lvname.assign(lvname, 0, nchar_);
413  if (lvname == name_)
414  out << leafDepth << spaces << "### VOLUME = " << lv->GetName() << " Copy No " << pv->GetCopyNo() << " in " << mother
415  << " global position of centre " << globalpoint << " (r = " << globalpoint.perp()
416  << ", phi = " << convertRadToDeg(globalpoint.phi()) << ")" << G4endl;
417 
418  int NoDaughters = lv->GetNoDaughters();
419  while ((NoDaughters--) > 0) {
420  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
421  if (!pvD->IsReplicated())
422  dumpTouch(pvD, leafDepth + 1, out);
423  }
424 
425  if (leafDepth > 0)
426  fHistory_.BackLevel();
427 }

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

Referenced by dumpHierarchyTreePVLV().

◆ getTopLV()

G4LogicalVolume * PrintGeomInfoAction::getTopLV ( )
private

Definition at line 519 of file PrintGeomInfoAction.cc.

519 { return theTopPV_->GetLogicalVolume(); }

References theTopPV_.

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

◆ getTopPV()

G4VPhysicalVolume * PrintGeomInfoAction::getTopPV ( )
private

Definition at line 515 of file PrintGeomInfoAction.cc.

515  {
516  return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
517 }

Referenced by update().

◆ getTouch()

void PrintGeomInfoAction::getTouch ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth,
unsigned int  copym,
std::vector< std::string > &  touches 
)
private

Definition at line 475 of file PrintGeomInfoAction.cc.

478  {
479  if (leafDepth == 0)
480  fHistory_.SetFirstEntry(pv);
481  else
482  fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo());
483 
484  std::string mother = "World";
485  if (pv->GetMotherLogical())
486  mother = static_cast<std::string>(dd4hep::dd::noNamespace(pv->GetMotherLogical()->GetName()));
487 
488  G4LogicalVolume *lv = pv->GetLogicalVolume();
489  std::string lvname = static_cast<std::string>(dd4hep::dd::noNamespace(lv->GetName()));
490  unsigned int copy = static_cast<unsigned int>(pv->GetCopyNo());
491 
492  std::string name = lvname + ":" + std::to_string(copy) + "_" + mother + ":" + std::to_string(copym);
493  touches.emplace_back(name);
494 
495  int NoDaughters = lv->GetNoDaughters();
496  while ((NoDaughters--) > 0) {
497  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
498  if (!pvD->IsReplicated())
499  getTouch(pvD, leafDepth + 1, copy, touches);
500  }
501 
502  if (leafDepth > 0)
503  fHistory_.BackLevel();
504 }

References filterCSVwithJSON::copy, fHistory_, Skims_PA_cff::name, MetAnalyzer::pv(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dumpInFile().

◆ spacesFromLeafDepth()

std::string PrintGeomInfoAction::spacesFromLeafDepth ( unsigned int  leafDepth)
private

Definition at line 506 of file PrintGeomInfoAction.cc.

506  {
507  std::string spaces;
508  unsigned int ii;
509  for (ii = 0; ii < leafDepth; ii++) {
510  spaces += " ";
511  }
512  return spaces;
513 }

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

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

◆ update() [1/2]

void PrintGeomInfoAction::update ( const BeginOfJob )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 84 of file PrintGeomInfoAction.cc.

84  {
85  if (dumpSense_) {
86  if (dd4hep_) {
88  (*job)()->get<IdealGeometryRecord>().get(pDD);
89 
90  G4cout << "PrintGeomInfoAction::Get Printout of Sensitive Volumes "
91  << "for " << names_.size() << " Readout Units" << G4endl;
92  for (unsigned int i = 0; i < names_.size(); i++) {
94  const cms::DDFilter filter("ReadOutName", sd);
95  cms::DDFilteredView fv(*pDD, filter);
96  G4cout << "PrintGeomInfoAction:: Get Filtered view for ReadOutName = " << sd << G4endl;
97  G4cout << "Lengths are in mm, angles in degrees" << G4endl;
98 
99  std::string spaces = spacesFromLeafDepth(1);
100 
101  while (fv.firstChild()) {
102  auto tran = fv.translation() / dd4hep::mm;
103  std::vector<int> copy = fv.copyNos();
104  auto lvname = fv.name();
105  unsigned int leafDepth = copy.size();
106  G4cout << leafDepth << spaces << "### VOLUME = " << lvname << " Copy No";
107  for (unsigned int k = 0; k < leafDepth; ++k)
108  G4cout << " " << copy[k];
109  G4cout << " Centre at " << tran << " (r = " << tran.Rho() << ", phi = " << convertRadToDeg(tran.phi()) << ")"
110  << G4endl;
111  }
112  }
113  } else {
115  (*job)()->get<IdealGeometryRecord>().get(pDD);
116 
117  G4cout << "PrintGeomInfoAction::Get Printout of Sensitive Volumes "
118  << "for " << names_.size() << " Readout Units" << G4endl;
119  for (unsigned int i = 0; i < names_.size(); i++) {
120  std::string attribute = "ReadOutName";
121  std::string sd = names_[i];
123  DDFilteredView fv(*pDD, filter);
124  G4cout << "PrintGeomInfoAction:: Get Filtered view for " << attribute << " = " << sd << G4endl;
125  G4cout << "Lengths are in mm, angles in degrees" << G4endl;
126  bool dodet = fv.firstChild();
127 
128  std::string spaces = spacesFromLeafDepth(1);
129 
130  while (dodet) {
131  const DDLogicalPart &log = fv.logicalPart();
132  std::string lvname = log.name().name();
133  DDTranslation tran = fv.translation();
134  std::vector<int> copy = fv.copyNumbers();
135 
136  unsigned int leafDepth = copy.size();
137  G4cout << leafDepth << spaces << "### VOLUME = " << lvname << " Copy No";
138  for (int k = leafDepth - 1; k >= 0; k--)
139  G4cout << " " << copy[k];
140  G4cout << " Centre at " << tran << " (r = " << tran.Rho() << ", phi = " << convertRadToDeg(tran.phi()) << ")"
141  << G4endl;
142  dodet = fv.next();
143  }
144  }
145  }
146  }
147 }

References angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), DDFilteredView::copyNumbers(), dd4hep_, dumpSense_, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), cms::DDFilteredView::firstChild(), ecalTB2006H4_GenSimDigiReco_cfg::G4cout, mps_fire::i, dqmdumpme::k, dqm-mbProfile::log, DDFilteredView::logicalPart(), cms::DDFilteredView::name(), names_, DDFilteredView::next(), sd, spacesFromLeafDepth(), AlCaHLTBitMon_QueryRunRegistry::string, DDFilteredView::translation(), and cms::DDFilteredView::translation().

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

◆ update() [2/2]

void PrintGeomInfoAction::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 149 of file PrintGeomInfoAction.cc.

149  {
150  theTopPV_ = getTopPV();
151 
152  if (dumpSummary_)
154  if (dumpLVTree_)
156 
157  //---------- Dump list of objects of each class with detail of parameters
158  if (dumpMaterial_)
160  if (dumpLVList_)
162 
163  //---------- Dump LV and PV information
164  if (dumpLV_ || dumpPV_ || dumpTouch_)
166 
167  dumpInFile();
168 }

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

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

Member Data Documentation

◆ dd4hep_

bool PrintGeomInfoAction::dd4hep_
private

Definition at line 54 of file PrintGeomInfoAction.h.

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

◆ dumpAtts_

bool PrintGeomInfoAction::dumpAtts_
private

Definition at line 52 of file PrintGeomInfoAction.h.

Referenced by dumpLV(), and PrintGeomInfoAction().

◆ dumpLV_

bool PrintGeomInfoAction::dumpLV_
private

Definition at line 52 of file PrintGeomInfoAction.h.

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

◆ dumpLVList_

bool PrintGeomInfoAction::dumpLVList_
private

Definition at line 51 of file PrintGeomInfoAction.h.

Referenced by PrintGeomInfoAction(), and update().

◆ dumpLVTree_

bool PrintGeomInfoAction::dumpLVTree_
private

Definition at line 51 of file PrintGeomInfoAction.h.

Referenced by PrintGeomInfoAction(), and update().

◆ dumpMaterial_

bool PrintGeomInfoAction::dumpMaterial_
private

Definition at line 51 of file PrintGeomInfoAction.h.

Referenced by PrintGeomInfoAction(), and update().

◆ dumpPV_

bool PrintGeomInfoAction::dumpPV_
private

Definition at line 52 of file PrintGeomInfoAction.h.

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

◆ dumpReplica_

bool PrintGeomInfoAction::dumpReplica_
private

Definition at line 53 of file PrintGeomInfoAction.h.

Referenced by dumpPV(), and PrintGeomInfoAction().

◆ dumpRotation_

bool PrintGeomInfoAction::dumpRotation_
private

Definition at line 53 of file PrintGeomInfoAction.h.

Referenced by dumpPV(), and PrintGeomInfoAction().

◆ dumpSense_

bool PrintGeomInfoAction::dumpSense_
private

Definition at line 54 of file PrintGeomInfoAction.h.

Referenced by PrintGeomInfoAction(), and update().

◆ dumpSolid_

bool PrintGeomInfoAction::dumpSolid_
private

Definition at line 52 of file PrintGeomInfoAction.h.

Referenced by dumpLV(), and PrintGeomInfoAction().

◆ dumpSummary_

bool PrintGeomInfoAction::dumpSummary_
private

Definition at line 51 of file PrintGeomInfoAction.h.

Referenced by PrintGeomInfoAction(), and update().

◆ dumpTouch_

bool PrintGeomInfoAction::dumpTouch_
private

Definition at line 53 of file PrintGeomInfoAction.h.

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

◆ fHistory_

G4NavigationHistory PrintGeomInfoAction::fHistory_
private

Definition at line 60 of file PrintGeomInfoAction.h.

Referenced by dumpTouch(), and getTouch().

◆ fileLV_

std::string PrintGeomInfoAction::fileLV_
private

Definition at line 57 of file PrintGeomInfoAction.h.

Referenced by dumpInFile(), and PrintGeomInfoAction().

◆ fileMat_

std::string PrintGeomInfoAction::fileMat_
private

Definition at line 57 of file PrintGeomInfoAction.h.

Referenced by dumpInFile(), and PrintGeomInfoAction().

◆ filePV_

std::string PrintGeomInfoAction::filePV_
private

Definition at line 57 of file PrintGeomInfoAction.h.

Referenced by dumpInFile(), and PrintGeomInfoAction().

◆ fileSolid_

std::string PrintGeomInfoAction::fileSolid_
private

Definition at line 57 of file PrintGeomInfoAction.h.

Referenced by dumpInFile(), and PrintGeomInfoAction().

◆ fileTouch_

std::string PrintGeomInfoAction::fileTouch_
private

Definition at line 57 of file PrintGeomInfoAction.h.

Referenced by dumpInFile(), and PrintGeomInfoAction().

◆ name_

std::string PrintGeomInfoAction::name_
private

Definition at line 55 of file PrintGeomInfoAction.h.

Referenced by dumpTouch(), and PrintGeomInfoAction().

◆ names_

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

Definition at line 58 of file PrintGeomInfoAction.h.

Referenced by PrintGeomInfoAction(), and update().

◆ nchar_

int PrintGeomInfoAction::nchar_
private

Definition at line 56 of file PrintGeomInfoAction.h.

Referenced by dumpTouch(), and PrintGeomInfoAction().

◆ theTopPV_

G4VPhysicalVolume* PrintGeomInfoAction::theTopPV_
private
PrintGeomInfoAction::fileSolid_
std::string fileSolid_
Definition: PrintGeomInfoAction.h:57
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
PrintGeomInfoAction::names_
std::vector< std::string > names_
Definition: PrintGeomInfoAction.h:58
mps_fire.i
i
Definition: mps_fire.py:428
mmlvpv
std::multimap< G4LogicalVolume *, G4VPhysicalVolume *, std::less< G4LogicalVolume * > > mmlvpv
Definition: PrintGeomInfoAction.h:19
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
PrintGeomInfoAction::dumpTouch
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:398
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PrintGeomInfoAction::dumpSolid
void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:393
PrintGeomInfoAction::filePV_
std::string filePV_
Definition: PrintGeomInfoAction.h:57
PrintGeomInfoAction::getTopPV
G4VPhysicalVolume * getTopPV()
Definition: PrintGeomInfoAction.cc:515
PrintGeomInfoAction::dumpTouch_
bool dumpTouch_
Definition: PrintGeomInfoAction.h:53
PrintGeomInfoAction::dumpPV_
bool dumpPV_
Definition: PrintGeomInfoAction.h:52
PrintGeomInfoAction::dumpG4LVList
void dumpG4LVList(std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:193
cms::DDFilteredView
Definition: DDFilteredView.h:70
PrintGeomInfoAction::getTopLV
G4LogicalVolume * getTopLV()
Definition: PrintGeomInfoAction.cc:519
PrintGeomInfoAction::dumpReplica_
bool dumpReplica_
Definition: PrintGeomInfoAction.h:53
PrintGeomInfoAction::add1touchable
void add1touchable(G4LogicalVolume *lv, int &nTouch)
Definition: PrintGeomInfoAction.cc:245
PrintGeomInfoAction::dumpPV
void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:352
cms::DDFilter
Definition: DDFilteredView.h:59
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
PrintGeomInfoAction::fileMat_
std::string fileMat_
Definition: PrintGeomInfoAction.h:57
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
PrintGeomInfoAction::dd4hep_
bool dd4hep_
Definition: PrintGeomInfoAction.h:54
PrintGeomInfoAction::nchar_
int nchar_
Definition: PrintGeomInfoAction.h:56
PrintGeomInfoAction::dumpLVList_
bool dumpLVList_
Definition: PrintGeomInfoAction.h:51
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
PrintGeomInfoAction::getTouch
void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector< std::string > &touches)
Definition: PrintGeomInfoAction.cc:475
PrintGeomInfoAction::dumpSense_
bool dumpSense_
Definition: PrintGeomInfoAction.h:54
PrintGeomInfoAction::dumpG4LVLeaf
void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:216
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PrintGeomInfoAction::dumpLV_
bool dumpLV_
Definition: PrintGeomInfoAction.h:52
PrintGeomInfoAction::dumpRotation_
bool dumpRotation_
Definition: PrintGeomInfoAction.h:53
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
PrintGeomInfoAction::dumpSolid_
bool dumpSolid_
Definition: PrintGeomInfoAction.h:52
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
PrintGeomInfoAction::dumpLVTree_
bool dumpLVTree_
Definition: PrintGeomInfoAction.h:51
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
PrintGeomInfoAction::dumpSummary_
bool dumpSummary_
Definition: PrintGeomInfoAction.h:51
FSQDQM_cfi.pvs
pvs
Definition: FSQDQM_cfi.py:12
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
PrintGeomInfoAction::dumpMaterial_
bool dumpMaterial_
Definition: PrintGeomInfoAction.h:51
PrintGeomInfoAction::dumpMaterialList
void dumpMaterialList(std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:207
PrintGeomInfoAction::dumpHierarchyTreePVLV
void dumpHierarchyTreePVLV(std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:251
PrintGeomInfoAction::dumpSummary
void dumpSummary(std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:170
DDValue
Definition: DDValue.h:21
PrintGeomInfoAction::dumpLV
void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:297
PrintGeomInfoAction::fHistory_
G4NavigationHistory fHistory_
Definition: PrintGeomInfoAction.h:60
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
PrintGeomInfoAction::dumpHierarchyLeafPVLV
void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:269
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
sd
double sd
Definition: CascadeWrapper.h:113
DDFilteredView
Definition: DDFilteredView.h:20
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
PrintGeomInfoAction::spacesFromLeafDepth
std::string spacesFromLeafDepth(unsigned int leafDepth)
Definition: PrintGeomInfoAction.cc:506
PrintGeomInfoAction::fileLV_
std::string fileLV_
Definition: PrintGeomInfoAction.h:57
PrintGeomInfoAction::dumpG4LVTree
void dumpG4LVTree(std::ostream &out=std::cout)
Definition: PrintGeomInfoAction.cc:201
dummy
Definition: DummySelector.h:38
ecalTB2006H4_GenSimDigiReco_cfg.G4cout
G4cout
Definition: ecalTB2006H4_GenSimDigiReco_cfg.py:285
PrintGeomInfoAction::name_
std::string name_
Definition: PrintGeomInfoAction.h:55
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
PrintGeomInfoAction::theTopPV_
G4VPhysicalVolume * theTopPV_
Definition: PrintGeomInfoAction.h:59
cuy.ii
ii
Definition: cuy.py:590
PrintGeomInfoAction::dumpAtts_
bool dumpAtts_
Definition: PrintGeomInfoAction.h:52
PrintGeomInfoAction::dumpInFile
void dumpInFile()
Definition: PrintGeomInfoAction.cc:429
PrintGeomInfoAction::countNoTouchables
int countNoTouchables()
Definition: PrintGeomInfoAction.cc:238
PrintGeomInfoAction::fileTouch_
std::string fileTouch_
Definition: PrintGeomInfoAction.h:57