File indexing completed on 2023-03-17 11:14:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <iostream>
0021
0022
0023 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
0024
0025 #include "CondFormats/L1TObjects/interface/L1MuDTTFParameters.h"
0026 #include "CondFormats/DataRecord/interface/L1MuDTTFParametersRcd.h"
0027
0028
0029
0030
0031
0032 class DTTFParametersOnlineProd : public L1ConfigOnlineProdBase<L1MuDTTFParametersRcd, L1MuDTTFParameters> {
0033 public:
0034 DTTFParametersOnlineProd(const edm::ParameterSet&);
0035 ~DTTFParametersOnlineProd() override;
0036
0037 std::unique_ptr<L1MuDTTFParameters> newObject(const std::string& objectKey) override;
0038
0039 private:
0040
0041 };
0042
0043
0044
0045
0046 DTTFParametersOnlineProd::DTTFParametersOnlineProd(const edm::ParameterSet& iConfig)
0047 : L1ConfigOnlineProdBase<L1MuDTTFParametersRcd, L1MuDTTFParameters>(iConfig) {
0048
0049
0050
0051
0052 }
0053
0054 DTTFParametersOnlineProd::~DTTFParametersOnlineProd() {
0055
0056
0057 }
0058
0059 std::unique_ptr<L1MuDTTFParameters> DTTFParametersOnlineProd::newObject(const std::string& objectKey) {
0060 auto pDTTFParameters = std::make_unique<L1MuDTTFParameters>();
0061
0062 pDTTFParameters->reset();
0063
0064 std::string dttfSchema = "CMS_DT_TF";
0065
0066
0067 std::vector<std::string> crateKeyColumns;
0068 crateKeyColumns.push_back("WEDGE_CRATE_1");
0069 crateKeyColumns.push_back("WEDGE_CRATE_2");
0070 crateKeyColumns.push_back("WEDGE_CRATE_3");
0071 crateKeyColumns.push_back("WEDGE_CRATE_4");
0072 crateKeyColumns.push_back("WEDGE_CRATE_5");
0073 crateKeyColumns.push_back("WEDGE_CRATE_6");
0074
0075 l1t::OMDSReader::QueryResults crateKeyResults = m_omdsReader.basicQuery(
0076 crateKeyColumns, dttfSchema, "DTTF_CONF", "DTTF_CONF.ID", m_omdsReader.singleAttribute(objectKey));
0077
0078 if (crateKeyResults.queryFailed() || crateKeyResults.numberRows() != 1)
0079 {
0080 edm::LogError("L1-O2O") << "Problem with L1MuDTTFParameters key " << objectKey;
0081 return std::unique_ptr<L1MuDTTFParameters>();
0082 }
0083
0084
0085 std::string crateKeys[6];
0086 for (int icrate = 0; icrate < 6; ++icrate) {
0087 crateKeyResults.fillVariable(crateKeyColumns[icrate], crateKeys[icrate]);
0088 std::cout << "Crate " << icrate << " key " << crateKeys[icrate] << std::endl;
0089 }
0090
0091
0092 std::string sectorNames[12] = {"R", "L", "R", "L", "L", "R", "L", "R", "R", "L", "R", "L"};
0093
0094
0095 int crateNumbers[12] = {3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0};
0096
0097
0098 int wheelNumbers[6] = {-3, -2, -1, 1, 2, 3};
0099
0100
0101 std::string wheelNames[6] = {"N2", "N1", "N0", "P0", "P1", "P2"};
0102
0103
0104 std::vector<std::string> phtfMaskColumns;
0105 phtfMaskColumns.push_back("INREC_QUAL_ST1");
0106 phtfMaskColumns.push_back("INREC_QUAL_ST2");
0107 phtfMaskColumns.push_back("INREC_QUAL_ST3");
0108 phtfMaskColumns.push_back("INREC_QUAL_ST4");
0109 phtfMaskColumns.push_back("SOC_QUAL_CSC");
0110 phtfMaskColumns.push_back("SOC_STDIS_N");
0111 phtfMaskColumns.push_back("SOC_STDIS_WL");
0112 phtfMaskColumns.push_back("SOC_STDIS_WR");
0113 phtfMaskColumns.push_back("SOC_STDIS_ZL");
0114 phtfMaskColumns.push_back("SOC_STDIS_ZR");
0115 phtfMaskColumns.push_back("SOC_QCUT_ST1");
0116 phtfMaskColumns.push_back("SOC_QCUT_ST2");
0117 phtfMaskColumns.push_back("SOC_QCUT_ST4");
0118 phtfMaskColumns.push_back("SOC_RUN_21");
0119 phtfMaskColumns.push_back("SOC_NBX_DEL");
0120 phtfMaskColumns.push_back("SOC_CSC_ETACANC");
0121 phtfMaskColumns.push_back("SOC_OPENLUT_EXTR");
0122
0123
0124 for (int isc = 0; isc < 12; ++isc) {
0125 int crateNumber = crateNumbers[isc];
0126 std::cout << "isc " << isc << " icr " << crateNumber << std::endl;
0127
0128
0129 for (int iwh = 0; iwh < 6; ++iwh) {
0130 std::string sectorWheelName = sectorNames[isc] + wheelNames[iwh];
0131
0132 int nwh = wheelNumbers[iwh];
0133
0134
0135 std::string crateKey;
0136 if (crateKeyResults.fillVariable(crateKeyColumns[crateNumber], crateKey)) {
0137
0138 std::vector<std::string> phtfKeyColumns;
0139 phtfKeyColumns.push_back("PHTF_" + sectorWheelName);
0140
0141 l1t::OMDSReader::QueryResults phtfKeyResults = m_omdsReader.basicQuery(phtfKeyColumns,
0142 dttfSchema,
0143 "WEDGE_CRATE_CONF",
0144 "WEDGE_CRATE_CONF.ID",
0145 crateKeyResults,
0146 crateKeyColumns[crateNumber]);
0147
0148 if (phtfKeyResults.queryFailed() || phtfKeyResults.numberRows() != 1) {
0149 edm::LogError("L1-O2O") << "Problem with WEDGE_CRATE_CONF key.";
0150 return std::unique_ptr<L1MuDTTFParameters>();
0151 }
0152
0153 std::string dummy;
0154 if (phtfKeyResults.fillVariable(dummy)) {
0155 std::cout << "PHTF key " << dummy << std::endl;
0156
0157 l1t::OMDSReader::QueryResults phtfMaskResults =
0158 m_omdsReader.basicQuery(phtfMaskColumns, dttfSchema, "PHTF_CONF", "PHTF_CONF.ID", phtfKeyResults);
0159
0160 if (phtfMaskResults.queryFailed() || phtfMaskResults.numberRows() != 1) {
0161 edm::LogError("L1-O2O") << "Problem with PHTF_CONF key.";
0162 return std::unique_ptr<L1MuDTTFParameters>();
0163 }
0164
0165 long long tmp;
0166
0167 phtfMaskResults.fillVariable("INREC_QUAL_ST1", tmp);
0168 std::cout << " INREC_QUAL_ST1 " << tmp;
0169 pDTTFParameters->set_inrec_qual_st1(nwh, isc, tmp);
0170 phtfMaskResults.fillVariable("INREC_QUAL_ST2", tmp);
0171 std::cout << " INREC_QUAL_ST2 " << tmp;
0172 pDTTFParameters->set_inrec_qual_st2(nwh, isc, tmp);
0173 phtfMaskResults.fillVariable("INREC_QUAL_ST3", tmp);
0174 std::cout << " INREC_QUAL_ST3 " << tmp;
0175 pDTTFParameters->set_inrec_qual_st3(nwh, isc, tmp);
0176 phtfMaskResults.fillVariable("INREC_QUAL_ST4", tmp);
0177 std::cout << " INREC_QUAL_ST4 " << tmp << std::endl;
0178 pDTTFParameters->set_inrec_qual_st4(nwh, isc, tmp);
0179 std::cout << " SOC_QUAL_CSC " << tmp << std::endl;
0180 pDTTFParameters->set_soc_qual_csc(nwh, isc, tmp);
0181
0182 phtfMaskResults.fillVariable("SOC_STDIS_N", tmp);
0183 std::cout << " SOC_STDIS_N " << tmp;
0184 pDTTFParameters->set_soc_stdis_n(nwh, isc, tmp);
0185 phtfMaskResults.fillVariable("SOC_STDIS_WL", tmp);
0186 std::cout << " SOC_STDIS_WL " << tmp;
0187 pDTTFParameters->set_soc_stdis_wl(nwh, isc, tmp);
0188 phtfMaskResults.fillVariable("SOC_STDIS_WR", tmp);
0189 std::cout << " SOC_STDIS_WR " << tmp;
0190 pDTTFParameters->set_soc_stdis_wr(nwh, isc, tmp);
0191 phtfMaskResults.fillVariable("SOC_STDIS_ZL", tmp);
0192 std::cout << " SOC_STDIS_ZL " << tmp;
0193 pDTTFParameters->set_soc_stdis_zl(nwh, isc, tmp);
0194 phtfMaskResults.fillVariable("SOC_STDIS_ZR", tmp);
0195 std::cout << " SOC_STDIS_ZR " << tmp << std::endl;
0196 pDTTFParameters->set_soc_stdis_zr(nwh, isc, tmp);
0197
0198 phtfMaskResults.fillVariable("SOC_QCUT_ST1", tmp);
0199 std::cout << " SOC_QCUT_ST1 " << tmp;
0200 pDTTFParameters->set_soc_qcut_st1(nwh, isc, tmp);
0201 phtfMaskResults.fillVariable("SOC_QCUT_ST2", tmp);
0202 std::cout << " SOC_QCUT_ST2 " << tmp;
0203 pDTTFParameters->set_soc_qcut_st2(nwh, isc, tmp);
0204 phtfMaskResults.fillVariable("SOC_QCUT_ST4", tmp);
0205 std::cout << " SOC_QCUT_ST4 " << tmp << std::endl;
0206 pDTTFParameters->set_soc_qcut_st4(nwh, isc, tmp);
0207
0208 phtfMaskResults.fillVariable("SOC_RUN_21", tmp);
0209 std::cout << " SOC_RUN_21 " << tmp;
0210 pDTTFParameters->set_soc_run_21(nwh, isc, tmp);
0211 phtfMaskResults.fillVariable("SOC_NBX_DEL", tmp);
0212 std::cout << " SOC_NBX_DEL " << tmp;
0213 pDTTFParameters->set_soc_nbx_del(nwh, isc, tmp);
0214 phtfMaskResults.fillVariable("SOC_CSC_ETACANC", tmp);
0215 std::cout << " SOC_CSC_ETACANC " << tmp;
0216 pDTTFParameters->set_soc_csc_etacanc(nwh, isc, tmp);
0217 phtfMaskResults.fillVariable("SOC_OPENLUT_EXTR", tmp);
0218 std::cout << " SOC_OPENLUT_EXTR " << tmp << std::endl;
0219 pDTTFParameters->set_soc_openlut_extr(nwh, isc, tmp);
0220 }
0221 }
0222 }
0223 }
0224
0225 return pDTTFParameters;
0226 }
0227
0228
0229
0230
0231 DEFINE_FWK_EVENTSETUP_MODULE(DTTFParametersOnlineProd);