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> class DDCMSDetElementFactory : public dd4hep::PluginFactoryBase {
13  public:
14  static long create( dd4hep::Detector& detector,
15  cms::DDParsingContext& context,
16  dd4hep::xml::Handle_t element,
17  dd4hep::SensitiveDetector& sensitive );
18  };
19 }
20 
21 namespace {
22  template <typename P, typename S> class Factory;
23  DD4HEP_PLUGIN_FACTORY_ARGS_4( long, dd4hep::Detector*,
24  cms::DDParsingContext*, ns::xml_h*,
25  dd4hep::SensitiveDetector* )
26  {
27  return dd4hep::DDCMSDetElementFactory<P>::create( *a0, *a1, *a2, *a3 );
28  }
29 }
30 
31 #define DECLARE_DDCMS_DETELEMENT(name,func) \
32  DD4HEP_OPEN_PLUGIN(dd4hep,ddcms_det_element_##name) { \
33  typedef DDCMSDetElementFactory< ddcms_det_element_##name > _IMP; \
34  template <> long \
35  _IMP::create(dd4hep::Detector& d, \
36  cms::DDParsingContext& c, \
37  xml::Handle_t e, \
38  dd4hep::SensitiveDetector& h) \
39  { return func(d,c,e,h); } \
40  DD4HEP_PLUGINSVC_FACTORY(ddcms_det_element_##name,name, \
41  long(dd4hep::Detector*,cms::DDParsingContext*, \
42  ns::xml_h*,dd4hep::SensitiveDetector*),__LINE__) }
43 
44 #endif
static long create(dd4hep::Detector &detector, cms::DDParsingContext &context, dd4hep::xml::Handle_t element, dd4hep::SensitiveDetector &sensitive)