Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "FWCore/Framework/interface/TriggerNamesService.h"
00009 #include "DataFormats/Common/interface/TriggerResults.h"
00010 #include "FWCore/ParameterSet/interface/Registry.h"
00011 #include "FWCore/Utilities/interface/ThreadSafeRegistry.h"
00012 #include "FWCore/Utilities/interface/Exception.h"
00013 #include "FWCore/Utilities/interface/EDMException.h"
00014 #include "FWCore/Utilities/interface/Algorithms.h"
00015
00016
00017 namespace edm {
00018 namespace service {
00019
00020 TriggerNamesService::TriggerNamesService(const ParameterSet& pset) {
00021
00022 trigger_pset_ =
00023 pset.getParameterSet("@trigger_paths");
00024
00025 trignames_ = trigger_pset_.getParameter<Strings>("@trigger_paths");
00026 end_names_ = pset.getParameter<Strings>("@end_paths");
00027
00028 ParameterSet defopts;
00029 ParameterSet const& opts =
00030 pset.getUntrackedParameterSet("options", defopts);
00031 wantSummary_ =
00032 opts.getUntrackedParameter("wantSummary", false);
00033
00034 process_name_ = pset.getParameter<std::string>("@process_name");
00035
00036 loadPosMap(trigpos_,trignames_);
00037 loadPosMap(end_pos_,end_names_);
00038
00039 const unsigned int n(trignames_.size());
00040 for(unsigned int i=0;i!=n;++i) {
00041 modulenames_.push_back(pset.getParameter<Strings>(trignames_[i]));
00042 }
00043 }
00044
00045 bool
00046 TriggerNamesService::getTrigPaths(TriggerResults const& triggerResults,
00047 Strings& trigPaths,
00048 bool& fromPSetRegistry) {
00049
00050
00051
00052 ParameterSet const* pset=0;
00053 pset::Registry* psetRegistry = pset::Registry::instance();
00054 if (0 != (pset=psetRegistry->getMapped(triggerResults.parameterSetID()))) {
00055
00056
00057
00058
00059
00060 Strings psetNames = pset->getParameterNamesForType<Strings>();
00061 std::string name("@trigger_paths");
00062 if (search_all(psetNames, name)) {
00063
00064 trigPaths = pset->getParameter<Strings>("@trigger_paths");
00065
00066
00067 if (trigPaths.size() != triggerResults.size()) {
00068 throw edm::Exception(edm::errors::Unknown)
00069 << "TriggerNamesService::getTrigPaths, Trigger names vector and\n"
00070 "TriggerResults are different sizes. This should be impossible,\n"
00071 "please send information to reproduce this problem to\n"
00072 "the edm developers.\n";
00073 }
00074
00075 fromPSetRegistry = true;
00076 return true;
00077 }
00078 }
00079
00080 fromPSetRegistry = false;
00081
00082
00083
00084
00085 if (triggerResults.size() == triggerResults.getTriggerNames().size()) {
00086 trigPaths = triggerResults.getTriggerNames();
00087 return true;
00088 }
00089
00090 return false;
00091 }
00092
00093 bool
00094 TriggerNamesService::getTrigPaths(TriggerResults const& triggerResults,
00095 Strings& trigPaths) {
00096 bool dummy;
00097 return getTrigPaths(triggerResults, trigPaths, dummy);
00098 }
00099 }
00100 }