00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <iostream>
00023
00024
00025 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
00026
00027 #include "CondFormats/L1TObjects/interface/L1MuDTTFParameters.h"
00028 #include "CondFormats/DataRecord/interface/L1MuDTTFParametersRcd.h"
00029
00030
00031
00032
00033
00034 class DTTFParametersOnlineProd :
00035 public L1ConfigOnlineProdBase< L1MuDTTFParametersRcd, L1MuDTTFParameters > {
00036 public:
00037 DTTFParametersOnlineProd(const edm::ParameterSet&);
00038 ~DTTFParametersOnlineProd();
00039
00040 virtual boost::shared_ptr< L1MuDTTFParameters > newObject(
00041 const std::string& objectKey ) ;
00042
00043 private:
00044
00045
00046 };
00047
00048
00049
00050
00051 DTTFParametersOnlineProd::DTTFParametersOnlineProd(
00052 const edm::ParameterSet& iConfig)
00053 : L1ConfigOnlineProdBase< L1MuDTTFParametersRcd, L1MuDTTFParameters >( iConfig )
00054 {
00055
00056
00057
00058
00059 }
00060
00061
00062 DTTFParametersOnlineProd::~DTTFParametersOnlineProd()
00063 {
00064
00065
00066
00067
00068 }
00069
00070 boost::shared_ptr< L1MuDTTFParameters >
00071 DTTFParametersOnlineProd::newObject( const std::string& objectKey )
00072 {
00073 using namespace edm::es;
00074
00075 boost::shared_ptr< L1MuDTTFParameters > pDTTFParameters(
00076 new L1MuDTTFParameters() ) ;
00077
00078 pDTTFParameters->reset() ;
00079
00080 std::string dttfSchema = "CMS_DT_TF" ;
00081
00082
00083 std::vector< std::string > crateKeyColumns ;
00084 crateKeyColumns.push_back( "WEDGE_CRATE_1" ) ;
00085 crateKeyColumns.push_back( "WEDGE_CRATE_2" ) ;
00086 crateKeyColumns.push_back( "WEDGE_CRATE_3" ) ;
00087 crateKeyColumns.push_back( "WEDGE_CRATE_4" ) ;
00088 crateKeyColumns.push_back( "WEDGE_CRATE_5" ) ;
00089 crateKeyColumns.push_back( "WEDGE_CRATE_6" ) ;
00090
00091 l1t::OMDSReader::QueryResults crateKeyResults =
00092 m_omdsReader.basicQuery( crateKeyColumns,
00093 dttfSchema,
00094 "DTTF_CONF",
00095 "DTTF_CONF.ID",
00096 m_omdsReader.singleAttribute( objectKey ) ) ;
00097
00098 if( crateKeyResults.queryFailed() ||
00099 crateKeyResults.numberRows() != 1 )
00100 {
00101 edm::LogError( "L1-O2O" )
00102 << "Problem with L1MuDTTFParameters key " << objectKey ;
00103 return boost::shared_ptr< L1MuDTTFParameters >() ;
00104 }
00105
00106
00107 std::string crateKeys[ 6 ] ;
00108 for( int icrate = 0 ; icrate < 6 ; ++icrate )
00109 {
00110 crateKeyResults.fillVariable( crateKeyColumns[ icrate ],
00111 crateKeys[ icrate ] ) ;
00112 std::cout << "Crate " << icrate << " key "
00113 << crateKeys[ icrate ] << std::endl ;
00114 }
00115
00116
00117 std::string sectorNames[ 12 ] = {
00118 "R", "L", "R", "L", "L", "R", "L", "R", "R", "L", "R", "L" } ;
00119
00120
00121 int crateNumbers[ 12 ] = { 3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0 } ;
00122
00123
00124 int wheelNumbers[ 6 ] = { -3, -2, -1, 1, 2, 3 } ;
00125
00126
00127 std::string wheelNames[ 6 ] = { "N2", "N1", "N0", "P0", "P1", "P2" } ;
00128
00129
00130 std::vector< std::string > phtfMaskColumns ;
00131 phtfMaskColumns.push_back( "INREC_QUAL_ST1" ) ;
00132 phtfMaskColumns.push_back( "INREC_QUAL_ST2" ) ;
00133 phtfMaskColumns.push_back( "INREC_QUAL_ST3" ) ;
00134 phtfMaskColumns.push_back( "INREC_QUAL_ST4" ) ;
00135 phtfMaskColumns.push_back( "SOC_QUAL_CSC" ) ;
00136 phtfMaskColumns.push_back( "SOC_STDIS_N" ) ;
00137 phtfMaskColumns.push_back( "SOC_STDIS_WL" ) ;
00138 phtfMaskColumns.push_back( "SOC_STDIS_WR" ) ;
00139 phtfMaskColumns.push_back( "SOC_STDIS_ZL" ) ;
00140 phtfMaskColumns.push_back( "SOC_STDIS_ZR" ) ;
00141 phtfMaskColumns.push_back( "SOC_QCUT_ST1" ) ;
00142 phtfMaskColumns.push_back( "SOC_QCUT_ST2" ) ;
00143 phtfMaskColumns.push_back( "SOC_QCUT_ST4" ) ;
00144 phtfMaskColumns.push_back( "SOC_RUN_21" ) ;
00145 phtfMaskColumns.push_back( "SOC_NBX_DEL" ) ;
00146 phtfMaskColumns.push_back( "SOC_CSC_ETACANC" ) ;
00147 phtfMaskColumns.push_back( "SOC_OPENLUT_EXTR" ) ;
00148
00149
00150 for( int isc = 0 ; isc < 12 ; ++isc )
00151 {
00152 int crateNumber = crateNumbers[ isc ] ;
00153 std::cout << "isc " << isc << " icr " << crateNumber << std::endl ;
00154
00155
00156 for( int iwh = 0 ; iwh < 6 ; ++iwh )
00157 {
00158 std::string sectorWheelName =
00159 sectorNames[ isc ] + wheelNames[ iwh ] ;
00160
00161 int nwh = wheelNumbers[ iwh ] ;
00162
00163
00164 std::string crateKey ;
00165 if( crateKeyResults.fillVariable( crateKeyColumns[ crateNumber ],
00166 crateKey ) )
00167 {
00168
00169 std::vector< std::string > phtfKeyColumns ;
00170 phtfKeyColumns.push_back( "PHTF_" + sectorWheelName ) ;
00171
00172 l1t::OMDSReader::QueryResults phtfKeyResults =
00173 m_omdsReader.basicQuery( phtfKeyColumns,
00174 dttfSchema,
00175 "WEDGE_CRATE_CONF",
00176 "WEDGE_CRATE_CONF.ID",
00177 crateKeyResults,
00178 crateKeyColumns[ crateNumber ] ) ;
00179
00180 if( phtfKeyResults.queryFailed() ||
00181 phtfKeyResults.numberRows() != 1 )
00182 {
00183 edm::LogError( "L1-O2O" )
00184 << "Problem with WEDGE_CRATE_CONF key." ;
00185 return boost::shared_ptr< L1MuDTTFParameters >() ;
00186 }
00187
00188 std::string dummy ;
00189 if( phtfKeyResults.fillVariable( dummy ) )
00190 {
00191 std::cout << "PHTF key " << dummy << std::endl ;
00192
00193 l1t::OMDSReader::QueryResults phtfMaskResults =
00194 m_omdsReader.basicQuery( phtfMaskColumns,
00195 dttfSchema,
00196 "PHTF_CONF",
00197 "PHTF_CONF.ID",
00198 phtfKeyResults ) ;
00199
00200 if( phtfMaskResults.queryFailed() ||
00201 phtfMaskResults.numberRows() != 1 )
00202 {
00203 edm::LogError( "L1-O2O" )
00204 << "Problem with PHTF_CONF key." ;
00205 return boost::shared_ptr< L1MuDTTFParameters >() ;
00206 }
00207
00208 long long tmp ;
00209
00210 phtfMaskResults.fillVariable( "INREC_QUAL_ST1", tmp ) ;
00211 std::cout << " INREC_QUAL_ST1 " << tmp ;
00212 pDTTFParameters->set_inrec_qual_st1( nwh, isc, tmp ) ;
00213 phtfMaskResults.fillVariable( "INREC_QUAL_ST2", tmp ) ;
00214 std::cout << " INREC_QUAL_ST2 " << tmp ;
00215 pDTTFParameters->set_inrec_qual_st2( nwh, isc, tmp ) ;
00216 phtfMaskResults.fillVariable( "INREC_QUAL_ST3", tmp ) ;
00217 std::cout << " INREC_QUAL_ST3 " << tmp ;
00218 pDTTFParameters->set_inrec_qual_st3( nwh, isc, tmp ) ;
00219 phtfMaskResults.fillVariable( "INREC_QUAL_ST4", tmp ) ;
00220 std::cout << " INREC_QUAL_ST4 " << tmp << std::endl ;
00221 pDTTFParameters->set_inrec_qual_st4( nwh, isc, tmp ) ;
00222 std::cout << " SOC_QUAL_CSC " << tmp << std::endl ;
00223 pDTTFParameters->set_soc_qual_csc( nwh, isc, tmp ) ;
00224
00225 phtfMaskResults.fillVariable( "SOC_STDIS_N", tmp ) ;
00226 std::cout << " SOC_STDIS_N " << tmp ;
00227 pDTTFParameters->set_soc_stdis_n( nwh, isc, tmp ) ;
00228 phtfMaskResults.fillVariable( "SOC_STDIS_WL", tmp ) ;
00229 std::cout << " SOC_STDIS_WL " << tmp ;
00230 pDTTFParameters->set_soc_stdis_wl( nwh, isc, tmp ) ;
00231 phtfMaskResults.fillVariable( "SOC_STDIS_WR", tmp ) ;
00232 std::cout << " SOC_STDIS_WR " << tmp ;
00233 pDTTFParameters->set_soc_stdis_wr( nwh, isc, tmp ) ;
00234 phtfMaskResults.fillVariable( "SOC_STDIS_ZL", tmp ) ;
00235 std::cout << " SOC_STDIS_ZL " << tmp ;
00236 pDTTFParameters->set_soc_stdis_zl( nwh, isc, tmp ) ;
00237 phtfMaskResults.fillVariable( "SOC_STDIS_ZR", tmp ) ;
00238 std::cout << " SOC_STDIS_ZR " << tmp << std::endl ;
00239 pDTTFParameters->set_soc_stdis_zr( nwh, isc, tmp ) ;
00240
00241 phtfMaskResults.fillVariable( "SOC_QCUT_ST1", tmp ) ;
00242 std::cout << " SOC_QCUT_ST1 " << tmp ;
00243 pDTTFParameters->set_soc_qcut_st1( nwh, isc, tmp ) ;
00244 phtfMaskResults.fillVariable( "SOC_QCUT_ST2", tmp ) ;
00245 std::cout << " SOC_QCUT_ST2 " << tmp ;
00246 pDTTFParameters->set_soc_qcut_st2( nwh, isc, tmp ) ;
00247 phtfMaskResults.fillVariable( "SOC_QCUT_ST4", tmp ) ;
00248 std::cout << " SOC_QCUT_ST4 " << tmp << std::endl ;
00249 pDTTFParameters->set_soc_qcut_st4( nwh, isc, tmp ) ;
00250
00251 phtfMaskResults.fillVariable( "SOC_RUN_21", tmp ) ;
00252 std::cout << " SOC_RUN_21 " << tmp ;
00253 pDTTFParameters->set_soc_run_21( nwh, isc, tmp ) ;
00254 phtfMaskResults.fillVariable( "SOC_NBX_DEL", tmp ) ;
00255 std::cout << " SOC_NBX_DEL " << tmp ;
00256 pDTTFParameters->set_soc_nbx_del( nwh, isc, tmp ) ;
00257 phtfMaskResults.fillVariable( "SOC_CSC_ETACANC", tmp ) ;
00258 std::cout << " SOC_CSC_ETACANC " << tmp ;
00259 pDTTFParameters->set_soc_csc_etacanc( nwh, isc, tmp ) ;
00260 phtfMaskResults.fillVariable( "SOC_OPENLUT_EXTR", tmp ) ;
00261 std::cout << " SOC_OPENLUT_EXTR " << tmp << std::endl ;
00262 pDTTFParameters->set_soc_openlut_extr( nwh, isc, tmp ) ;
00263 }
00264 }
00265 }
00266 }
00267
00268 return pDTTFParameters ;
00269 }
00270
00271
00272
00273
00274
00275 DEFINE_FWK_EVENTSETUP_MODULE(DTTFParametersOnlineProd);