CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/L1TriggerConfig/L1GtConfigProducers/src/L1GtRsObjectKeysOnlineProd.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtRsObjectKeysOnlineProd.h"
00019 
00020 // system include files
00021 
00022 // user include files
00023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00024 
00025 // constructor
00026 L1GtRsObjectKeysOnlineProd::L1GtRsObjectKeysOnlineProd(const edm::ParameterSet& parSet) :
00027     L1ObjectKeysOnlineProdBase(parSet),
00028     m_partitionNumber(
00029             parSet.getParameter<int> ("PartitionNumber")),
00030     m_enableL1GtPrescaleFactorsAlgoTrig(
00031             parSet.getParameter<bool> ("EnableL1GtPrescaleFactorsAlgoTrig")),
00032     m_enableL1GtPrescaleFactorsTechTrig(
00033             parSet.getParameter<bool> ("EnableL1GtPrescaleFactorsTechTrig")),
00034     m_enableL1GtTriggerMaskAlgoTrig(
00035             parSet.getParameter<bool> ("EnableL1GtTriggerMaskAlgoTrig")),
00036     m_enableL1GtTriggerMaskTechTrig(
00037             parSet.getParameter<bool> ("EnableL1GtTriggerMaskTechTrig")),
00038     m_enableL1GtTriggerMaskVetoTechTrig(
00039             parSet.getParameter<bool> ("EnableL1GtTriggerMaskVetoTechTrig")) {
00040 
00041     // empty
00042 }
00043 
00044 // destructor
00045 L1GtRsObjectKeysOnlineProd::~L1GtRsObjectKeysOnlineProd() {
00046 
00047     // empty
00048 
00049 }
00050 
00051 // private methods
00052 std::string L1GtRsObjectKeysOnlineProd::keyL1GtPrescaleFactorsAlgoTrig(const std::string& gtSchema) {
00053 
00054     std::string objectKey;
00055 
00056     // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
00057     //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber
00058     l1t::OMDSReader::QueryResults objectKeyResults =
00059             m_omdsReader.basicQueryGenericKey<int> ("GT_RUN_SETTINGS_FK",
00060                     gtSchema, "GT_RUN_SETTINGS_KEY_CURRENT",
00061                     "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
00062                     m_omdsReader.singleAttribute(m_partitionNumber), "");
00063 
00064     // check if query was successful
00065     if (objectKeyResults.queryFailed()) {
00066         edm::LogError("L1-O2O")
00067                 << "Problem with key for record L1GtPrescaleFactorsAlgoTrigRcd: query failed ";
00068         return objectKey;
00069     } else if ( ( objectKeyResults.numberRows() != 1 )) {
00070         edm::LogError("L1-O2O") << "Problem with key for record L1GtPrescaleFactorsAlgoTrigRcd: "
00071                 << ( objectKeyResults.numberRows() ) << " rows were returned";
00072         return objectKey;
00073     }
00074 
00075     objectKeyResults.fillVariable(objectKey);
00076 
00077     //
00078     if (edm::isDebugEnabled()) {
00079         LogTrace("L1GtRsObjectKeysOnlineProd")
00080                 << "\nThe following GT_RUN_SETTINGS_FK key "
00081                 << "was found for L1GtPrescaleFactorsAlgoTrigRcd: \n  "
00082                 << objectKey << "\nfor partition " << m_partitionNumber << "\n"
00083                 << std::endl;
00084     }
00085 
00086     return objectKey;
00087 }
00088 
00089 
00090 std::string L1GtRsObjectKeysOnlineProd::keyL1GtPrescaleFactorsTechTrig(const std::string& gtSchema) {
00091 
00092     std::string objectKey;
00093 
00094     // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
00095     //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber
00096     l1t::OMDSReader::QueryResults objectKeyResults =
00097             m_omdsReader.basicQueryGenericKey<int> ("GT_RUN_SETTINGS_FK",
00098                     gtSchema, "GT_RUN_SETTINGS_KEY_CURRENT",
00099                     "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
00100                     m_omdsReader.singleAttribute(m_partitionNumber), "");
00101 
00102     // check if query was successful
00103     if (objectKeyResults.queryFailed()) {
00104         edm::LogError("L1-O2O")
00105                 << "Problem with key for record L1GtPrescaleFactorsTechTrigRcd: query failed ";
00106         return objectKey;
00107     } else if ( ( objectKeyResults.numberRows() != 1 )) {
00108         edm::LogError("L1-O2O") << "Problem with key for record L1GtPrescaleFactorsTechTrigRcd: "
00109                 << ( objectKeyResults.numberRows() ) << " rows were returned";
00110         return objectKey;
00111     }
00112 
00113     objectKeyResults.fillVariable(objectKey);
00114 
00115     //
00116     if (edm::isDebugEnabled()) {
00117         LogTrace("L1GtRsObjectKeysOnlineProd")
00118                 << "\nThe following GT_RUN_SETTINGS_FK key "
00119                 << "was found for L1GtPrescaleFactorsTechTrigRcd: \n  "
00120                 << objectKey << "\nfor partition " << m_partitionNumber << "\n"
00121                 << std::endl;
00122     }
00123 
00124     return objectKey;
00125 }
00126 
00127 
00128 std::string L1GtRsObjectKeysOnlineProd::keyL1GtTriggerMaskAlgoTrig(const std::string& gtSchema) {
00129 
00130     std::string objectKey;
00131 
00132     // SELECT FINOR_ALGO_FK FROM CMS_GT.GT_RUN_SETTINGS
00133     //        WHERE GT_RUN_SETTINGS.ID = (
00134     // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
00135     //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber)
00136     l1t::OMDSReader::QueryResults objectKeyResults = m_omdsReader.basicQuery(
00137             "FINOR_ALGO_FK", gtSchema, "GT_RUN_SETTINGS", "GT_RUN_SETTINGS.ID",
00138             m_omdsReader.basicQueryGenericKey<int> (
00139                     "GT_RUN_SETTINGS_FK", gtSchema, "GT_RUN_SETTINGS_KEY_CURRENT",
00140                     "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
00141                     m_omdsReader.singleAttribute(m_partitionNumber), ""));
00142 
00143     // check if query was successful
00144     if (objectKeyResults.queryFailed()) {
00145         edm::LogError("L1-O2O")
00146                 << "Problem with key for record L1GtTriggerMaskAlgoTrigRcd: query failed ";
00147         return objectKey;
00148     } else if ( ( objectKeyResults.numberRows() != 1 )) {
00149         edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskAlgoTrigRcd: "
00150                 << ( objectKeyResults.numberRows() ) << " rows were returned";
00151         return objectKey;
00152     }
00153 
00154     objectKeyResults.fillVariable(objectKey);
00155 
00156     //
00157     if (edm::isDebugEnabled()) {
00158         LogTrace("L1GtRsObjectKeysOnlineProd")
00159                 << "\nThe following key was found for L1GtTriggerMaskAlgoTrigRcd: \n  " << objectKey
00160                 << "\nfor partition " << m_partitionNumber << "\n" << std::endl;
00161     }
00162 
00163     return objectKey;
00164 }
00165 
00166 std::string L1GtRsObjectKeysOnlineProd::keyL1GtTriggerMaskTechTrig(const std::string& gtSchema) {
00167 
00168     std::string objectKey;
00169 
00170     // SELECT FINOR_TT_FK FROM CMS_GT.GT_RUN_SETTINGS
00171     //        WHERE GT_RUN_SETTINGS.ID = (
00172     // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
00173     //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber)
00174     l1t::OMDSReader::QueryResults objectKeyResults = m_omdsReader.basicQuery(
00175             "FINOR_TT_FK", gtSchema, "GT_RUN_SETTINGS", "GT_RUN_SETTINGS.ID",
00176             m_omdsReader.basicQueryGenericKey<int> (
00177                     "GT_RUN_SETTINGS_FK", gtSchema, "GT_RUN_SETTINGS_KEY_CURRENT",
00178                     "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
00179                     m_omdsReader.singleAttribute(m_partitionNumber), ""));
00180 
00181     // check if query was successful
00182     if (objectKeyResults.queryFailed()) {
00183         edm::LogError("L1-O2O")
00184                 << "Problem with key for record L1GtTriggerMaskTechTrigRcd: query failed ";
00185         return objectKey;
00186     } else if ( ( objectKeyResults.numberRows() != 1 )) {
00187         edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskTechTrigRcd: "
00188                 << ( objectKeyResults.numberRows() ) << " rows were returned";
00189         return objectKey;
00190     }
00191 
00192     objectKeyResults.fillVariable(objectKey);
00193 
00194     //
00195     if (edm::isDebugEnabled()) {
00196         LogTrace("L1GtRsObjectKeysOnlineProd")
00197                 << "\nThe following key was found for L1GtTriggerMaskTechTrigRcd: \n  " << objectKey
00198                 << "\nfor partition " << m_partitionNumber << "\n" << std::endl;
00199     }
00200 
00201     return objectKey;
00202 }
00203 
00204 std::string L1GtRsObjectKeysOnlineProd::keyL1GtTriggerMaskVetoTechTrig(const std::string& gtSchema) {
00205 
00206     std::string objectKey;
00207 
00208     // SELECT VETO_TT_FK FROM CMS_GT.GT_RUN_SETTINGS
00209     //        WHERE GT_RUN_SETTINGS.ID = (
00210     // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
00211     //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber)
00212     l1t::OMDSReader::QueryResults objectKeyResults = m_omdsReader.basicQuery(
00213             "VETO_TT_FK", gtSchema, "GT_RUN_SETTINGS", "GT_RUN_SETTINGS.ID",
00214             m_omdsReader.basicQueryGenericKey<int> (
00215                     "GT_RUN_SETTINGS_FK", gtSchema, "GT_RUN_SETTINGS_KEY_CURRENT",
00216                     "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
00217                     m_omdsReader.singleAttribute(m_partitionNumber), ""));
00218 
00219     // check if query was successful
00220     if (objectKeyResults.queryFailed()) {
00221         edm::LogError("L1-O2O")
00222                 << "Problem with key for record L1GtTriggerMaskVetoTechTrigRcd: query failed ";
00223         return objectKey;
00224     } else if ( ( objectKeyResults.numberRows() != 1 )) {
00225         edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskVetoTechTrigRcd: "
00226                 << ( objectKeyResults.numberRows() ) << " rows were returned";
00227         return objectKey;
00228     }
00229 
00230     objectKeyResults.fillVariable(objectKey);
00231 
00232     //
00233     if (edm::isDebugEnabled()) {
00234         LogTrace("L1GtRsObjectKeysOnlineProd")
00235                 << "\nThe following key was found for L1GtTriggerMaskVetoTechTrigRcd: \n  "
00236                 << objectKey << "\nfor partition " << m_partitionNumber << "\n" << std::endl;
00237     }
00238 
00239     return objectKey;
00240 }
00241 
00242 // public methods
00243 void L1GtRsObjectKeysOnlineProd::fillObjectKeys(ReturnType pL1TriggerKey) {
00244 
00245     const std::string gtSchema = "CMS_GT";
00246 
00247     if (m_enableL1GtPrescaleFactorsAlgoTrig) {
00248         const std::string& objectKey = keyL1GtPrescaleFactorsAlgoTrig(gtSchema);
00249         if (!objectKey.empty()) {
00250             pL1TriggerKey->add(
00251                     "L1GtPrescaleFactorsAlgoTrigRcd", "L1GtPrescaleFactors", objectKey);
00252         }
00253     }
00254 
00255     if (m_enableL1GtPrescaleFactorsTechTrig) {
00256         const std::string& objectKey = keyL1GtPrescaleFactorsTechTrig(gtSchema);
00257         if (!objectKey.empty()) {
00258             pL1TriggerKey->add(
00259                     "L1GtPrescaleFactorsTechTrigRcd", "L1GtPrescaleFactors", objectKey);
00260         }
00261     }
00262 
00263     if (m_enableL1GtTriggerMaskAlgoTrig) {
00264         const std::string& objectKey = keyL1GtTriggerMaskAlgoTrig(gtSchema);
00265         if (!objectKey.empty()) {
00266             pL1TriggerKey->add("L1GtTriggerMaskAlgoTrigRcd", "L1GtTriggerMask", objectKey);
00267         }
00268     }
00269 
00270     if (m_enableL1GtTriggerMaskTechTrig) {
00271         const std::string& objectKey = keyL1GtTriggerMaskTechTrig(gtSchema);
00272         if (!objectKey.empty()) {
00273             pL1TriggerKey->add("L1GtTriggerMaskTechTrigRcd", "L1GtTriggerMask", objectKey);
00274         }
00275     }
00276 
00277     if (m_enableL1GtTriggerMaskVetoTechTrig) {
00278         const std::string& objectKey = keyL1GtTriggerMaskVetoTechTrig(gtSchema);
00279         if (!objectKey.empty()) {
00280             pL1TriggerKey->add(
00281                     "L1GtTriggerMaskVetoTechTrigRcd", "L1GtTriggerMask", objectKey);
00282         }
00283     }
00284 
00285 }
00286 
00287 DEFINE_FWK_EVENTSETUP_MODULE( L1GtRsObjectKeysOnlineProd);