Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:09

0001 /**
0002  * \class L1GtRsObjectKeysOnlineProd
0003  *
0004  *
0005  * Description: online producer for L1 GT record keys from RUN SETTINGS.
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *
0010  * \author: Vasile Mihai Ghete - HEPHY Vienna
0011  *
0012  *
0013  */
0014 
0015 // this class header
0016 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtRsObjectKeysOnlineProd.h"
0017 
0018 // system include files
0019 
0020 // user include files
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 
0023 // constructor
0024 L1GtRsObjectKeysOnlineProd::L1GtRsObjectKeysOnlineProd(const edm::ParameterSet& parSet)
0025     : L1ObjectKeysOnlineProdBase(parSet),
0026       m_partitionNumber(parSet.getParameter<int>("PartitionNumber")),
0027       m_enableL1GtPrescaleFactorsAlgoTrig(parSet.getParameter<bool>("EnableL1GtPrescaleFactorsAlgoTrig")),
0028       m_enableL1GtPrescaleFactorsTechTrig(parSet.getParameter<bool>("EnableL1GtPrescaleFactorsTechTrig")),
0029       m_enableL1GtTriggerMaskAlgoTrig(parSet.getParameter<bool>("EnableL1GtTriggerMaskAlgoTrig")),
0030       m_enableL1GtTriggerMaskTechTrig(parSet.getParameter<bool>("EnableL1GtTriggerMaskTechTrig")),
0031       m_enableL1GtTriggerMaskVetoTechTrig(parSet.getParameter<bool>("EnableL1GtTriggerMaskVetoTechTrig")) {
0032   // empty
0033 }
0034 
0035 // destructor
0036 L1GtRsObjectKeysOnlineProd::~L1GtRsObjectKeysOnlineProd() {
0037   // empty
0038 }
0039 
0040 // private methods
0041 std::string L1GtRsObjectKeysOnlineProd::keyL1GtPrescaleFactorsAlgoTrig(const std::string& gtSchema) {
0042   std::string objectKey;
0043 
0044   // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
0045   //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber
0046   l1t::OMDSReader::QueryResults objectKeyResults =
0047       m_omdsReader.basicQueryGenericKey<int>("GT_RUN_SETTINGS_FK",
0048                                              gtSchema,
0049                                              "GT_RUN_SETTINGS_KEY_CURRENT",
0050                                              "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
0051                                              m_omdsReader.singleAttribute(m_partitionNumber),
0052                                              "");
0053 
0054   // check if query was successful
0055   if (objectKeyResults.queryFailed()) {
0056     edm::LogError("L1-O2O") << "Problem with key for record L1GtPrescaleFactorsAlgoTrigRcd: query failed ";
0057     return objectKey;
0058   } else if ((objectKeyResults.numberRows() != 1)) {
0059     edm::LogError("L1-O2O") << "Problem with key for record L1GtPrescaleFactorsAlgoTrigRcd: "
0060                             << (objectKeyResults.numberRows()) << " rows were returned";
0061     return objectKey;
0062   }
0063 
0064   objectKeyResults.fillVariable(objectKey);
0065 
0066   //
0067   if (edm::isDebugEnabled()) {
0068     LogTrace("L1GtRsObjectKeysOnlineProd") << "\nThe following GT_RUN_SETTINGS_FK key "
0069                                            << "was found for L1GtPrescaleFactorsAlgoTrigRcd: \n  " << objectKey
0070                                            << "\nfor partition " << m_partitionNumber << "\n"
0071                                            << std::endl;
0072   }
0073 
0074   return objectKey;
0075 }
0076 
0077 std::string L1GtRsObjectKeysOnlineProd::keyL1GtPrescaleFactorsTechTrig(const std::string& gtSchema) {
0078   std::string objectKey;
0079 
0080   // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
0081   //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber
0082   l1t::OMDSReader::QueryResults objectKeyResults =
0083       m_omdsReader.basicQueryGenericKey<int>("GT_RUN_SETTINGS_FK",
0084                                              gtSchema,
0085                                              "GT_RUN_SETTINGS_KEY_CURRENT",
0086                                              "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
0087                                              m_omdsReader.singleAttribute(m_partitionNumber),
0088                                              "");
0089 
0090   // check if query was successful
0091   if (objectKeyResults.queryFailed()) {
0092     edm::LogError("L1-O2O") << "Problem with key for record L1GtPrescaleFactorsTechTrigRcd: query failed ";
0093     return objectKey;
0094   } else if ((objectKeyResults.numberRows() != 1)) {
0095     edm::LogError("L1-O2O") << "Problem with key for record L1GtPrescaleFactorsTechTrigRcd: "
0096                             << (objectKeyResults.numberRows()) << " rows were returned";
0097     return objectKey;
0098   }
0099 
0100   objectKeyResults.fillVariable(objectKey);
0101 
0102   //
0103   if (edm::isDebugEnabled()) {
0104     LogTrace("L1GtRsObjectKeysOnlineProd") << "\nThe following GT_RUN_SETTINGS_FK key "
0105                                            << "was found for L1GtPrescaleFactorsTechTrigRcd: \n  " << objectKey
0106                                            << "\nfor partition " << m_partitionNumber << "\n"
0107                                            << std::endl;
0108   }
0109 
0110   return objectKey;
0111 }
0112 
0113 std::string L1GtRsObjectKeysOnlineProd::keyL1GtTriggerMaskAlgoTrig(const std::string& gtSchema) {
0114   std::string objectKey;
0115 
0116   // SELECT FINOR_ALGO_FK FROM CMS_GT.GT_RUN_SETTINGS
0117   //        WHERE GT_RUN_SETTINGS.ID = (
0118   // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
0119   //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber)
0120   l1t::OMDSReader::QueryResults objectKeyResults =
0121       m_omdsReader.basicQuery("FINOR_ALGO_FK",
0122                               gtSchema,
0123                               "GT_RUN_SETTINGS",
0124                               "GT_RUN_SETTINGS.ID",
0125                               m_omdsReader.basicQueryGenericKey<int>("GT_RUN_SETTINGS_FK",
0126                                                                      gtSchema,
0127                                                                      "GT_RUN_SETTINGS_KEY_CURRENT",
0128                                                                      "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
0129                                                                      m_omdsReader.singleAttribute(m_partitionNumber),
0130                                                                      ""));
0131 
0132   // check if query was successful
0133   if (objectKeyResults.queryFailed()) {
0134     edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskAlgoTrigRcd: query failed ";
0135     return objectKey;
0136   } else if ((objectKeyResults.numberRows() != 1)) {
0137     edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskAlgoTrigRcd: "
0138                             << (objectKeyResults.numberRows()) << " rows were returned";
0139     return objectKey;
0140   }
0141 
0142   objectKeyResults.fillVariable(objectKey);
0143 
0144   //
0145   if (edm::isDebugEnabled()) {
0146     LogTrace("L1GtRsObjectKeysOnlineProd") << "\nThe following key was found for L1GtTriggerMaskAlgoTrigRcd: \n  "
0147                                            << objectKey << "\nfor partition " << m_partitionNumber << "\n"
0148                                            << std::endl;
0149   }
0150 
0151   return objectKey;
0152 }
0153 
0154 std::string L1GtRsObjectKeysOnlineProd::keyL1GtTriggerMaskTechTrig(const std::string& gtSchema) {
0155   std::string objectKey;
0156 
0157   // SELECT FINOR_TT_FK FROM CMS_GT.GT_RUN_SETTINGS
0158   //        WHERE GT_RUN_SETTINGS.ID = (
0159   // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
0160   //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber)
0161   l1t::OMDSReader::QueryResults objectKeyResults =
0162       m_omdsReader.basicQuery("FINOR_TT_FK",
0163                               gtSchema,
0164                               "GT_RUN_SETTINGS",
0165                               "GT_RUN_SETTINGS.ID",
0166                               m_omdsReader.basicQueryGenericKey<int>("GT_RUN_SETTINGS_FK",
0167                                                                      gtSchema,
0168                                                                      "GT_RUN_SETTINGS_KEY_CURRENT",
0169                                                                      "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
0170                                                                      m_omdsReader.singleAttribute(m_partitionNumber),
0171                                                                      ""));
0172 
0173   // check if query was successful
0174   if (objectKeyResults.queryFailed()) {
0175     edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskTechTrigRcd: query failed ";
0176     return objectKey;
0177   } else if ((objectKeyResults.numberRows() != 1)) {
0178     edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskTechTrigRcd: "
0179                             << (objectKeyResults.numberRows()) << " rows were returned";
0180     return objectKey;
0181   }
0182 
0183   objectKeyResults.fillVariable(objectKey);
0184 
0185   //
0186   if (edm::isDebugEnabled()) {
0187     LogTrace("L1GtRsObjectKeysOnlineProd") << "\nThe following key was found for L1GtTriggerMaskTechTrigRcd: \n  "
0188                                            << objectKey << "\nfor partition " << m_partitionNumber << "\n"
0189                                            << std::endl;
0190   }
0191 
0192   return objectKey;
0193 }
0194 
0195 std::string L1GtRsObjectKeysOnlineProd::keyL1GtTriggerMaskVetoTechTrig(const std::string& gtSchema) {
0196   std::string objectKey;
0197 
0198   // SELECT VETO_TT_FK FROM CMS_GT.GT_RUN_SETTINGS
0199   //        WHERE GT_RUN_SETTINGS.ID = (
0200   // SELECT GT_RUN_SETTINGS_FK FROM CMS_GT.GT_RUN_SETTINGS_KEY_CURRENT
0201   //        WHERE GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER = m_partitionNumber)
0202   l1t::OMDSReader::QueryResults objectKeyResults =
0203       m_omdsReader.basicQuery("VETO_TT_FK",
0204                               gtSchema,
0205                               "GT_RUN_SETTINGS",
0206                               "GT_RUN_SETTINGS.ID",
0207                               m_omdsReader.basicQueryGenericKey<int>("GT_RUN_SETTINGS_FK",
0208                                                                      gtSchema,
0209                                                                      "GT_RUN_SETTINGS_KEY_CURRENT",
0210                                                                      "GT_RUN_SETTINGS_KEY_CURRENT.GT_PARTITION_NUMBER",
0211                                                                      m_omdsReader.singleAttribute(m_partitionNumber),
0212                                                                      ""));
0213 
0214   // check if query was successful
0215   if (objectKeyResults.queryFailed()) {
0216     edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskVetoTechTrigRcd: query failed ";
0217     return objectKey;
0218   } else if ((objectKeyResults.numberRows() != 1)) {
0219     edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMaskVetoTechTrigRcd: "
0220                             << (objectKeyResults.numberRows()) << " rows were returned";
0221     return objectKey;
0222   }
0223 
0224   objectKeyResults.fillVariable(objectKey);
0225 
0226   //
0227   if (edm::isDebugEnabled()) {
0228     LogTrace("L1GtRsObjectKeysOnlineProd") << "\nThe following key was found for L1GtTriggerMaskVetoTechTrigRcd: \n  "
0229                                            << objectKey << "\nfor partition " << m_partitionNumber << "\n"
0230                                            << std::endl;
0231   }
0232 
0233   return objectKey;
0234 }
0235 
0236 // public methods
0237 void L1GtRsObjectKeysOnlineProd::fillObjectKeys(FillType pL1TriggerKey) {
0238   const std::string gtSchema = "CMS_GT";
0239 
0240   if (m_enableL1GtPrescaleFactorsAlgoTrig) {
0241     const std::string& objectKey = keyL1GtPrescaleFactorsAlgoTrig(gtSchema);
0242     if (!objectKey.empty()) {
0243       pL1TriggerKey->add("L1GtPrescaleFactorsAlgoTrigRcd", "L1GtPrescaleFactors", objectKey);
0244     }
0245   }
0246 
0247   if (m_enableL1GtPrescaleFactorsTechTrig) {
0248     const std::string& objectKey = keyL1GtPrescaleFactorsTechTrig(gtSchema);
0249     if (!objectKey.empty()) {
0250       pL1TriggerKey->add("L1GtPrescaleFactorsTechTrigRcd", "L1GtPrescaleFactors", objectKey);
0251     }
0252   }
0253 
0254   if (m_enableL1GtTriggerMaskAlgoTrig) {
0255     const std::string& objectKey = keyL1GtTriggerMaskAlgoTrig(gtSchema);
0256     if (!objectKey.empty()) {
0257       pL1TriggerKey->add("L1GtTriggerMaskAlgoTrigRcd", "L1GtTriggerMask", objectKey);
0258     }
0259   }
0260 
0261   if (m_enableL1GtTriggerMaskTechTrig) {
0262     const std::string& objectKey = keyL1GtTriggerMaskTechTrig(gtSchema);
0263     if (!objectKey.empty()) {
0264       pL1TriggerKey->add("L1GtTriggerMaskTechTrigRcd", "L1GtTriggerMask", objectKey);
0265     }
0266   }
0267 
0268   if (m_enableL1GtTriggerMaskVetoTechTrig) {
0269     const std::string& objectKey = keyL1GtTriggerMaskVetoTechTrig(gtSchema);
0270     if (!objectKey.empty()) {
0271       pL1TriggerKey->add("L1GtTriggerMaskVetoTechTrigRcd", "L1GtTriggerMask", objectKey);
0272     }
0273   }
0274 }
0275 
0276 DEFINE_FWK_EVENTSETUP_MODULE(L1GtRsObjectKeysOnlineProd);