Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:05

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DD4HEP_DDDIGI_DIGIEDM4HEPINPUT_H
0014 #define DD4HEP_DDDIGI_DIGIEDM4HEPINPUT_H
0015 
0016 // Framework include files
0017 #include <DDDigi/DigiInputAction.h>
0018 #include <DDDigi/DigiData.h>
0019 
0020 /// Forward declarations
0021 namespace edm4hep  {
0022   class EventHeaderCollection;
0023   class MCParticleCollection;
0024 }
0025 namespace podio    {
0026   class CollectionBase;
0027   class Frame;
0028 }
0029 
0030 /// Namespace for the AIDA detector description toolkit
0031 namespace dd4hep {
0032 
0033   /// Namespace for the Digitization part of the AIDA detector description toolkit
0034   namespace digi {
0035 
0036     /// Forward declarations
0037     class DataSegment;
0038     class DataContext;
0039 
0040     /// EDM4HEP Digi input reader
0041     /**
0042      *
0043      *  \author  M.Frank
0044      *  \version 1.0
0045      *  \ingroup DD4HEP_DIGITIZATION
0046      */
0047     class DigiEdm4hepInput : public DigiInputAction    {
0048     public:
0049       static constexpr double epsilon = std::numeric_limits<double>::epsilon();
0050 
0051       /// Forward declarations
0052       class internals_t;
0053       class work_t;
0054       class source_t;
0055       class collection_t;
0056       using podio_coll_t = const podio::CollectionBase;
0057       using descriptor_t = std::pair<const Key, collection_t>;
0058 
0059       /// Reference to internal data
0060       std::unique_ptr<internals_t> internals;
0061       /// Type of tracker hit container
0062       std::string m_trackerHitType { };
0063       /// Type of calorimenter hit container
0064       std::string m_caloHitType    { };
0065       /// Type of particles container
0066       std::string m_particlesType  { };
0067       /// Type of event header container
0068       std::string m_evtHeaderType  { };
0069       
0070     public:
0071       /// Initializing constructor
0072       DigiEdm4hepInput(const DigiKernel& krnl, const std::string& nam);
0073 
0074       /// Generic conversion function for hits
0075       template <typename HIT_TYPE, typename EDM4HEP_COLLECTION_TYPE>
0076       void hits_from_edm4hep(DigiContext&                   context,
0077                              DataSegment&                   segment,
0078                              Key::mask_type                 mask,
0079                              const std::string&             nam,
0080                              const EDM4HEP_COLLECTION_TYPE* collection)   const;
0081 
0082       /// Generic conversion function for MC particles
0083       void parts_from_edm4hep(DigiContext&       context,
0084                               DataSegment&       segment,
0085                               int                mask,
0086                               const std::string& nam,
0087                               const edm4hep::MCParticleCollection* collection)   const;
0088 
0089       /// Generic conversion function for event parameter settings
0090       void params_from_edm4hep(DigiContext&        context,
0091                                DataSegment&        segment,
0092                                int                 mask,
0093                                const std::string&  nam,
0094                                const podio::Frame& frame,
0095                                const edm4hep::EventHeaderCollection* collection)   const;
0096 
0097       /// Callback to handle single branch
0098       virtual void operator()(DigiContext& context, work_t& work)  const;
0099 
0100       /// Event action callback
0101       virtual void execute(DigiContext& context)  const  override;
0102     };
0103   }    // End namespace digi
0104 }      // End namespace dd4hep
0105 #endif // DD4HEP_DDDIGI_DIGIEDM4HEPINPUT_H