Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:22

0001 // -*- C++ -*-
0002 //
0003 // Package:    L1HtMissScaleOnlineProd
0004 // Class:      L1HtMissScaleOnlineProd
0005 //
0006 /**\class L1HtMissScaleOnlineProd L1HtMissScaleOnlineProd.h L1TriggerConfig/L1ScalesProducers/src/L1HtMissScaleOnlineProd.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Werner Man-Li Sun
0015 //         Created:  Tue Sep 16 22:43:22 CEST 2008
0016 //
0017 //
0018 
0019 // system include files
0020 
0021 // user include files
0022 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
0023 
0024 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h"
0025 #include "CondFormats/DataRecord/interface/L1HtMissScaleRcd.h"
0026 
0027 //
0028 // class declaration
0029 //
0030 
0031 class L1HtMissScaleOnlineProd : public L1ConfigOnlineProdBase<L1HtMissScaleRcd, L1CaloEtScale> {
0032 public:
0033   L1HtMissScaleOnlineProd(const edm::ParameterSet&);
0034   ~L1HtMissScaleOnlineProd() override;
0035 
0036   std::unique_ptr<L1CaloEtScale> newObject(const std::string& objectKey) override;
0037 
0038 private:
0039   // ----------member data ---------------------------
0040 };
0041 
0042 //
0043 // constants, enums and typedefs
0044 //
0045 
0046 //
0047 // static data member definitions
0048 //
0049 
0050 //
0051 // constructors and destructor
0052 //
0053 L1HtMissScaleOnlineProd::L1HtMissScaleOnlineProd(const edm::ParameterSet& iConfig)
0054     : L1ConfigOnlineProdBase<L1HtMissScaleRcd, L1CaloEtScale>(iConfig) {
0055   //the following line is needed to tell the framework what
0056   // data is being produced
0057 
0058   //now do what ever other initialization is needed
0059 }
0060 
0061 L1HtMissScaleOnlineProd::~L1HtMissScaleOnlineProd() {
0062   // do anything here that needs to be done at desctruction time
0063   // (e.g. close files, deallocate resources etc.)
0064 }
0065 
0066 std::unique_ptr<L1CaloEtScale> L1HtMissScaleOnlineProd::newObject(const std::string& objectKey) {
0067   // get scales keys
0068   l1t::OMDSReader::QueryResults scalesKeyResults = m_omdsReader.basicQuery("GCT_SCALES_KEY",
0069                                                                            "CMS_GCT",
0070                                                                            "GCT_PHYS_PARAMS",
0071                                                                            "GCT_PHYS_PARAMS.CONFIG_KEY",
0072                                                                            m_omdsReader.singleAttribute(objectKey));
0073 
0074   std::string scalesKey;
0075 
0076   if (scalesKeyResults.queryFailed()) {
0077     edm::LogError("L1-O2O") << "Problem with key for L1HtMissScaleRcd : GCT scales key query failed ";
0078   } else if (scalesKeyResults.numberRows() != 1) {
0079     edm::LogError("L1-O2O") << "Problem with key for L1HtMissScaleRcd : " << (scalesKeyResults.numberRows())
0080                             << " rows were returned when getting GCT scales key";
0081   } else {
0082     scalesKeyResults.fillVariable(scalesKey);
0083   }
0084 
0085   edm::LogInfo("L1-O2O") << "L1 scales key : " << scalesKey << std::endl;
0086 
0087   // get jet scale key
0088   l1t::OMDSReader::QueryResults htmScaleKeyResults =
0089       m_omdsReader.basicQuery("SC_HTM_FK", "CMS_GT", "L1T_SCALES", "L1T_SCALES.ID", scalesKeyResults);
0090 
0091   std::string htmScaleKey;
0092 
0093   if (htmScaleKeyResults.queryFailed()) {
0094     edm::LogError("L1-O2O") << "Problem with key for L1HtMissEtScaleRcd : HtMiss scale key query failed ";
0095   } else if (htmScaleKeyResults.numberRows() != 1) {
0096     edm::LogError("L1-O2O") << "Problem with key for L1HtMissScaleRcd : " << (htmScaleKeyResults.numberRows())
0097                             << " rows were returned when getting HtMiss scale key";
0098   } else {
0099     htmScaleKeyResults.fillVariable(htmScaleKey);
0100   }
0101 
0102   edm::LogInfo("L1-O2O") << "L1HtMiss scale key : " << htmScaleKey << std::endl;
0103 
0104   // get thresholds
0105   std::vector<std::string> queryStrings;
0106   queryStrings.push_back("E_GEV_BIN_LOW_0");
0107   queryStrings.push_back("E_GEV_BIN_LOW_1");
0108   queryStrings.push_back("E_GEV_BIN_LOW_2");
0109   queryStrings.push_back("E_GEV_BIN_LOW_3");
0110   queryStrings.push_back("E_GEV_BIN_LOW_4");
0111   queryStrings.push_back("E_GEV_BIN_LOW_5");
0112   queryStrings.push_back("E_GEV_BIN_LOW_6");
0113   queryStrings.push_back("E_GEV_BIN_LOW_7");
0114   queryStrings.push_back("E_GEV_BIN_LOW_8");
0115   queryStrings.push_back("E_GEV_BIN_LOW_9");
0116   queryStrings.push_back("E_GEV_BIN_LOW_10");
0117   queryStrings.push_back("E_GEV_BIN_LOW_11");
0118   queryStrings.push_back("E_GEV_BIN_LOW_12");
0119   queryStrings.push_back("E_GEV_BIN_LOW_13");
0120   queryStrings.push_back("E_GEV_BIN_LOW_14");
0121   queryStrings.push_back("E_GEV_BIN_LOW_15");
0122   queryStrings.push_back("E_GEV_BIN_LOW_16");
0123   queryStrings.push_back("E_GEV_BIN_LOW_17");
0124   queryStrings.push_back("E_GEV_BIN_LOW_18");
0125   queryStrings.push_back("E_GEV_BIN_LOW_19");
0126   queryStrings.push_back("E_GEV_BIN_LOW_20");
0127   queryStrings.push_back("E_GEV_BIN_LOW_21");
0128   queryStrings.push_back("E_GEV_BIN_LOW_22");
0129   queryStrings.push_back("E_GEV_BIN_LOW_23");
0130   queryStrings.push_back("E_GEV_BIN_LOW_24");
0131   queryStrings.push_back("E_GEV_BIN_LOW_25");
0132   queryStrings.push_back("E_GEV_BIN_LOW_26");
0133   queryStrings.push_back("E_GEV_BIN_LOW_27");
0134   queryStrings.push_back("E_GEV_BIN_LOW_28");
0135   queryStrings.push_back("E_GEV_BIN_LOW_29");
0136   queryStrings.push_back("E_GEV_BIN_LOW_30");
0137   queryStrings.push_back("E_GEV_BIN_LOW_31");
0138   queryStrings.push_back("E_GEV_BIN_LOW_32");
0139   queryStrings.push_back("E_GEV_BIN_LOW_33");
0140   queryStrings.push_back("E_GEV_BIN_LOW_34");
0141   queryStrings.push_back("E_GEV_BIN_LOW_35");
0142   queryStrings.push_back("E_GEV_BIN_LOW_36");
0143   queryStrings.push_back("E_GEV_BIN_LOW_37");
0144   queryStrings.push_back("E_GEV_BIN_LOW_38");
0145   queryStrings.push_back("E_GEV_BIN_LOW_39");
0146   queryStrings.push_back("E_GEV_BIN_LOW_40");
0147   queryStrings.push_back("E_GEV_BIN_LOW_41");
0148   queryStrings.push_back("E_GEV_BIN_LOW_42");
0149   queryStrings.push_back("E_GEV_BIN_LOW_43");
0150   queryStrings.push_back("E_GEV_BIN_LOW_44");
0151   queryStrings.push_back("E_GEV_BIN_LOW_45");
0152   queryStrings.push_back("E_GEV_BIN_LOW_46");
0153   queryStrings.push_back("E_GEV_BIN_LOW_47");
0154   queryStrings.push_back("E_GEV_BIN_LOW_48");
0155   queryStrings.push_back("E_GEV_BIN_LOW_49");
0156   queryStrings.push_back("E_GEV_BIN_LOW_50");
0157   queryStrings.push_back("E_GEV_BIN_LOW_51");
0158   queryStrings.push_back("E_GEV_BIN_LOW_52");
0159   queryStrings.push_back("E_GEV_BIN_LOW_53");
0160   queryStrings.push_back("E_GEV_BIN_LOW_54");
0161   queryStrings.push_back("E_GEV_BIN_LOW_55");
0162   queryStrings.push_back("E_GEV_BIN_LOW_56");
0163   queryStrings.push_back("E_GEV_BIN_LOW_57");
0164   queryStrings.push_back("E_GEV_BIN_LOW_58");
0165   queryStrings.push_back("E_GEV_BIN_LOW_59");
0166   queryStrings.push_back("E_GEV_BIN_LOW_60");
0167   queryStrings.push_back("E_GEV_BIN_LOW_61");
0168   queryStrings.push_back("E_GEV_BIN_LOW_62");
0169   queryStrings.push_back("E_GEV_BIN_LOW_63");
0170   queryStrings.push_back("E_GEV_BIN_LOW_64");
0171   queryStrings.push_back("E_GEV_BIN_LOW_65");
0172   queryStrings.push_back("E_GEV_BIN_LOW_66");
0173   queryStrings.push_back("E_GEV_BIN_LOW_67");
0174   queryStrings.push_back("E_GEV_BIN_LOW_68");
0175   queryStrings.push_back("E_GEV_BIN_LOW_69");
0176   queryStrings.push_back("E_GEV_BIN_LOW_70");
0177   queryStrings.push_back("E_GEV_BIN_LOW_71");
0178   queryStrings.push_back("E_GEV_BIN_LOW_72");
0179   queryStrings.push_back("E_GEV_BIN_LOW_73");
0180   queryStrings.push_back("E_GEV_BIN_LOW_74");
0181   queryStrings.push_back("E_GEV_BIN_LOW_75");
0182   queryStrings.push_back("E_GEV_BIN_LOW_76");
0183   queryStrings.push_back("E_GEV_BIN_LOW_77");
0184   queryStrings.push_back("E_GEV_BIN_LOW_78");
0185   queryStrings.push_back("E_GEV_BIN_LOW_79");
0186   queryStrings.push_back("E_GEV_BIN_LOW_80");
0187   queryStrings.push_back("E_GEV_BIN_LOW_81");
0188   queryStrings.push_back("E_GEV_BIN_LOW_82");
0189   queryStrings.push_back("E_GEV_BIN_LOW_83");
0190   queryStrings.push_back("E_GEV_BIN_LOW_84");
0191   queryStrings.push_back("E_GEV_BIN_LOW_85");
0192   queryStrings.push_back("E_GEV_BIN_LOW_86");
0193   queryStrings.push_back("E_GEV_BIN_LOW_87");
0194   queryStrings.push_back("E_GEV_BIN_LOW_88");
0195   queryStrings.push_back("E_GEV_BIN_LOW_89");
0196   queryStrings.push_back("E_GEV_BIN_LOW_90");
0197   queryStrings.push_back("E_GEV_BIN_LOW_91");
0198   queryStrings.push_back("E_GEV_BIN_LOW_92");
0199   queryStrings.push_back("E_GEV_BIN_LOW_93");
0200   queryStrings.push_back("E_GEV_BIN_LOW_94");
0201   queryStrings.push_back("E_GEV_BIN_LOW_95");
0202   queryStrings.push_back("E_GEV_BIN_LOW_96");
0203   queryStrings.push_back("E_GEV_BIN_LOW_97");
0204   queryStrings.push_back("E_GEV_BIN_LOW_98");
0205   queryStrings.push_back("E_GEV_BIN_LOW_99");
0206   queryStrings.push_back("E_GEV_BIN_LOW_100");
0207   queryStrings.push_back("E_GEV_BIN_LOW_101");
0208   queryStrings.push_back("E_GEV_BIN_LOW_102");
0209   queryStrings.push_back("E_GEV_BIN_LOW_103");
0210   queryStrings.push_back("E_GEV_BIN_LOW_104");
0211   queryStrings.push_back("E_GEV_BIN_LOW_105");
0212   queryStrings.push_back("E_GEV_BIN_LOW_106");
0213   queryStrings.push_back("E_GEV_BIN_LOW_107");
0214   queryStrings.push_back("E_GEV_BIN_LOW_108");
0215   queryStrings.push_back("E_GEV_BIN_LOW_109");
0216   queryStrings.push_back("E_GEV_BIN_LOW_110");
0217   queryStrings.push_back("E_GEV_BIN_LOW_111");
0218   queryStrings.push_back("E_GEV_BIN_LOW_112");
0219   queryStrings.push_back("E_GEV_BIN_LOW_113");
0220   queryStrings.push_back("E_GEV_BIN_LOW_114");
0221   queryStrings.push_back("E_GEV_BIN_LOW_115");
0222   queryStrings.push_back("E_GEV_BIN_LOW_116");
0223   queryStrings.push_back("E_GEV_BIN_LOW_117");
0224   queryStrings.push_back("E_GEV_BIN_LOW_118");
0225   queryStrings.push_back("E_GEV_BIN_LOW_119");
0226   queryStrings.push_back("E_GEV_BIN_LOW_120");
0227   queryStrings.push_back("E_GEV_BIN_LOW_121");
0228   queryStrings.push_back("E_GEV_BIN_LOW_122");
0229   queryStrings.push_back("E_GEV_BIN_LOW_123");
0230   queryStrings.push_back("E_GEV_BIN_LOW_124");
0231   queryStrings.push_back("E_GEV_BIN_LOW_125");
0232   queryStrings.push_back("E_GEV_BIN_LOW_126");
0233   queryStrings.push_back("E_GEV_BIN_LOW_127");
0234 
0235   l1t::OMDSReader::QueryResults scaleResults = m_omdsReader.basicQuery(
0236       queryStrings, "CMS_GT", "L1T_SCALE_HTM_ENERGY", "L1T_SCALE_HTM_ENERGY.ID", htmScaleKeyResults);
0237 
0238   // L1T_SCALE_HTM_ENERGY
0239 
0240   std::vector<double> thresholds;
0241 
0242   if (scaleResults.queryFailed() || scaleResults.numberRows() != 1)  // check query successful
0243   {
0244     edm::LogError("L1-O2O") << "Problem with L1HtMissScale key : when reading scale.";
0245   } else {
0246     for (std::vector<std::string>::iterator thresh = queryStrings.begin(); thresh != queryStrings.end(); ++thresh) {
0247       float tempScale = 0.;
0248       scaleResults.fillVariable(*thresh, tempScale);
0249       thresholds.push_back(tempScale);
0250     }
0251   }
0252 
0253   // get region LSB
0254   double rgnEtLsb = 0.;
0255 
0256   l1t::OMDSReader::QueryResults lsbResults = m_omdsReader.basicQuery("GCT_RGN_ET_LSB",
0257                                                                      "CMS_GCT",
0258                                                                      "GCT_PHYS_PARAMS",
0259                                                                      "GCT_PHYS_PARAMS.CONFIG_KEY",
0260                                                                      m_omdsReader.singleAttribute(objectKey));
0261 
0262   if (lsbResults.queryFailed()) {
0263     edm::LogError("L1-O2O") << "Problem with L1HtMissScale key.";
0264   } else {
0265     lsbResults.fillVariable("GCT_RGN_ET_LSB", rgnEtLsb);
0266   }
0267 
0268   // return object
0269   return std::make_unique<L1CaloEtScale>(0, 0x7f, rgnEtLsb, thresholds);
0270 }
0271 
0272 // ------------ method called to produce the data  ------------
0273 
0274 //define this as a plug-in
0275 DEFINE_FWK_EVENTSETUP_MODULE(L1HtMissScaleOnlineProd);