CMS 3D CMS Logo

DDPlugins.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_DD_PLUGINS_H
2 #define DETECTOR_DESCRIPTION_DD_PLUGINS_H
3 
5 #include "DD4hep/Factories.h"
6 #include "DD4hep/Plugins.h"
7 
8 namespace dd4hep {
9 
10  class SensitiveDetector;
11 
12  template <typename T>
13  class DDCMSDetElementFactory : public dd4hep::PluginFactoryBase {
14  public:
15  static long create(dd4hep::Detector& detector,
16  cms::DDParsingContext& context,
17  dd4hep::xml::Handle_t element,
18  dd4hep::SensitiveDetector& sensitive);
19  };
20 } // namespace dd4hep
21 
22 namespace {
23  template <typename P, typename S>
24  class Factory;
25  DD4HEP_PLUGIN_FACTORY_ARGS_4(long, dd4hep::Detector*, cms::DDParsingContext*, ns::xml_h*, dd4hep::SensitiveDetector*) {
26  return dd4hep::DDCMSDetElementFactory<P>::create(*a0, *a1, *a2, *a3);
27  }
28 } // namespace
29 
30 #define DECLARE_DDCMS_DETELEMENT(name, func) \
31  DD4HEP_OPEN_PLUGIN(dd4hep, ddcms_det_element_##name) { \
32  typedef DDCMSDetElementFactory<ddcms_det_element_##name> _IMP; \
33  template <> \
34  long _IMP::create(dd4hep::Detector& d, cms::DDParsingContext& c, xml::Handle_t e, dd4hep::SensitiveDetector& h) { \
35  return func(d, c, e, h); \
36  } \
37  DD4HEP_PLUGINSVC_FACTORY(ddcms_det_element_##name, \
38  name, \
39  long(dd4hep::Detector*, cms::DDParsingContext*, ns::xml_h*, dd4hep::SensitiveDetector*), \
40  __LINE__) \
41  }
42 
43 #endif
static long create(dd4hep::Detector &detector, cms::DDParsingContext &context, dd4hep::xml::Handle_t element, dd4hep::SensitiveDetector &sensitive)