Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:21

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 DDDIGI_DIGIPLUGINS_H
0014 #define DDDIGI_DIGIPLUGINS_H
0015 
0016 /// Framework include files
0017 #include <DD4hep/Primitives.h>
0018 
0019 /// C/C++ include files
0020 #include <string>
0021 
0022 /// Namespace for the AIDA detector description toolkit
0023 namespace dd4hep {
0024 
0025   /// Namespace for the Digitization part of the AIDA detector description toolkit
0026   namespace digi {
0027 
0028     /// Forward declarations
0029     class DigiKernel;
0030 
0031     void* create_action(const std::string& factory,
0032             const DigiKernel& kernel,
0033             const std::string& arg,
0034             void* (*cast)(void*));
0035 
0036     /// Handler for factories of type: ConstructionFactory with casted return type
0037     template <typename T> T* createAction(const std::string& factory,
0038                       const DigiKernel& kernel,
0039                       const std::string& arg)
0040       {
0041     struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } };
0042     return (T*)create_action(factory, kernel, arg, __cast::cast);
0043       }
0044   }    // End namespace digi
0045 }      // End namespace dd4hep
0046 #endif // DDDIGI_DIGIPLUGINS_H