Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:27

0001 #ifndef DETECTOR_DESCRIPTION_DD_PLUGINS_H
0002 #define DETECTOR_DESCRIPTION_DD_PLUGINS_H
0003 
0004 #include "DetectorDescription/DDCMS/interface/DDAlgoArguments.h"
0005 #include "DD4hep/Factories.h"
0006 #include "DD4hep/Plugins.h"
0007 
0008 namespace dd4hep {
0009 
0010   template <typename T>
0011   class DDCMSDetElementFactory : public dd4hep::PluginFactoryBase {
0012   public:
0013     static long create(dd4hep::Detector& detector, cms::DDParsingContext& context, dd4hep::xml::Handle_t element);
0014   };
0015 }  // namespace dd4hep
0016 
0017 namespace {
0018   template <typename P, typename S>
0019   class Factory;
0020   DD4HEP_PLUGIN_FACTORY_ARGS_3(long, dd4hep::Detector*, cms::DDParsingContext*, ns::xml_h*) {
0021     return dd4hep::DDCMSDetElementFactory<P>::create(*a0, *a1, *a2);
0022   }
0023 }  // namespace
0024 
0025 #define DECLARE_DDCMS_DETELEMENT(name, func)                                                                   \
0026   DD4HEP_OPEN_PLUGIN(dd4hep, ddcms_det_element_##name) {                                                       \
0027     typedef DDCMSDetElementFactory<ddcms_det_element_##name> _IMP;                                             \
0028     template <>                                                                                                \
0029     long _IMP::create(dd4hep::Detector& d, cms::DDParsingContext& c, xml::Handle_t e) {                        \
0030       return func(d, c, e);                                                                                    \
0031     }                                                                                                          \
0032     DD4HEP_PLUGINSVC_FACTORY(                                                                                  \
0033         ddcms_det_element_##name, name, long(dd4hep::Detector*, cms::DDParsingContext*, ns::xml_h*), __LINE__) \
0034   }
0035 
0036 #endif