Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00025
00026 #include "CondTools/L1Trigger/plugins/L1SubsystemKeysOnlineProd.h"
00027
00028 #include "CondTools/L1Trigger/interface/Exception.h"
00029 #include "CondTools/L1Trigger/interface/DataWriter.h"
00030
00031 #include "CondFormats/L1TObjects/interface/L1TriggerKeyList.h"
00032 #include "CondFormats/DataRecord/interface/L1TriggerKeyListRcd.h"
00033
00034 #include "FWCore/Framework/interface/EventSetup.h"
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 L1SubsystemKeysOnlineProd::L1SubsystemKeysOnlineProd(const edm::ParameterSet& iConfig)
00052 : m_tscKey( iConfig.getParameter< std::string >( "tscKey" ) ),
00053 m_omdsReader(
00054 iConfig.getParameter< std::string >( "onlineDB" ),
00055 iConfig.getParameter< std::string >( "onlineAuthentication" ) ),
00056 m_forceGeneration( iConfig.getParameter< bool >( "forceGeneration" ) )
00057 {
00058
00059
00060 setWhatProduced(this, "SubsystemKeysOnly");
00061
00062
00063 }
00064
00065
00066 L1SubsystemKeysOnlineProd::~L1SubsystemKeysOnlineProd()
00067 {
00068
00069
00070
00071
00072 }
00073
00074
00075
00076
00077
00078
00079
00080 L1SubsystemKeysOnlineProd::ReturnType
00081 L1SubsystemKeysOnlineProd::produce(const L1TriggerKeyRcd& iRecord)
00082 {
00083 using namespace edm::es;
00084 boost::shared_ptr<L1TriggerKey> pL1TriggerKey ;
00085
00086
00087 L1TriggerKeyList keyList ;
00088 l1t::DataWriter dataWriter ;
00089 if( !dataWriter.fillLastTriggerKeyList( keyList ) )
00090 {
00091 edm::LogError( "L1-O2O" )
00092 << "Problem getting last L1TriggerKeyList" ;
00093 }
00094
00095
00096 if( keyList.token( m_tscKey ) == std::string() ||
00097 m_forceGeneration )
00098 {
00099
00100 pL1TriggerKey = boost::shared_ptr< L1TriggerKey >(
00101 new L1TriggerKey() ) ;
00102 pL1TriggerKey->setTSCKey( m_tscKey ) ;
00103
00104 edm::LogVerbatim( "L1-O2O" ) << "TSC KEY " << m_tscKey ;
00105
00106
00107
00108
00109 std::vector< std::string > queryStrings ;
00110 queryStrings.push_back( "CSCTF_KEY" ) ;
00111 queryStrings.push_back( "DTTF_KEY" ) ;
00112 queryStrings.push_back( "RPC_KEY" ) ;
00113 queryStrings.push_back( "GMT_KEY" ) ;
00114 queryStrings.push_back( "RCT_KEY" ) ;
00115 queryStrings.push_back( "GCT_KEY" ) ;
00116 queryStrings.push_back( "GT_KEY" ) ;
00117
00118
00119 l1t::OMDSReader::QueryResults subkeyResults =
00120 m_omdsReader.basicQuery( queryStrings,
00121 "CMS_TRG_L1_CONF",
00122 "TRIGGERSUP_CONF",
00123 "TRIGGERSUP_CONF.TS_KEY",
00124 m_omdsReader.singleAttribute( m_tscKey ) ) ;
00125
00126 if( subkeyResults.queryFailed() ||
00127 subkeyResults.numberRows() != 1 )
00128 {
00129 edm::LogError( "L1-O2O" ) << "Problem with subsystem keys." ;
00130 return pL1TriggerKey ;
00131 }
00132
00133 std::string csctfKey, dttfKey, rpcKey, gmtKey, rctKey, gctKey, gtKey ;
00134
00135 subkeyResults.fillVariable( "CSCTF_KEY", csctfKey ) ;
00136 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kCSCTF, csctfKey ) ;
00137 edm::LogVerbatim( "L1-O2O" ) << "CSCTF_KEY " << csctfKey ;
00138
00139 subkeyResults.fillVariable( "DTTF_KEY", dttfKey ) ;
00140 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kDTTF, dttfKey ) ;
00141 edm::LogVerbatim( "L1-O2O" ) << "DTTF_KEY " << dttfKey ;
00142
00143 subkeyResults.fillVariable( "RPC_KEY", rpcKey ) ;
00144 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kRPC, rpcKey ) ;
00145 edm::LogVerbatim( "L1-O2O" ) << "RPC_KEY " << rpcKey ;
00146
00147 subkeyResults.fillVariable( "GMT_KEY", gmtKey ) ;
00148 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kGMT, gmtKey ) ;
00149 edm::LogVerbatim( "L1-O2O" ) << "GMT_KEY " << gmtKey ;
00150
00151 subkeyResults.fillVariable( "RCT_KEY", rctKey ) ;
00152 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kRCT, rctKey ) ;
00153 edm::LogVerbatim( "L1-O2O" ) << "RCT_KEY " << rctKey ;
00154
00155 subkeyResults.fillVariable( "GCT_KEY", gctKey ) ;
00156 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kGCT, gctKey ) ;
00157 edm::LogVerbatim( "L1-O2O" ) << "GCT_KEY " << gctKey ;
00158
00159 subkeyResults.fillVariable( "GT_KEY", gtKey ) ;
00160 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kGT, gtKey ) ;
00161 edm::LogVerbatim( "L1-O2O" ) << "GT_KEY " << gtKey ;
00162
00163
00164 std::string tsp0Key ;
00165 pL1TriggerKey->setSubsystemKey( L1TriggerKey::kTSP0, tsp0Key ) ;
00166 edm::LogVerbatim( "L1-O2O" ) << "TSP0_KEY " << tsp0Key ;
00167 }
00168 else
00169 {
00170 throw l1t::DataAlreadyPresentException(
00171 "L1TriggerKey for TSC key " + m_tscKey + " already in CondDB." ) ;
00172 }
00173
00174 return pL1TriggerKey ;
00175 }
00176
00177
00178