Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:14

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 
0014 // Framework include files
0015 #include <DD4hep/Printout.h>
0016 #include <DD4hep/Primitives.h>
0017 #include <DD4hep/Plugins.h>
0018 #include <DDDigi/DigiKernel.h>
0019 #include <DDDigi/DigiAction.h>
0020 #include <DDDigi/DigiPlugins.h>
0021 
0022 static inline dd4hep::ComponentCast* component(void* p) { return (dd4hep::ComponentCast*)p; }
0023 
0024 void* dd4hep::digi::create_action(const std::string& factory,
0025                   const dd4hep::digi::DigiKernel& kernel,
0026                   const std::string& arg, void* (*cast)(void*))   {
0027   void* object = PluginService::Create<DigiAction*>(factory, &kernel, arg);
0028   if ( !object ) {
0029     PluginDebug dbg;
0030     object = PluginService::Create<DigiAction*>(factory, &kernel, arg);
0031     if ( !object )  {
0032       except("createPlugin","dd4hep-plugins: Failed to locate plugin %s. \n%s.",
0033          factory.c_str(), dbg.missingFactory(factory).c_str());
0034     }
0035   }
0036   if ( cast )   {
0037     void* obj = cast(object);
0038     if ( obj ) return obj;
0039     ComponentCast* c = component(object);
0040     invalidHandleAssignmentError(typeid(cast),typeid(*c));
0041   }
0042   return object;
0043 }