CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDTestNavigateGeometry Class Reference
Inheritance diagram for DDTestNavigateGeometry:

Public Member Functions

void analyze (Event const &iEvent, EventSetup const &) override
 
void beginJob () override
 
 DDTestNavigateGeometry (const ParameterSet &)
 
void endJob () override
 

Private Attributes

const string m_detElementPath
 
const string m_placedVolPath
 
const ESInputTag m_tag
 

Detailed Description

Definition at line 24 of file DDTestNavigateGeometry.cc.

Constructor & Destructor Documentation

DDTestNavigateGeometry::DDTestNavigateGeometry ( const ParameterSet iConfig)
explicit

Definition at line 39 of file DDTestNavigateGeometry.cc.

40  : m_tag(iConfig.getParameter<ESInputTag>("DDDetector")),
41  m_detElementPath(iConfig.getParameter<string>("detElementPath")),
42  m_placedVolPath(iConfig.getParameter<string>("placedVolumePath"))
43 {}
T getParameter(std::string const &) const

Member Function Documentation

void DDTestNavigateGeometry::analyze ( Event const &  iEvent,
EventSetup const &   
)
override

Definition at line 46 of file DDTestNavigateGeometry.cc.

References cms::DDVolumeProcessor::count(), DEFINE_FWK_MODULE, gamEcalExtractorBlocks_cff::detector, align::Detector, edm::EventSetup::get(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::LogVerbatim::log(), cmsBatch::log, m_detElementPath, m_placedVolPath, m_tag, edm::ESInputTag::module(), AlCaHLTBitMon_ParallelJobs::p, and proc.

47 {
48  LogVerbatim("Geometry") << "\nDDTestNavigateGeometry::analyze: " << m_tag;
49 
50  const DDVectorRegistryRcd& regRecord = iEventSetup.get<DDVectorRegistryRcd>();
52  regRecord.get(m_tag.module(), reg);
53 
54  LogVerbatim("Geometry").log([&reg](auto& log) {
55  for(const auto& p: reg->vectors) {
56  log << "\n " << p.first << " => ";
57  for(const auto& i : p.second)
58  log << i << ", ";
59  }
60  });
61 
62  const GeometryFileRcd& ddRecord = iEventSetup.get<GeometryFileRcd>();
64  ddRecord.get(m_tag.module(), ddd);
65 
66  const dd4hep::Detector& detector = *ddd->description();
67 
68  DetElement startDetEl, world = detector.world();
69  LogVerbatim("Geometry") << "World placement path " << world.placementPath()
70  << ", path " << world.path();
71  PlacedVolume startPVol = world.placement();
72  if( !m_detElementPath.empty()) {
73  LogVerbatim("Geometry") << "Det element path is " << m_detElementPath;
74  startDetEl = dd4hep::detail::tools::findElement(detector, m_detElementPath);
75  if(startDetEl.isValid())
76  LogVerbatim("Geometry") << "Found starting DetElement!\n";
77  }
78  else if( !m_placedVolPath.empty()) {
79  LogVerbatim("Geometry") << "Placed volume path is " << m_placedVolPath;
80  startPVol = dd4hep::detail::tools::findNode(world.placement(), m_placedVolPath);
81  if(startPVol.isValid())
82  LogVerbatim("Geometry") << "Found srarting PlacedVolume!\n";
83  }
84  if( !startPVol.isValid()) {
85  if( !startDetEl.isValid()) {
86  except("VolumeScanner", "Failed to find start conditions for the volume scan");
87  }
88  startPVol = startDetEl.placement();
89  }
90 
92  LogVerbatim("Geometry") << startPVol.name();
93  PlacedVolumeScanner().scanPlacements(proc, startPVol, 0, true);
94 
95  LogVerbatim("Geometry") << "VolumeScanner" << "+++ Visited a total of %d placed volumes." << proc.count();
96 }
TrainProcessor *const proc
Definition: MVATrainer.cc:101
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
dd4hep::PlacedVolume PlacedVolume
LogVerbatim & log(F &&iF)
const std::string & module() const
Definition: ESInputTag.h:99
void DDTestNavigateGeometry::beginJob ( void  )
inlineoverride

Definition at line 28 of file DDTestNavigateGeometry.cc.

References analyze(), and iEvent.

28 {}
void DDTestNavigateGeometry::endJob ( void  )
inlineoverride

Definition at line 30 of file DDTestNavigateGeometry.cc.

30 {}

Member Data Documentation

const string DDTestNavigateGeometry::m_detElementPath
private

Definition at line 34 of file DDTestNavigateGeometry.cc.

Referenced by analyze().

const string DDTestNavigateGeometry::m_placedVolPath
private

Definition at line 35 of file DDTestNavigateGeometry.cc.

Referenced by analyze().

const ESInputTag DDTestNavigateGeometry::m_tag
private

Definition at line 33 of file DDTestNavigateGeometry.cc.

Referenced by analyze().