CMS 3D CMS Logo

DDCMSDetector.cc
Go to the documentation of this file.
6 #include "DD4hep/Detector.h"
7 
8 #include <memory>
9 #include <string>
10 
12 public:
13  explicit DDCMSDetector(const edm::ParameterSet& p);
14 
15  void beginJob() override {}
16  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
17  void endJob() override {}
18 
19 private:
20 
22  std::vector< std::string > relFiles_;
23  std::vector< std::string > files_;
24 };
25 
27  : confGeomXMLFiles_(iConfig.getParameter<std::string>("confGeomXMLFiles"))
28 {
29  relFiles_ = iConfig.getParameter<std::vector<std::string> >("geomXMLFiles");
30  for( auto rit : relFiles_ ) {
31  edm::FileInPath fp(rit);
32  files_.emplace_back(fp.fullPath());
33  }
34 }
35 
36 void
37 DDCMSDetector::analyze( const edm::Event& /*iEvent*/, const edm::EventSetup& /*iSetup*/ )
38 {
39  dd4hep::Detector& description = dd4hep::Detector::getInstance();
40 
41  std::string name("DD4hep_CompactLoader");
42  const char* files[] = { confGeomXMLFiles_.c_str(), nullptr };
43  description.apply(name.c_str(),2,(char**)files);
44  for( auto it : files_ )
45  std::cout << it << std::endl;
46 }
47 
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
DDCMSDetector(const edm::ParameterSet &p)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:230
std::string confGeomXMLFiles_
void endJob() override
std::vector< std::string > files_
std::vector< std::string > relFiles_
std::string fullPath() const
Definition: FileInPath.cc:197
void beginJob() override