Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:40

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 // Specialized generic detector constructor
0015 // 
0016 //==========================================================================
0017 #ifndef DD4HEP_DETNOMINALCREATOR_H
0018 #define DD4HEP_DETNOMINALCREATOR_H
0019 
0020 // Framework include files
0021 #include <DD4hep/DetElement.h>
0022 
0023 namespace dd4hep {
0024   
0025   /// DD4hep DetElement creator for the CMS geometry.
0026   /*  Heuristically assign DetElement structures to the sensitive volume pathes.
0027    *
0028    *  \author  M.Frank
0029    *  \version 1.0
0030    *  \ingroup DD4HEP_CORE
0031    */
0032   class DetNominalCreator  {
0033     Detector& description;
0034   public:
0035     DetNominalCreator(Detector& d) : description(d) {}
0036     DetNominalCreator(const DetNominalCreator& c) : description(c.description) {}
0037     virtual ~DetNominalCreator() = default;
0038     int operator()(DetElement de, int /* level */)  const  {
0039       if ( de.nominal().isValid() )  return 1;
0040       return 0;
0041     }
0042   };
0043 }
0044 #endif   /* DD4HEP_DETNOMINALCREATOR_H  */
0045 
0046 // Framework include files
0047 #include <DD4hep/DetectorProcessor.h>
0048 #include <DD4hep/DetFactoryHelper.h>
0049 
0050 // C/C++ include files
0051 
0052 
0053 using namespace std;
0054 using namespace dd4hep;
0055 
0056 static void* create_object(Detector& description, int argc, char** argv)   {
0057   for(int i = 0; i < argc && argv[i]; ++i)  {  }
0058   shared_ptr<DetNominalCreator> obj(new DetNominalCreator(description));
0059   DetectorProcessorShared<DetNominalCreator>* proc =
0060     new DetectorProcessorShared<DetNominalCreator>(obj);
0061   return (void*)proc;
0062 }
0063 
0064 // first argument is the type from the xml file
0065 DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_DetNominalCreator,create_object)