Go to the documentation of this file.00001 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
00002 #include "CondFormats/L1TObjects/interface/L1GctJetFinderParams.h"
00003 #include "CondFormats/DataRecord/interface/L1GctJetFinderParamsRcd.h"
00004
00005 class L1GctJetFinderParamsOnlineProd : public L1ConfigOnlineProdBase< L1GctJetFinderParamsRcd, L1GctJetFinderParams > {
00006 public:
00007 L1GctJetFinderParamsOnlineProd(const edm::ParameterSet& iConfig)
00008 : L1ConfigOnlineProdBase< L1GctJetFinderParamsRcd, L1GctJetFinderParams >( iConfig ) {}
00009 ~L1GctJetFinderParamsOnlineProd() {}
00010
00011 virtual boost::shared_ptr< L1GctJetFinderParams > newObject( const std::string& objectKey ) ;
00012 private:
00013 };
00014
00015 boost::shared_ptr< L1GctJetFinderParams >
00016 L1GctJetFinderParamsOnlineProd::newObject( const std::string& objectKey )
00017 {
00018
00019
00020
00021
00022 std::vector< std::string > columns;
00023 columns.push_back( "GCT_RGN_ET_LSB" );
00024 columns.push_back( "GCT_HT_LSB" );
00025 columns.push_back( "GCT_CJET_SEED_ET_THRESHOLD" );
00026 columns.push_back( "GCT_TJET_SEED_ET_THRESHOLD" );
00027 columns.push_back( "GCT_FJET_SEED_ET_THRESHOLD" );
00028 columns.push_back( "GCT_HT_JET_ET_THRESHOLD" );
00029 columns.push_back( "GCT_MHT_JET_ET_THRESHOLD" );
00030 columns.push_back( "GCT_TAU_ISO_ET_THRESHOLD" );
00031 columns.push_back( "GCT_CEN_JET_ETA_MAX" );
00032 columns.push_back( "GCT_JET_CORR_KEY" );
00033
00034 l1t::OMDSReader::QueryResults results =
00035 m_omdsReader.basicQuery(
00036 columns,
00037 "CMS_GCT",
00038 "GCT_PHYS_PARAMS",
00039 "GCT_PHYS_PARAMS.CONFIG_KEY",
00040 m_omdsReader.singleAttribute( objectKey ) ) ;
00041
00042 if( results.queryFailed() )
00043 {
00044 edm::LogError( "L1-O2O" ) << "Problem with L1GctJetFinderParams key." ;
00045 return boost::shared_ptr< L1GctJetFinderParams >() ;
00046 }
00047
00048
00049 double rgnEtLsb=0.;
00050 double htLsb=0.;
00051 double cJetSeed=0.;
00052 double tJetSeed=0.;
00053 double fJetSeed=0.;
00054 double tauIsoEtThresh=0.;
00055 double htJetEtThresh=0.;
00056 double mhtJetEtThresh=0.;
00057 short int etaBoundary=7;
00058 int corrType=0;
00059 std::vector< std::vector<double> > jetCorrCoeffs;
00060 std::vector< std::vector<double> > tauCorrCoeffs;
00061 bool convertToEnergy=false;
00062 std::vector<double> energyConvCoeffs(11);
00063 std::string jetCorrKey;
00064
00065 results.fillVariable( "GCT_RGN_ET_LSB", rgnEtLsb );
00066 results.fillVariable( "GCT_HT_LSB", htLsb );
00067 results.fillVariable( "GCT_CJET_SEED_ET_THRESHOLD", cJetSeed );
00068 results.fillVariable( "GCT_TJET_SEED_ET_THRESHOLD", tJetSeed );
00069 results.fillVariable( "GCT_FJET_SEED_ET_THRESHOLD", fJetSeed );
00070 results.fillVariable( "GCT_TAU_ISO_ET_THRESHOLD", tauIsoEtThresh );
00071 results.fillVariable( "GCT_HT_JET_ET_THRESHOLD", htJetEtThresh );
00072 results.fillVariable( "GCT_MHT_JET_ET_THRESHOLD", mhtJetEtThresh );
00073 results.fillVariable( "GCT_CEN_JET_ETA_MAX", etaBoundary );
00074 results.fillVariable( "GCT_JET_CORR_KEY", jetCorrKey );
00075
00076 edm::LogInfo("L1-O2O") << "L1 jet corrections key : " << jetCorrKey << std::endl;
00077
00078
00079 std::vector< std::string > jetCorrColumns;
00080 jetCorrColumns.push_back( "GCT_JETCORR_TYPE" );
00081 jetCorrColumns.push_back( "GCT_JETCORR_NETA_10" );
00082 jetCorrColumns.push_back( "GCT_JETCORR_NETA_9" );
00083 jetCorrColumns.push_back( "GCT_JETCORR_NETA_8" );
00084 jetCorrColumns.push_back( "GCT_JETCORR_NETA_7" );
00085 jetCorrColumns.push_back( "GCT_JETCORR_NETA_6" );
00086 jetCorrColumns.push_back( "GCT_JETCORR_NETA_5" );
00087 jetCorrColumns.push_back( "GCT_JETCORR_NETA_4" );
00088 jetCorrColumns.push_back( "GCT_JETCORR_NETA_3" );
00089 jetCorrColumns.push_back( "GCT_JETCORR_NETA_2" );
00090 jetCorrColumns.push_back( "GCT_JETCORR_NETA_1" );
00091 jetCorrColumns.push_back( "GCT_JETCORR_NETA_0" );
00092 jetCorrColumns.push_back( "GCT_JETCORR_PETA_0" );
00093 jetCorrColumns.push_back( "GCT_JETCORR_PETA_1" );
00094 jetCorrColumns.push_back( "GCT_JETCORR_PETA_2" );
00095 jetCorrColumns.push_back( "GCT_JETCORR_PETA_3" );
00096 jetCorrColumns.push_back( "GCT_JETCORR_PETA_4" );
00097 jetCorrColumns.push_back( "GCT_JETCORR_PETA_5" );
00098 jetCorrColumns.push_back( "GCT_JETCORR_PETA_6" );
00099 jetCorrColumns.push_back( "GCT_JETCORR_PETA_7" );
00100 jetCorrColumns.push_back( "GCT_JETCORR_PETA_8" );
00101 jetCorrColumns.push_back( "GCT_JETCORR_PETA_9" );
00102 jetCorrColumns.push_back( "GCT_JETCORR_PETA_10" );
00103
00104 l1t::OMDSReader::QueryResults jetCorrResults =
00105 m_omdsReader.basicQuery(
00106 jetCorrColumns,
00107 "CMS_GCT",
00108 "GCT_JET_CORRECTIONS",
00109 "GCT_JET_CORRECTIONS.CONFIG_KEY",
00110 m_omdsReader.singleAttribute( jetCorrKey ) ) ;
00111
00112 if( jetCorrResults.queryFailed() )
00113 {
00114 edm::LogError( "L1-O2O" ) << "Problem getting L1 jet corrections" ;
00115 return boost::shared_ptr< L1GctJetFinderParams >() ;
00116 }
00117
00118
00119 jetCorrResults.fillVariable( "GCT_JETCORR_TYPE", corrType );
00120
00121 edm::LogInfo("L1-O2O") << "L1 jet corrections type : " << corrType << std::endl;
00122
00123
00124 for (unsigned i=0; i < L1GctJetFinderParams::NUMBER_ETA_VALUES; ++i) {
00125
00126
00127 std::stringstream etaCol;
00128 etaCol << "GCT_JETCORR_NETA_" << std::dec << i;
00129 std::string etaKey;
00130 jetCorrResults.fillVariable( etaCol.str(), etaKey );
00131
00132 std::vector< std::string > coeffColumns;
00133 coeffColumns.push_back( "GCT_JETCORR_C0" );
00134 coeffColumns.push_back( "GCT_JETCORR_C1" );
00135 coeffColumns.push_back( "GCT_JETCORR_C2" );
00136 coeffColumns.push_back( "GCT_JETCORR_C3" );
00137 coeffColumns.push_back( "GCT_JETCORR_C4" );
00138 coeffColumns.push_back( "GCT_JETCORR_C5" );
00139 coeffColumns.push_back( "GCT_JETCORR_C6" );
00140 coeffColumns.push_back( "GCT_JETCORR_C7" );
00141 coeffColumns.push_back( "GCT_JETCORR_C8" );
00142 coeffColumns.push_back( "GCT_JETCORR_C9" );
00143 coeffColumns.push_back( "GCT_JETCORR_C10" );
00144 coeffColumns.push_back( "GCT_JETCORR_C11" );
00145 coeffColumns.push_back( "GCT_JETCORR_C12" );
00146 coeffColumns.push_back( "GCT_JETCORR_C13" );
00147 coeffColumns.push_back( "GCT_JETCORR_C14" );
00148 coeffColumns.push_back( "GCT_JETCORR_C15" );
00149 coeffColumns.push_back( "GCT_JETCORR_C16" );
00150 coeffColumns.push_back( "GCT_JETCORR_C17" );
00151 coeffColumns.push_back( "GCT_JETCORR_C18" );
00152 coeffColumns.push_back( "GCT_JETCORR_C19" );
00153
00154 l1t::OMDSReader::QueryResults jetCorrResults =
00155 m_omdsReader.basicQuery(
00156 coeffColumns,
00157 "CMS_GCT",
00158 "GCT_JET_COEFFS",
00159 "GCT_JET_COEFFS.CONFIG_KEY",
00160 m_omdsReader.singleAttribute( etaKey ) ) ;
00161
00162 if( results.queryFailed() )
00163 {
00164 edm::LogError( "L1-O2O" ) << "Problem getting L1 jet correction coefficients" ;
00165 return boost::shared_ptr< L1GctJetFinderParams >() ;
00166 }
00167
00168
00169 std::vector<double> coeffs;
00170
00171 unsigned nCoeffs = 0;
00172 if (corrType == 0) nCoeffs = 0;
00173 else if (corrType == 2) nCoeffs=8;
00174 else if (corrType == 3) nCoeffs=4;
00175 else if (corrType == 4) nCoeffs=15;
00176 else if (corrType == 5) nCoeffs=6;
00177 else {
00178 edm::LogError( "L1-O2O" ) << "Unsupported jet correction type : " << corrType ;
00179 return boost::shared_ptr< L1GctJetFinderParams >() ;
00180 }
00181
00182 for (unsigned j=0; j< nCoeffs; ++j) {
00183 std::stringstream coeffCol;
00184 coeffCol << "GCT_JETCORR_C" << std::dec << j;
00185
00186 double coeff;
00187 jetCorrResults.fillVariable( coeffCol.str(), coeff );
00188
00189 coeffs.push_back(coeff);
00190 }
00191
00192 jetCorrCoeffs.push_back(coeffs);
00193
00194
00195 if (i < L1GctJetFinderParams::N_CENTRAL_ETA_VALUES) tauCorrCoeffs.push_back(coeffs);
00196
00197 }
00198
00199
00200
00201 return boost::shared_ptr< L1GctJetFinderParams >(
00202 new L1GctJetFinderParams( rgnEtLsb,
00203 htLsb,
00204 cJetSeed,
00205 fJetSeed,
00206 tJetSeed,
00207 tauIsoEtThresh,
00208 htJetEtThresh,
00209 mhtJetEtThresh,
00210 etaBoundary,
00211 corrType,
00212 jetCorrCoeffs,
00213 tauCorrCoeffs,
00214 convertToEnergy,
00215 energyConvCoeffs
00216
00217 )
00218 );
00219
00220 }
00221
00222
00223 DEFINE_FWK_EVENTSETUP_MODULE(L1GctJetFinderParamsOnlineProd);