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 
6 #include "DD4hep/Factories.h"
7 #include "DD4hep/Plugins.h"
8 
9 namespace dd4hep {
10 
11  class SensitiveDetector;
12 
13  template <typename T> 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 }
21 
22 namespace {
23  template <typename P, typename S> class Factory;
24  DD4HEP_PLUGIN_FACTORY_ARGS_4( long, dd4hep::Detector*,
25  cms::DDParsingContext*, ns::xml_h*,
26  dd4hep::SensitiveDetector* )
27  {
28  return dd4hep::DDCMSDetElementFactory<P>::create( *a0, *a1, *a2, *a3 );
29  }
30 }
31 
32 #define DECLARE_DDCMS_DETELEMENT(name,func) \
33  DD4HEP_OPEN_PLUGIN(dd4hep,ddcms_det_element_##name) { \
34  typedef DDCMSDetElementFactory< ddcms_det_element_##name > _IMP; \
35  template <> long \
36  _IMP::create(dd4hep::Detector& d, \
37  cms::DDParsingContext& c, \
38  xml::Handle_t e, \
39  dd4hep::SensitiveDetector& h) \
40  { return func(d,c,e,h); } \
41  DD4HEP_PLUGINSVC_FACTORY(ddcms_det_element_##name,name, \
42  long(dd4hep::Detector*,cms::DDParsingContext*, \
43  ns::xml_h*,dd4hep::SensitiveDetector*),__LINE__) }
44 
45 #endif
static long create(dd4hep::Detector &detector, cms::DDParsingContext &context, dd4hep::xml::Handle_t element, dd4hep::SensitiveDetector &sensitive)