CMS 3D CMS Logo

DDCMSDetector.cc
Go to the documentation of this file.
11 #include "DD4hep/Detector.h"
12 
13 #include <memory>
14 #include <string>
15 
16 using namespace std;
17 using namespace cms;
18 using namespace dd4hep;
19 
21 public:
22  explicit DDCMSDetector(const edm::ParameterSet& p);
23 
24  void beginJob() override {}
25  void analyze( edm::Event const& iEvent, edm::EventSetup const& ) override;
26  void endJob() override;
27 
28 private:
29 
31  std::vector< std::string > m_relFiles;
32  std::vector< std::string > m_files;
33 };
34 
36 {
37  m_confGeomXMLFiles = edm::FileInPath( iConfig.getParameter<std::string>( "confGeomXMLFiles" )).fullPath();
38 
39  m_relFiles = iConfig.getParameter<std::vector<std::string> >( "geomXMLFiles" );
40  for( const auto& it : m_relFiles ) {
41  edm::FileInPath fp( it );
42  m_files.emplace_back( fp.fullPath());
43  }
44 }
45 
46 void
48 {
50  iEventSetup.get<DetectorDescriptionRcd>().get(description);
51 
53  iEventSetup.get<DDVectorRegistryRcd>().get(registry);
54 
55  for( const auto& it : m_files )
56  std::cout << it << std::endl;
57 
58  std::cout << "DD Vector Registry size: " << registry->vectors.size() << "\n";
59  for( const auto& p: registry->vectors ) {
60  std::cout << " " << p.first << " => ";
61  for( const auto& i : p.second )
62  std::cout << i << ", ";
63  std::cout << '\n';
64  }
65  std::cout << "Iterate over the detectors:\n";
66  for( auto const& it : description->description().detectors()) {
67  dd4hep::DetElement det(it.second);
68  std::cout << it.first << ": " << det.path() << "\n";
69  }
70  std::cout << "..done!\n";
71 }
72 
73 void
75 {
76 }
77 
T getParameter(std::string const &) const
std::vector< std::string > m_relFiles
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< std::string > m_files
DDCMSDetector(const edm::ParameterSet &p)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:230
std::string m_confGeomXMLFiles
Namespace of DDCMS conversion namespace.
std::unordered_map< std::string, std::vector< double > > vectors
void endJob() override
T get() const
Definition: EventSetup.h:68
std::string fullPath() const
Definition: FileInPath.cc:197
static Interceptor::Registry registry("Interceptor")
void beginJob() override
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
dd4hep::Detector & description() const
Definition: DDDetector.h:21