CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/L1TriggerConfig/RCTConfigProducers/src/L1RCTParametersOnlineProd.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1RCTParametersOnlineProd
00004 // Class:      L1RCTParametersOnlineProd
00005 // 
00013 //
00014 // Original Author:  Werner Man-Li Sun
00015 //         Created:  Tue Sep 16 22:43:22 CEST 2008
00016 // $Id: L1RCTParametersOnlineProd.cc,v 1.3 2009/03/16 14:22:29 jleonard Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 
00023 // user include files
00024 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
00025 
00026 #include "CondFormats/L1TObjects/interface/L1RCTParameters.h"
00027 #include "CondFormats/DataRecord/interface/L1RCTParametersRcd.h"
00028 
00029 // #include "FWCore/Framework/interface/HCTypeTagTemplate.h"
00030 // #include "FWCore/Framework/interface/EventSetup.h"
00031 
00032 //
00033 // class declaration
00034 //
00035 
00036 class L1RCTParametersOnlineProd :
00037   public L1ConfigOnlineProdBase< L1RCTParametersRcd, L1RCTParameters > {
00038    public:
00039       L1RCTParametersOnlineProd(const edm::ParameterSet&);
00040       ~L1RCTParametersOnlineProd();
00041 
00042   virtual boost::shared_ptr< L1RCTParameters > newObject(
00043     const std::string& objectKey ) ;
00044 
00045   void fillScaleFactors(
00046     const l1t::OMDSReader::QueryResults& results,
00047     std::vector< double >& output, int nfactor = 1 ) ;
00048   /*
00049 
00050   void fillScaleFactors(
00051     const l1t::OMDSReader::QueryResults& results,
00052     std::vector< std::vector< double  > >& output ) ;
00053   */
00054    private:
00055       // ----------member data ---------------------------
00056 };
00057 
00058 //
00059 // constants, enums and typedefs
00060 //
00061 
00062 //
00063 // static data member definitions
00064 //
00065 
00066 //
00067 // constructors and destructor
00068 //
00069 L1RCTParametersOnlineProd::L1RCTParametersOnlineProd(
00070   const edm::ParameterSet& iConfig)
00071   : L1ConfigOnlineProdBase< L1RCTParametersRcd, L1RCTParameters >( iConfig )
00072 {
00073    //the following line is needed to tell the framework what
00074    // data is being produced
00075 
00076    //now do what ever other initialization is needed
00077 }
00078 
00079 
00080 L1RCTParametersOnlineProd::~L1RCTParametersOnlineProd()
00081 {
00082  
00083    // do anything here that needs to be done at desctruction time
00084    // (e.g. close files, deallocate resources etc.)
00085 
00086 }
00087 
00088 boost::shared_ptr< L1RCTParameters >
00089 L1RCTParametersOnlineProd::newObject( const std::string& objectKey )
00090 {
00091      using namespace edm::es;
00092 
00093      std::string rctSchema = "CMS_RCT" ;
00094      const l1t::OMDSReader::QueryResults paremKeyResults =
00095        m_omdsReader.singleAttribute( objectKey ) ;
00096 
00097      // ~~~~~~~~~ Cut values ~~~~~~~~~
00098 
00099      // select egamma_lsb, jetmet_lsb, e_min_for_fg_cut, e_max_for_fg_cut,
00100      // h_ove r_e_cut, e_min_for_h_over_e_cut, e_max_for_h_over_e_cut,
00101      // h_min_for_h_over_e_cut, e_activity_cut, h_activity_cut,
00102      // eic_isolation_threshold, jsc_quiet_threshold_barrel,
00103      // jsc_quiet_threshold_endcap, noisevetohb, noisevetoheplus,
00104      // noisevetoheminus from parem_conf where parem_conf.parem_key =
00105      // (select rct_parameter from rct_conf where rct_conf.rct_key =
00106      // 'rct_cmssw_def');
00107 
00108      std::vector< std::string > queryStrings ;
00109      queryStrings.push_back( "EGAMMA_LSB" ) ;
00110      queryStrings.push_back( "JETMET_LSB" ) ;
00111      queryStrings.push_back( "E_MIN_FOR_FG_CUT" ) ;
00112      queryStrings.push_back( "E_MAX_FOR_FG_CUT" ) ;
00113      queryStrings.push_back( "H_OVER_E_CUT" ) ;
00114      queryStrings.push_back( "E_MIN_FOR_H_OVER_E_CUT" ) ;
00115      queryStrings.push_back( "E_MAX_FOR_H_OVER_E_CUT" ) ;
00116      queryStrings.push_back( "H_MIN_FOR_H_OVER_E_CUT" ) ;
00117      queryStrings.push_back( "E_ACTIVITY_CUT" ) ;
00118      queryStrings.push_back( "H_ACTIVITY_CUT" ) ;
00119      queryStrings.push_back( "EIC_ISOLATION_THRESHOLD" ) ;
00120      queryStrings.push_back( "JSC_QUIET_THRESHOLD_BARREL" ) ;
00121      queryStrings.push_back( "JSC_QUIET_THRESHOLD_ENDCAP" ) ;
00122      queryStrings.push_back( "NOISEVETOHB" ) ;
00123      queryStrings.push_back( "NOISEVETOHEPLUS" ) ;
00124      queryStrings.push_back( "NOISEVETOHEMINUS" ) ;
00125      queryStrings.push_back( "USECORR" );
00126      l1t::OMDSReader::QueryResults paremResults =
00127        m_omdsReader.basicQuery( queryStrings,
00128                                 rctSchema,
00129                                 "PAREM_CONF",
00130                                 "PAREM_CONF.PAREM_KEY",
00131                                 paremKeyResults ) ;
00132 
00133      if( paremResults.queryFailed() ||
00134          paremResults.numberRows() != 1 ) // check query successful
00135        {
00136          edm::LogError( "L1-O2O" ) << "Problem with L1RCTParameters key." ;
00137          return boost::shared_ptr< L1RCTParameters >() ;
00138        }
00139 
00140      double eGammaLSB, jetMETLSB, eMinForFGCut, eMaxForFGCut, hOeCut ;
00141      double eMinForHoECut, eMaxForHoECut, hMinForHoECut ;
00142      double eActivityCut, hActivityCut ;
00143      double jscQuietThreshBarrel, jscQuietThreshEndcap, eicIsolationThreshold ;
00144      bool noiseVetoHB, noiseVetoHEplus, noiseVetoHEminus, useCorr ;
00145 
00146      paremResults.fillVariable( "EGAMMA_LSB", eGammaLSB ) ;
00147      paremResults.fillVariable( "JETMET_LSB", jetMETLSB ) ;
00148      paremResults.fillVariable( "E_MIN_FOR_FG_CUT", eMinForFGCut ) ;
00149      paremResults.fillVariable( "E_MAX_FOR_FG_CUT", eMaxForFGCut ) ;
00150      paremResults.fillVariable( "H_OVER_E_CUT", hOeCut ) ;
00151      paremResults.fillVariable( "E_MIN_FOR_H_OVER_E_CUT", eMinForHoECut ) ;
00152      paremResults.fillVariable( "E_MAX_FOR_H_OVER_E_CUT", eMaxForHoECut ) ;
00153      paremResults.fillVariable( "H_MIN_FOR_H_OVER_E_CUT", hMinForHoECut ) ;
00154      paremResults.fillVariable( "E_ACTIVITY_CUT", eActivityCut ) ;
00155      paremResults.fillVariable( "H_ACTIVITY_CUT", hActivityCut ) ;
00156      paremResults.fillVariable( "JSC_QUIET_THRESHOLD_BARREL",
00157                                 jscQuietThreshBarrel ) ;
00158      paremResults.fillVariable( "JSC_QUIET_THRESHOLD_ENDCAP",
00159                                 jscQuietThreshEndcap ) ;
00160      paremResults.fillVariable( "EIC_ISOLATION_THRESHOLD",
00161                                 eicIsolationThreshold ) ;
00162      paremResults.fillVariable( "NOISEVETOHB", noiseVetoHB ) ;
00163      paremResults.fillVariable( "NOISEVETOHEPLUS", noiseVetoHEplus ) ;
00164      paremResults.fillVariable( "NOISEVETOHEMINUS", noiseVetoHEminus ) ;
00165      paremResults.fillVariable( "USECORR", useCorr ) ;
00166 //      std::cout << "eGammaLSB = " << eGammaLSB << std::endl ;
00167 //      std::cout << "jetMETLSB = " << jetMETLSB << std::endl ;
00168 //      std::cout << "eMinForFGCut = " << eMinForFGCut << std::endl ;
00169 //      std::cout << "eMaxForFGCut = " << eMaxForFGCut << std::endl ;
00170 //      std::cout << "hOeCut = " << hOeCut << std::endl ;
00171 //      std::cout << "eMinForHoECut = " << eMinForHoECut << std::endl ;
00172 //      std::cout << "eMaxForHoECut = " << eMaxForHoECut << std::endl ;
00173 //      std::cout << "hMinForHoECut = " << hMinForHoECut << std::endl ;
00174 //      std::cout << "eActivityCut = " << eActivityCut << std::endl ;
00175 //      std::cout << "hActivityCut = " << hActivityCut << std::endl ;
00176 //      std::cout << "eicIsolationThreshold = " << eicIsolationThreshold << std::endl ;
00177 //      std::cout << "jscQuietThreshBarrel = " << jscQuietThreshBarrel << std::endl ;
00178 //      std::cout << "jscQuietThreshEndcap = " << jscQuietThreshEndcap << std::endl ;
00179 //      std::cout << "noiseVetoHB = " << noiseVetoHB << std::endl ;
00180 //      std::cout << "noiseVetoHEplus = " << noiseVetoHEplus << std::endl ;
00181 //      std::cout << "noiseVetoHEminus = " << noiseVetoHEminus << std::endl ;
00182 
00183      // ~~~~~~~~~ EGamma ECAL scale factors ~~~~~~~~~
00184 
00185      // select scalefactor, fk_rct_eta from egamma_ecal_scalefactor where
00186      // egamma_ecal_scalefactor.fk_version =
00187      // (select egamma_ecal from parem_conf where parem_conf.parem_key =
00188      // (select rct_parameter from rct_conf where rct_conf.rct_key=
00189      // 'rct_cmssw_def'));
00190 
00191      std::vector< std::string > scaleFactorQueryStrings ;
00192      scaleFactorQueryStrings.push_back( "SCALEFACTOR" ) ;
00193      scaleFactorQueryStrings.push_back( "FK_RCT_ETA" ) ;
00194 
00195      l1t::OMDSReader::QueryResults egammaEcalResults =
00196        m_omdsReader.basicQuery(
00197          scaleFactorQueryStrings,
00198          rctSchema,
00199          "EGAMMA_ECAL_SCALEFACTOR",
00200          "EGAMMA_ECAL_SCALEFACTOR.FK_VERSION",
00201          m_omdsReader.basicQuery( "EGAMMA_ECAL",
00202                                   rctSchema,
00203                                   "PAREM_CONF",
00204                                   "PAREM_CONF.PAREM_KEY",
00205                                   paremKeyResults ) ) ;
00206 
00207      if( egammaEcalResults.queryFailed() ) // check query successful
00208        {
00209          edm::LogError( "L1-O2O" ) << "Problem with EgammaEcal key." ;
00210          return boost::shared_ptr< L1RCTParameters >() ;
00211        }
00212 
00213 //      std::cout << "egammaEcal " ;
00214      std::vector< double > egammaEcalScaleFactors ;
00215      fillScaleFactors( egammaEcalResults, egammaEcalScaleFactors ) ;
00216 
00217      // ~~~~~~~~~ EGamma HCAL scale factors ~~~~~~~~~
00218 
00219      // select scalefactor, fk_rct_eta from egamma_hcal_scalefactor where
00220      // egamma_hcal_scalefactor.fk_version =
00221      // (select egamma_hcal from parem_conf where parem_conf.parem_key =
00222      // (select rct_parameter from rct_conf where rct_conf.rct_key=
00223      // 'rct_cmssw_def'));
00224 
00225      l1t::OMDSReader::QueryResults egammaHcalResults =
00226        m_omdsReader.basicQuery(
00227          scaleFactorQueryStrings,
00228          rctSchema,
00229          "EGAMMA_HCAL_SCALEFACTOR",
00230          "EGAMMA_HCAL_SCALEFACTOR.FK_VERSION",
00231          m_omdsReader.basicQuery( "EGAMMA_HCAL",
00232                                   rctSchema,
00233                                   "PAREM_CONF",
00234                                   "PAREM_CONF.PAREM_KEY",
00235                                   paremKeyResults ) ) ;
00236 
00237      if( egammaHcalResults.queryFailed() ) // check query successful
00238        {
00239          edm::LogError( "L1-O2O" ) << "Problem with EgammaHcal key." ;
00240          return boost::shared_ptr< L1RCTParameters >() ;
00241        }
00242 
00243 //      std::cout << "egammaHcal " ;
00244      std::vector< double > egammaHcalScaleFactors ;
00245      fillScaleFactors( egammaHcalResults, egammaHcalScaleFactors ) ;
00246 
00247      // ~~~~~~~~~ JetMET ECAL scale factors ~~~~~~~~~
00248 
00249      // select scalefactor, fk_rct_eta from jetmet_ecal_scalefactor where
00250      // jetmet_ecal_scalefactor.fk_version =
00251      // (select jetmet_ecal from parem_conf where parem_conf.parem_key =
00252      // (select rct_parameter from rct_conf where rct_conf.rct_key=
00253      // 'rct_cmssw_def'));
00254 
00255      l1t::OMDSReader::QueryResults jetmetEcalResults =
00256        m_omdsReader.basicQuery(
00257          scaleFactorQueryStrings,
00258          rctSchema,
00259          "JETMET_ECAL_SCALEFACTOR",
00260          "JETMET_ECAL_SCALEFACTOR.FK_VERSION",
00261          m_omdsReader.basicQuery( "JETMET_ECAL",
00262                                   rctSchema,
00263                                   "PAREM_CONF",
00264                                   "PAREM_CONF.PAREM_KEY",
00265                                   paremKeyResults ) ) ;
00266 
00267      if( jetmetEcalResults.queryFailed() ) // check query successful
00268        {
00269          edm::LogError( "L1-O2O" ) << "Problem with JetmetEcal key." ;
00270          return boost::shared_ptr< L1RCTParameters >() ;
00271        }
00272 
00273 //      std::cout << "jetmetEcal " ;
00274      std::vector< double > jetmetEcalScaleFactors ;
00275      fillScaleFactors( jetmetEcalResults, jetmetEcalScaleFactors ) ;
00276 
00277      // ~~~~~~~~~ JetMET HCAL scale factors ~~~~~~~~~
00278 
00279      // select scalefactor, fk_rct_eta from jetmet_hcal_scalefactor where
00280      // jetmet_hcal_scalefactor.fk_version =
00281      // (select jetmet_hcal from parem_conf where parem_conf.parem_key =
00282      // (select rct_parameter from rct_conf where rct_conf.rct_key=
00283      // 'rct_cmssw_def'));
00284 
00285      l1t::OMDSReader::QueryResults jetmetHcalResults =
00286        m_omdsReader.basicQuery(
00287          scaleFactorQueryStrings,
00288          rctSchema,
00289          "JETMET_HCAL_SCALEFACTOR",
00290          "JETMET_HCAL_SCALEFACTOR.FK_VERSION",
00291          m_omdsReader.basicQuery( "JETMET_HCAL",
00292                                   rctSchema,
00293                                   "PAREM_CONF",
00294                                   "PAREM_CONF.PAREM_KEY",
00295                                   paremKeyResults ) ) ;
00296 
00297      if( jetmetHcalResults.queryFailed() ) // check query successful
00298        {
00299          edm::LogError( "L1-O2O" ) << "Problem with JetmetHcal key." ;
00300          return boost::shared_ptr< L1RCTParameters >() ;
00301        }
00302 
00303 //      std::cout << "jetmetHcal " ;
00304      std::vector< double > jetmetHcalScaleFactors ;
00305      fillScaleFactors( jetmetHcalResults, jetmetHcalScaleFactors ) ;
00306 
00307 
00308 
00309      //Lindsay variables
00310     
00311         /*
00312     std::vector< std::vector< double > > hcalCalibScaleFactors ;
00313        std::vector< std::vector< double > > hcalCalibHighScaleFactors ;
00314        std::vector< std::vector< double > > ecalCalibScaleFactors ;
00315        std::vector< std::vector< double > > crossTermsScaleFactors ;
00316      */
00317   std::vector< double > lowHoverE_smear, highHoverE_smear ;
00318      std::vector< double > hcalCalibScaleFactors,ecalCalibScaleFactors;
00319      std::vector< double > hcalCalibHighScaleFactors,crossTermsScaleFactors;
00320 
00321      if(useCorr) {  //lindsay corrections
00322  
00323        std::vector< std::string > scaleFactorQuery3Strings ;
00324        scaleFactorQuery3Strings.push_back( "SCALEFACTOR" ) ;
00325        scaleFactorQuery3Strings.push_back( "SF2" ) ;
00326        scaleFactorQuery3Strings.push_back( "SF3" ) ;
00327        scaleFactorQuery3Strings.push_back( "FK_RCT_ETA" ) ;
00328 
00329        l1t::OMDSReader::QueryResults hcalCalibResults =
00330          m_omdsReader.basicQuery(
00331                                  scaleFactorQuery3Strings,
00332                                  rctSchema,
00333                                  "HCAL_CALIB_FACTOR",
00334                                  "HCAL_CALIB_FACTOR.VERSION",
00335                                  m_omdsReader.basicQuery( "HCAL_CALIB_VERSION",
00336                                                           rctSchema,
00337                                                           "PAREM_CONF",
00338                                                           "PAREM_CONF.PAREM_KEY",
00339                                                           paremKeyResults ) ) ;
00340 
00341        if( hcalCalibResults.queryFailed() ) {// check query successful
00342          
00343          edm::LogError( "L1-O2O" ) << "Problem with JetmetHcal key." ;
00344          return boost::shared_ptr< L1RCTParameters >() ;
00345        }
00346        
00347 //      std::cout << "jetmetHcal " ;
00348        
00349        fillScaleFactors( hcalCalibResults, hcalCalibScaleFactors, 3 ) ;
00350      
00351        l1t::OMDSReader::QueryResults hcalCalibHighResults =
00352          m_omdsReader.basicQuery(
00353                                  scaleFactorQuery3Strings,
00354                                  rctSchema,
00355                                  "HCAL_CALIB_HIGH_FACTOR",
00356                                  "HCAL_CALIB_HIGH_FACTOR.VERSION",
00357                                  m_omdsReader.basicQuery( "HCAL_CALIB_HIGH_VERSION",
00358                                                           rctSchema,
00359                                                           "PAREM_CONF",
00360                                                           "PAREM_CONF.PAREM_KEY",
00361                                                           paremKeyResults ) ) ;
00362 
00363      if( hcalCalibHighResults.queryFailed() ) // check query successful
00364        {
00365          edm::LogError( "L1-O2O" ) << "Problem with hcalHigh key." ;
00366          return boost::shared_ptr< L1RCTParameters >() ;
00367        }
00368 
00369 
00370 
00371      fillScaleFactors( hcalCalibHighResults, hcalCalibHighScaleFactors,3 ) ;
00372 
00373      l1t::OMDSReader::QueryResults ecalCalibResults =
00374        m_omdsReader.basicQuery(
00375                                scaleFactorQuery3Strings,
00376                                rctSchema,
00377                                  "ECAL_CALIB_FACTOR",
00378                                "ECAL_CALIB_FACTOR.VERSION",
00379                                m_omdsReader.basicQuery( "ECAL_CALIB_VERSION",
00380                                                           rctSchema,
00381                                                         "PAREM_CONF",
00382                                                         "PAREM_CONF.PAREM_KEY",
00383                                                         paremKeyResults ) ) ;
00384 
00385      if( ecalCalibResults.queryFailed() ) // check query successful
00386        {
00387          edm::LogError( "L1-O2O" ) << "Problem with ecal calib key." ;
00388          return boost::shared_ptr< L1RCTParameters >() ;
00389        }
00390 
00391      
00392      fillScaleFactors( ecalCalibResults, ecalCalibScaleFactors,3 ) ;
00393      
00394      
00395      std::vector< std::string > scaleFactorQuery6Strings ;
00396      scaleFactorQuery6Strings.push_back( "SCALEFACTOR" ) ;
00397      scaleFactorQuery6Strings.push_back( "SF2" ) ;
00398      scaleFactorQuery6Strings.push_back( "SF3" ) ;
00399      scaleFactorQuery6Strings.push_back( "SF4" ) ;
00400      scaleFactorQuery6Strings.push_back( "SF5" ) ;
00401      scaleFactorQuery6Strings.push_back( "SF6" ) ;
00402      scaleFactorQuery6Strings.push_back( "FK_RCT_ETA" ) ;
00403      l1t::OMDSReader::QueryResults crossTermResults =
00404        m_omdsReader.basicQuery(
00405                                scaleFactorQuery6Strings,
00406                                rctSchema,
00407                                "CROSS_TERMS_FACTOR",
00408                                "CROSS_TERMS_FACTOR.VERSION",
00409                                m_omdsReader.basicQuery( "CROSS_TERMS_VERSION",
00410                                                         rctSchema,
00411                                                         "PAREM_CONF",
00412                                                         "PAREM_CONF.PAREM_KEY",
00413                                                         paremKeyResults ) ) ;
00414      
00415      if( crossTermResults.queryFailed() ) // check query successful
00416        {
00417          edm::LogError( "L1-O2O" ) << "Problem with crossTerms key." ;
00418          return boost::shared_ptr< L1RCTParameters >() ;
00419        }
00420 
00421      fillScaleFactors( crossTermResults, crossTermsScaleFactors,6 ) ;
00422 
00423      l1t::OMDSReader::QueryResults hoveresmearhighResults =
00424        m_omdsReader.basicQuery(
00425          scaleFactorQueryStrings,
00426          rctSchema,
00427          "H_OVER_E_SMEAR_HIGH_FACTOR",
00428          "H_OVER_E_SMEAR_HIGH_FACTOR.FK_VERSION",
00429          m_omdsReader.basicQuery( "H_OVER_E_SMEAR_HIGH_VERSION",
00430                                   rctSchema,
00431                                   "PAREM_CONF",
00432                                   "PAREM_CONF.PAREM_KEY",
00433                                   paremKeyResults ) ) ;
00434 
00435      if( hoveresmearhighResults.queryFailed() ) // check query successful
00436        {
00437          edm::LogError( "L1-O2O" ) << "Problem with low h over e smear key." ;
00438          return boost::shared_ptr< L1RCTParameters >() ;
00439        }
00440 
00441 //      std::cout << "egammaEcal " ;
00442       fillScaleFactors( hoveresmearhighResults, highHoverE_smear ) ;
00443 
00444 
00445      l1t::OMDSReader::QueryResults hoveresmearlowResults =
00446        m_omdsReader.basicQuery(
00447          scaleFactorQueryStrings,
00448          rctSchema,
00449          "H_OVER_E_SMEAR_LOW_FACTOR",
00450          "H_OVER_E_SMEAR_LOW_FACTOR.FK_VERSION",
00451          m_omdsReader.basicQuery( "H_OVER_E_SMEAR_LOW_VERSION",
00452                                   rctSchema,
00453                                   "PAREM_CONF",
00454                                   "PAREM_CONF.PAREM_KEY",
00455                                   paremKeyResults ) ) ;
00456 
00457      if( hoveresmearlowResults.queryFailed() ) // check query successful
00458        {
00459          edm::LogError( "L1-O2O" ) << "Problem with low h over e smear key." ;
00460          return boost::shared_ptr< L1RCTParameters >() ;
00461        }
00462 
00463 //      std::cout << "egammaEcal " ;
00464       fillScaleFactors( hoveresmearlowResults, lowHoverE_smear ) ;
00465      }
00466 
00467 
00468      //~~~~~~~~~ Instantiate new L1RCTParameters object. ~~~~~~~~~
00469 
00470      // Default objects for Lindsey 
00471 
00472      return boost::shared_ptr< L1RCTParameters >(
00473         new L1RCTParameters( eGammaLSB,
00474                              jetMETLSB,
00475                              eMinForFGCut,
00476                              eMaxForFGCut,
00477                              hOeCut,
00478                              eMinForHoECut,
00479                              eMaxForHoECut,
00480                              hMinForHoECut,
00481                              eActivityCut,
00482                              hActivityCut,
00483                              (unsigned int) eicIsolationThreshold,
00484                              (int) jscQuietThreshBarrel,
00485                              (int) jscQuietThreshEndcap,
00486                              noiseVetoHB,
00487                              noiseVetoHEplus,
00488                              noiseVetoHEminus,
00489                              useCorr, // useLindsey
00490                              egammaEcalScaleFactors,
00491                              egammaHcalScaleFactors,
00492                              jetmetEcalScaleFactors,
00493                              jetmetHcalScaleFactors,
00494                             ecalCalibScaleFactors,
00495                             hcalCalibScaleFactors,
00496                             hcalCalibHighScaleFactors,
00497                             crossTermsScaleFactors,
00498                              lowHoverE_smear,
00499                              highHoverE_smear
00500                              ) ) ;
00501 }
00502 
00503 //
00504 // member functions
00505 //
00506 
00507 void
00508 L1RCTParametersOnlineProd::fillScaleFactors(
00509   const l1t::OMDSReader::QueryResults& results,
00510   std::vector< double >& output, int nfactors )
00511 {
00512   if( (nfactors < 1) || (nfactors > 6)){
00513     edm::LogError( "L1-O2O" ) <<"invalid number of factors in scale factors fill";
00514     return;
00515   }
00516 
00517     std::vector< std::string > scaleFactorQuery6Strings ;
00518     scaleFactorQuery6Strings.push_back( "SCALEFACTOR" ) ;
00519     scaleFactorQuery6Strings.push_back( "SF2" ) ;
00520     scaleFactorQuery6Strings.push_back( "SF3" ) ;
00521     scaleFactorQuery6Strings.push_back( "SF4" ) ;
00522     scaleFactorQuery6Strings.push_back( "SF5" ) ;
00523     scaleFactorQuery6Strings.push_back( "SF6" ) ;
00524        // Store scale factors in temporary array to get ordering right.
00525   // Reserve space for 100 bins.
00526 
00527     //  static const int reserve = 100 ;
00528   std::vector <double> sfTmp[100] ;
00529   /*  
00530   for( int i = 0 ; i < reserve ; ++i )
00531     {
00532       sfTmp[ i ] = 0. ;
00533     }
00534   */
00535   short maxBin = 0 ;
00536   for( int i = 0 ; i < results.numberRows() ; ++i )
00537     {
00538       double sf[6] ;
00539       for(int nf = 0; nf < nfactors; nf++){
00540         results.fillVariableFromRow( scaleFactorQuery6Strings.at(nf), i, sf[nf] ) ;
00541       }
00542       short ieta ;
00543       results.fillVariableFromRow( "FK_RCT_ETA", i, ieta ) ;
00544       
00545       for(int nf = 0; nf< nfactors; nf++)
00546         //      sfTmp[ ieta-1 ] = sf ; // eta bins start at 1.
00547         sfTmp[ieta-1].push_back(sf[nf]);
00548 
00549       if( ieta > maxBin )
00550         {
00551           maxBin = ieta ;
00552         }
00553     }
00554   
00555 
00556   for( short i = 0 ; i < maxBin ; ++i )
00557     {
00558       for( short nf = 0; nf < nfactors; nf++)
00559         output.push_back( sfTmp[ i ].at(nf) ) ;
00560       
00561     }
00562 }
00563 
00564 // ------------ method called to produce the data  ------------
00565 
00566 
00567 //define this as a plug-in
00568 DEFINE_FWK_EVENTSETUP_MODULE(L1RCTParametersOnlineProd);