14 #ifndef DDG4_GEANT4DATACONVERSION_H
15 #define DDG4_GEANT4DATACONVERSION_H
59 typedef std::map<const std::type_info*, Geant4Conversion*>
Converters;
71 #if defined(DDG4_MAKE_INSTANTIATIONS)
84 template <
typename OUTPUT,
typename ARGS>
86 : Geant4ConversionHelper()
90 template <
typename OUTPUT,
typename ARGS>
95 template <
typename OUTPUT,
typename ARGS>
99 static Converters s_converter;
103 template <
typename OUTPUT,
typename ARGS>
104 const Geant4Conversion<OUTPUT,ARGS>&
107 typename Converters::const_iterator i = conversions().find(&typ);
108 if ( i != conversions().end() ) {
109 return *((*i).second);
111 throw std::runtime_error(typeName(
typeid(self_t))+
112 ": No appropriate LCIO_OUTPUT conversion "
113 "mechanism known for tag:"+
123 template <
typename OUTPUT,
typename ARGS,
typename TAG>
124 class Geant4DataConversion :
public Geant4Conversion<OUTPUT,ARGS> {
128 typedef OUTPUT output_t;
129 typedef Geant4Conversion<output_t,arg_t> self_t;
130 Geant4DataConversion(
void*) : Geant4Conversion<OUTPUT,ARGS>()
132 this->self_t::conversions().emplace(&
typeid(TAG),
this);
135 virtual OUTPUT* operator()(
const ARGS& args)
const override;
141 #define GEANT4_CNAME(a,b) a ## _instance_ ## b
142 #define DECLARE_GEANT4_DATACONVERTER(output_type,args_type,tag,serial) \
143 dd4hep::sim::Geant4DataConversion<output_type,args_type,tag> GEANT4_CNAME(s_g4_data_cnv,serial) (0);
145 #define DECLARE_GEANT4_HITCONVERTER(output_type,args_type,tag) DECLARE_GEANT4_DATACONVERTER(output_type,args_type,tag,__LINE__)
149 #endif // DDG4_GEANT4DATACONVERSION_H