File indexing completed on 2025-01-18 09:14:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDDIGI_DIGIIO_H
0014 #define DDDIGI_DIGIIO_H
0015
0016
0017 #include <DD4hep/Printout.h>
0018 #include <DD4hep/DD4hepUnits.h>
0019 #include <DDDigi/DigiData.h>
0020
0021
0022 #include <any>
0023 #include <array>
0024 #include <stdexcept>
0025
0026
0027 namespace dd4hep {
0028
0029
0030 namespace sim {
0031
0032 class Geant4Particle;
0033 }
0034
0035
0036 namespace digi {
0037
0038
0039 template <typename T> union input_data {
0040
0041 const void* m_raw;
0042
0043 std::vector<T*>* m_data;
0044
0045
0046 input_data(const void* p) { this->m_raw = p; }
0047
0048 std::vector<T*>& get() {
0049 if ( this->m_data ) return *(this->m_data);
0050 throw std::runtime_error("input_data: Invalid data!");
0051 }
0052
0053 void clear() { if ( this->m_data ) this->m_data->clear(); }
0054
0055 std::size_t size() { return (this->m_data) ? this->m_data->size() : 0UL; }
0056 };
0057
0058
0059
0060
0061
0062
0063
0064
0065 template <typename T> struct data_io {
0066 public:
0067
0068 data_io() = default;
0069
0070 ~data_io() = default;
0071
0072 template <typename FIRST, typename SECOND> static
0073 void _to_edm4hep(const FIRST& first, SECOND second);
0074
0075 template <typename FIRST, typename SECOND> static
0076 void _to_edm4hep(const FIRST& first, SECOND& second, int hit_type);
0077
0078 template <typename FIRST, typename SECOND, typename THIRD> static
0079 void _to_edm4hep(const FIRST& first, const SECOND& second, THIRD& third, int hit_type);
0080
0081 template <typename FIRST, typename SECOND, typename THIRD> static
0082 void _to_digi(FIRST first, const SECOND& second, THIRD& third);
0083
0084 template <typename FIRST, typename SECOND, typename PREDICATE> static
0085 void _to_digi_if(const FIRST& first, SECOND& second, const PREDICATE& pred);
0086 };
0087
0088
0089 struct ddg4_input;
0090 struct digi_input;
0091 struct edm4hep_input;
0092 }
0093 }
0094 #endif