![]() |
![]() |
00001 // -*- C++ -*- 00002 // 00003 // Package: FWCore/Common 00004 // Class : LuminosityBlockBase 00005 // 00006 // Implementation: 00007 // <Notes on implementation> 00008 // 00009 // Original Author: Eric Vaandering 00010 // Created: Tue Jan 12 15:31:00 CDT 2010 00011 // 00012 00013 // system include files 00014 #include <vector> 00015 #include <map> 00016 00017 // user include files 00018 #include "FWCore/Common/interface/LuminosityBlockBase.h" 00019 //#include "FWCore/Common/interface/TriggerNames.h" 00020 //#include "DataFormats/Provenance/interface/ParameterSetID.h" 00021 //#include "DataFormats/Common/interface/TriggerResults.h" 00022 //#include "FWCore/Utilities/interface/Exception.h" 00023 //#include "FWCore/Utilities/interface/ThreadSafeRegistry.h" 00024 //#include "FWCore/ParameterSet/interface/ParameterSet.h" 00025 //#include "FWCore/ParameterSet/interface/Registry.h" 00026 00027 namespace edm 00028 { 00029 // typedef std::map<edm::ParameterSetID, edm::TriggerNames> TriggerNamesMap; 00030 // static TriggerNamesMap triggerNamesMap; 00031 // static TriggerNamesMap::const_iterator previousTriggerName; 00032 00033 LuminosityBlockBase::LuminosityBlockBase() 00034 { 00035 } 00036 00037 LuminosityBlockBase::~LuminosityBlockBase() 00038 { 00039 } 00040 00041 /* TriggerNames const* 00042 EventBase::triggerNames_(edm::TriggerResults const& triggerResults) { 00043 00044 // If the current and previous requests are for the same TriggerNames 00045 // then just return it. 00046 if (!triggerNamesMap.empty() && 00047 previousTriggerName->first == triggerResults.parameterSetID()) { 00048 return &previousTriggerName->second; 00049 } 00050 00051 // If TriggerNames was already created and cached here in the map, 00052 // then look it up and return that one 00053 TriggerNamesMap::const_iterator iter = 00054 triggerNamesMap.find(triggerResults.parameterSetID()); 00055 if (iter != triggerNamesMap.end()) { 00056 previousTriggerName = iter; 00057 return &iter->second; 00058 } 00059 00060 // Look for the parameter set containing the trigger names in the parameter 00061 // set registry using the ID from TriggerResults as the key used to find it. 00062 edm::ParameterSet pset; 00063 edm::pset::Registry* psetRegistry = edm::pset::Registry::instance(); 00064 if (psetRegistry->getMapped(triggerResults.parameterSetID(), 00065 pset)) { 00066 00067 if (pset.existsAs<std::vector<std::string> >("@trigger_paths", true)) { 00068 TriggerNames triggerNames(pset); 00069 00070 // This should never happen 00071 if (triggerNames.size() != triggerResults.size()) { 00072 throw cms::Exception("LogicError") 00073 << "edm::EventBase::triggerNames_ Encountered vector\n" 00074 "of trigger names and a TriggerResults object with\n" 00075 "different sizes. This should be impossible.\n" 00076 "Please send information to reproduce this problem to\n" 00077 "the edm developers.\n"; 00078 } 00079 00080 std::pair<TriggerNamesMap::iterator, bool> ret = 00081 triggerNamesMap.insert(std::pair<edm::ParameterSetID, edm::TriggerNames>(triggerResults.parameterSetID(), triggerNames)); 00082 previousTriggerName = ret.first; 00083 return &(ret.first->second); 00084 } 00085 } 00086 // For backward compatibility to very old data 00087 if (triggerResults.getTriggerNames().size() > 0U) { 00088 edm::ParameterSet fakePset; 00089 fakePset.addParameter<std::vector<std::string> >("@trigger_paths", triggerResults.getTriggerNames()); 00090 fakePset.registerIt(); 00091 TriggerNames triggerNames(fakePset); 00092 00093 // This should never happen 00094 if (triggerNames.size() != triggerResults.size()) { 00095 throw cms::Exception("LogicError") 00096 << "edm::EventBase::triggerNames_ Encountered vector\n" 00097 "of trigger names and a TriggerResults object with\n" 00098 "different sizes. This should be impossible.\n" 00099 "Please send information to reproduce this problem to\n" 00100 "the edm developers (2).\n"; 00101 } 00102 00103 std::pair<TriggerNamesMap::iterator, bool> ret = 00104 triggerNamesMap.insert(std::pair<edm::ParameterSetID, edm::TriggerNames>(fakePset.id(), triggerNames)); 00105 previousTriggerName = ret.first; 00106 return &(ret.first->second); 00107 } 00108 return 0; 00109 }*/ 00110 }