Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:20:46

0001 #include <string>
0002 
0003 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ParameterSet/interface/Registry.h"
0006 #include "HLTrigger/Timer/interface/EDMModuleType.h"
0007 
0008 namespace edm {
0009 
0010   EDMModuleType edmModuleTypeEnum(edm::ModuleDescription const& module) {
0011     auto const& registry = *edm::pset::Registry::instance();
0012     auto const& pset = *registry.getMapped(module.parameterSetID());
0013 
0014     if (not pset.existsAs<std::string>("@module_edm_type"))
0015       return EDMModuleType::kUnknown;
0016 
0017     std::string const& t = pset.getParameter<std::string>("@module_edm_type");
0018     for (EDMModuleType v : {EDMModuleType::kSource,
0019                             EDMModuleType::kESSource,
0020                             EDMModuleType::kESProducer,
0021                             EDMModuleType::kEDAnalyzer,
0022                             EDMModuleType::kEDProducer,
0023                             EDMModuleType::kEDFilter,
0024                             EDMModuleType::kOutputModule}) {
0025       if (t == module_type_desc[static_cast<std::underlying_type_t<EDMModuleType>>(v)])
0026         return v;
0027     }
0028     return EDMModuleType::kUnknown;
0029   }
0030 
0031   const char* edmModuleType(edm::ModuleDescription const& module) {
0032     return module_type_desc[static_cast<std::underlying_type_t<EDMModuleType>>(edmModuleTypeEnum(module))];
0033   }
0034 
0035 }  // namespace edm