CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/L1TriggerConfig/L1GtConfigProducers/src/L1GtTscObjectKeysOnlineProd.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtTscObjectKeysOnlineProd.h"
00019 
00020 // system include files
00021 
00022 // user include files
00023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00024 
00025 // constructor
00026 L1GtTscObjectKeysOnlineProd::L1GtTscObjectKeysOnlineProd(const edm::ParameterSet& parSet) :
00027     L1ObjectKeysOnlineProdBase(parSet),
00028     m_enableL1GtParameters(
00029             parSet.getParameter<bool> ("EnableL1GtParameters")),
00030     m_enableL1GtTriggerMenu(
00031             parSet.getParameter<bool> ("EnableL1GtTriggerMenu")),
00032     m_enableL1GtPsbSetup(
00033             parSet.getParameter<bool> ("EnableL1GtPsbSetup")) {
00034 
00035     // empty
00036 
00037 }
00038 
00039 // destructor
00040 L1GtTscObjectKeysOnlineProd::~L1GtTscObjectKeysOnlineProd() {
00041 
00042     // empty
00043 
00044 }
00045 
00046 // private methods
00047 
00048 std::string L1GtTscObjectKeysOnlineProd::keyL1GtParameters(
00049         const std::string& subsystemKey, const std::string& gtSchema) {
00050 
00051     std::string objectKey;
00052 
00053     if (!subsystemKey.empty()) {
00054 
00055         // Execute SQL queries to get keys from OMDS.
00056 
00057         // SELECT GTFE_SETUP_FK FROM CMS_GT.GT_SETUP WHERE GT_SETUP.ID = MyKey
00058         l1t::OMDSReader::QueryResults objectKeyResults = m_omdsReader.basicQuery(
00059                 "GTFE_SETUP_FK", gtSchema, "GT_SETUP", "GT_SETUP.ID", m_omdsReader.singleAttribute(
00060                         subsystemKey));
00061 
00062         // check if query was successful
00063         if (objectKeyResults.queryFailed()) {
00064             edm::LogError("L1-O2O")
00065                     << "Problem with key for record L1GtParametersRcd: query failed ";
00066             return objectKey;
00067         } else if ( ( objectKeyResults.numberRows() != 1 )) {
00068             edm::LogError("L1-O2O") << "Problem with key for record L1GtParametersRcd: "
00069                     << ( objectKeyResults.numberRows() ) << " rows were returned";
00070             return objectKey;
00071         }
00072 
00073         objectKeyResults.fillVariable(objectKey);
00074     }
00075 
00076     return objectKey;
00077 }
00078 
00079 std::string L1GtTscObjectKeysOnlineProd::keyL1GtTriggerMenu(
00080         const std::string& subsystemKey, const std::string& gtSchema) {
00081 
00082     std::string objectKey;
00083 
00084     if (!subsystemKey.empty()) {
00085 
00086         // Execute SQL queries to get keys from OMDS.
00087 
00088         // SELECT L1T_MENU_FK FROM CMS_GT.GT_SETUP WHERE GT_SETUP.ID = MyKey
00089         l1t::OMDSReader::QueryResults objectKeyResults = m_omdsReader.basicQuery(
00090                 "L1T_MENU_FK", gtSchema, "GT_SETUP", "GT_SETUP.ID", m_omdsReader.singleAttribute(
00091                         subsystemKey));
00092 
00093         // check if query was successful
00094         if (objectKeyResults.queryFailed()) {
00095             edm::LogError("L1-O2O")
00096                     << "Problem with key for record L1GtTriggerMenuRcd: query failed ";
00097             return objectKey;
00098         } else if ( ( objectKeyResults.numberRows() != 1 )) {
00099             edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMenuRcd: "
00100                     << ( objectKeyResults.numberRows() ) << " rows were returned";
00101             return objectKey;
00102         }
00103 
00104         objectKeyResults.fillVariable(objectKey);
00105     }
00106 
00107     return objectKey;
00108 
00109 }
00110 
00111 std::string L1GtTscObjectKeysOnlineProd::keyL1GtPsbSetup(
00112         const std::string& subsystemKey, const std::string& gtSchema) {
00113 
00114     std::string objectKey;
00115 
00116     if (!subsystemKey.empty()) {
00117 
00118         // no need to query OMDS, one uses the GT_SETUP key to get the individual PSB keys.
00119         //     the L1GtPsbSetup key is GT_SETUP key
00120         objectKey = subsystemKey;
00121 
00122     }
00123 
00124     return objectKey;
00125 
00126 }
00127 
00128 // public methods
00129 void L1GtTscObjectKeysOnlineProd::fillObjectKeys(ReturnType pL1TriggerKey) {
00130 
00131     // kMYSUBSYSTEM = kCSCTF, kDTTF, kRPC, kGMT, kRCT, mkGCT, kGT, or kTSP0
00132     // subsystemKey = TRIGGERSUP_CONF.{CSCTF_KEY, DTTF_KEY, RPC_KEY, GMT_KEY, RCT_KEY, GCT_KEY, GT_KEY}
00133 
00134     std::string subsystemKey = pL1TriggerKey->subsystemKey(L1TriggerKey::kGT);
00135     const std::string gtSchema = "CMS_GT";
00136 
00137     //
00138     if (m_enableL1GtParameters) {
00139         const std::string& objectKey = keyL1GtParameters(subsystemKey, gtSchema);
00140         if (!objectKey.empty()) {
00141             pL1TriggerKey->add("L1GtParametersRcd", "L1GtParameters", objectKey);
00142         }
00143     }
00144 
00145     //
00146     if (m_enableL1GtTriggerMenu) {
00147         const std::string& objectKey = keyL1GtTriggerMenu(subsystemKey, gtSchema);
00148         if (!objectKey.empty()) {
00149             pL1TriggerKey->add("L1GtTriggerMenuRcd", "L1GtTriggerMenu", objectKey);
00150         }
00151     }
00152 
00153     //
00154     if (m_enableL1GtPsbSetup) {
00155         const std::string& objectKey = keyL1GtPsbSetup(subsystemKey, gtSchema);
00156         if (!objectKey.empty()) {
00157             pL1TriggerKey->add("L1GtPsbSetupRcd", "L1GtPsbSetup", objectKey);
00158         }
00159     }
00160 
00161 }
00162 
00163 DEFINE_FWK_EVENTSETUP_MODULE( L1GtTscObjectKeysOnlineProd);