CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/L1TriggerConfig/L1ScalesProducers/src/L1HtMissScaleOnlineProd.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1HtMissScaleOnlineProd
00004 // Class:      L1HtMissScaleOnlineProd
00005 // 
00013 //
00014 // Original Author:  Werner Man-Li Sun
00015 //         Created:  Tue Sep 16 22:43:22 CEST 2008
00016 // $Id: L1HtMissScaleOnlineProd.cc,v 1.5 2010/06/30 08:58:05 jbrooke 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/L1CaloEtScale.h"
00027 #include "CondFormats/DataRecord/interface/L1HtMissScaleRcd.h"
00028 
00029 
00030 //
00031 // class declaration
00032 //
00033 
00034 class L1HtMissScaleOnlineProd :
00035   public L1ConfigOnlineProdBase< L1HtMissScaleRcd, L1CaloEtScale > {
00036    public:
00037       L1HtMissScaleOnlineProd(const edm::ParameterSet&);
00038       ~L1HtMissScaleOnlineProd();
00039 
00040   virtual boost::shared_ptr< L1CaloEtScale > newObject(
00041     const std::string& objectKey ) ;
00042 
00043 
00044    private:
00045       // ----------member data ---------------------------
00046 };
00047 
00048 //
00049 // constants, enums and typedefs
00050 //
00051 
00052 //
00053 // static data member definitions
00054 //
00055 
00056 //
00057 // constructors and destructor
00058 //
00059 L1HtMissScaleOnlineProd::L1HtMissScaleOnlineProd(
00060   const edm::ParameterSet& iConfig)
00061   : L1ConfigOnlineProdBase< L1HtMissScaleRcd, L1CaloEtScale >( iConfig )
00062 {
00063    //the following line is needed to tell the framework what
00064    // data is being produced
00065 
00066    //now do what ever other initialization is needed
00067 }
00068 
00069 
00070 L1HtMissScaleOnlineProd::~L1HtMissScaleOnlineProd()
00071 {
00072  
00073    // do anything here that needs to be done at desctruction time
00074    // (e.g. close files, deallocate resources etc.)
00075 
00076 }
00077 
00078 boost::shared_ptr< L1CaloEtScale >
00079 L1HtMissScaleOnlineProd::newObject( const std::string& objectKey )
00080 {
00081   using namespace edm::es;
00082      // get scales keys
00083      l1t::OMDSReader::QueryResults scalesKeyResults =
00084        m_omdsReader.basicQuery(
00085                                "GCT_SCALES_KEY",
00086                                "CMS_GCT",
00087                                "GCT_PHYS_PARAMS",
00088                                "GCT_PHYS_PARAMS.CONFIG_KEY",
00089                                m_omdsReader.singleAttribute( objectKey ) );
00090      
00091      std::string scalesKey ;
00092      
00093      if( scalesKeyResults.queryFailed() ) {
00094        edm::LogError("L1-O2O")
00095          << "Problem with key for L1HtMissScaleRcd : GCT scales key query failed ";
00096      }
00097      else if( scalesKeyResults.numberRows() != 1 ) {
00098        edm::LogError("L1-O2O")
00099          << "Problem with key for L1HtMissScaleRcd : "
00100          << (scalesKeyResults.numberRows()) << " rows were returned when getting GCT scales key";
00101      }
00102      else {
00103        scalesKeyResults.fillVariable( scalesKey );
00104      }
00105 
00106      edm::LogInfo("L1-O2O") << "L1 scales key : " << scalesKey << std::endl;     
00107 
00108      // get jet scale key
00109      l1t::OMDSReader::QueryResults htmScaleKeyResults =
00110        m_omdsReader.basicQuery(
00111                                "SC_HTM_FK",
00112                                "CMS_GT",
00113                                "L1T_SCALES",
00114                                "L1T_SCALES.ID",
00115                                scalesKeyResults );
00116 
00117      std::string htmScaleKey ;
00118 
00119      if( htmScaleKeyResults.queryFailed() ) {
00120        edm::LogError("L1-O2O")
00121          << "Problem with key for L1HtMissEtScaleRcd : HtMiss scale key query failed ";
00122      }
00123      else if( htmScaleKeyResults.numberRows() != 1 ) {
00124        edm::LogError("L1-O2O")
00125          << "Problem with key for L1HtMissScaleRcd : "
00126          << (htmScaleKeyResults.numberRows()) << " rows were returned when getting HtMiss scale key";
00127      }
00128      else {
00129        htmScaleKeyResults.fillVariable( htmScaleKey ) ;
00130      }
00131      
00132      edm::LogInfo("L1-O2O") << "L1HtMiss scale key : " << htmScaleKey << std::endl;
00133 
00134      // get thresholds
00135      std::vector< std::string > queryStrings ;
00136      queryStrings.push_back( "E_GEV_BIN_LOW_0");
00137      queryStrings.push_back( "E_GEV_BIN_LOW_1");
00138      queryStrings.push_back( "E_GEV_BIN_LOW_2");
00139      queryStrings.push_back( "E_GEV_BIN_LOW_3");
00140      queryStrings.push_back( "E_GEV_BIN_LOW_4");
00141      queryStrings.push_back( "E_GEV_BIN_LOW_5");
00142      queryStrings.push_back( "E_GEV_BIN_LOW_6");
00143      queryStrings.push_back( "E_GEV_BIN_LOW_7");
00144      queryStrings.push_back( "E_GEV_BIN_LOW_8");
00145      queryStrings.push_back( "E_GEV_BIN_LOW_9");
00146      queryStrings.push_back( "E_GEV_BIN_LOW_10");
00147      queryStrings.push_back( "E_GEV_BIN_LOW_11");
00148      queryStrings.push_back( "E_GEV_BIN_LOW_12");
00149      queryStrings.push_back( "E_GEV_BIN_LOW_13");
00150      queryStrings.push_back( "E_GEV_BIN_LOW_14");
00151      queryStrings.push_back( "E_GEV_BIN_LOW_15");
00152      queryStrings.push_back( "E_GEV_BIN_LOW_16");
00153      queryStrings.push_back( "E_GEV_BIN_LOW_17");
00154      queryStrings.push_back( "E_GEV_BIN_LOW_18");
00155      queryStrings.push_back( "E_GEV_BIN_LOW_19");
00156      queryStrings.push_back( "E_GEV_BIN_LOW_20");
00157      queryStrings.push_back( "E_GEV_BIN_LOW_21");
00158      queryStrings.push_back( "E_GEV_BIN_LOW_22");
00159      queryStrings.push_back( "E_GEV_BIN_LOW_23");
00160      queryStrings.push_back( "E_GEV_BIN_LOW_24");
00161      queryStrings.push_back( "E_GEV_BIN_LOW_25");
00162      queryStrings.push_back( "E_GEV_BIN_LOW_26");
00163      queryStrings.push_back( "E_GEV_BIN_LOW_27");
00164      queryStrings.push_back( "E_GEV_BIN_LOW_28");
00165      queryStrings.push_back( "E_GEV_BIN_LOW_29");
00166      queryStrings.push_back( "E_GEV_BIN_LOW_30");
00167      queryStrings.push_back( "E_GEV_BIN_LOW_31");
00168      queryStrings.push_back( "E_GEV_BIN_LOW_32");
00169      queryStrings.push_back( "E_GEV_BIN_LOW_33");
00170      queryStrings.push_back( "E_GEV_BIN_LOW_34");
00171      queryStrings.push_back( "E_GEV_BIN_LOW_35");
00172      queryStrings.push_back( "E_GEV_BIN_LOW_36");
00173      queryStrings.push_back( "E_GEV_BIN_LOW_37");
00174      queryStrings.push_back( "E_GEV_BIN_LOW_38");
00175      queryStrings.push_back( "E_GEV_BIN_LOW_39");
00176      queryStrings.push_back( "E_GEV_BIN_LOW_40");
00177      queryStrings.push_back( "E_GEV_BIN_LOW_41");
00178      queryStrings.push_back( "E_GEV_BIN_LOW_42");
00179      queryStrings.push_back( "E_GEV_BIN_LOW_43");
00180      queryStrings.push_back( "E_GEV_BIN_LOW_44");
00181      queryStrings.push_back( "E_GEV_BIN_LOW_45");
00182      queryStrings.push_back( "E_GEV_BIN_LOW_46");
00183      queryStrings.push_back( "E_GEV_BIN_LOW_47");
00184      queryStrings.push_back( "E_GEV_BIN_LOW_48");
00185      queryStrings.push_back( "E_GEV_BIN_LOW_49");
00186      queryStrings.push_back( "E_GEV_BIN_LOW_50");
00187      queryStrings.push_back( "E_GEV_BIN_LOW_51");
00188      queryStrings.push_back( "E_GEV_BIN_LOW_52");
00189      queryStrings.push_back( "E_GEV_BIN_LOW_53");
00190      queryStrings.push_back( "E_GEV_BIN_LOW_54");
00191      queryStrings.push_back( "E_GEV_BIN_LOW_55");
00192      queryStrings.push_back( "E_GEV_BIN_LOW_56");
00193      queryStrings.push_back( "E_GEV_BIN_LOW_57");
00194      queryStrings.push_back( "E_GEV_BIN_LOW_58");
00195      queryStrings.push_back( "E_GEV_BIN_LOW_59");
00196      queryStrings.push_back( "E_GEV_BIN_LOW_60");
00197      queryStrings.push_back( "E_GEV_BIN_LOW_61");
00198      queryStrings.push_back( "E_GEV_BIN_LOW_62");
00199      queryStrings.push_back( "E_GEV_BIN_LOW_63");
00200      queryStrings.push_back( "E_GEV_BIN_LOW_64");
00201      queryStrings.push_back( "E_GEV_BIN_LOW_65");
00202      queryStrings.push_back( "E_GEV_BIN_LOW_66");
00203      queryStrings.push_back( "E_GEV_BIN_LOW_67");
00204      queryStrings.push_back( "E_GEV_BIN_LOW_68");
00205      queryStrings.push_back( "E_GEV_BIN_LOW_69");
00206      queryStrings.push_back( "E_GEV_BIN_LOW_70");
00207      queryStrings.push_back( "E_GEV_BIN_LOW_71");
00208      queryStrings.push_back( "E_GEV_BIN_LOW_72");
00209      queryStrings.push_back( "E_GEV_BIN_LOW_73");
00210      queryStrings.push_back( "E_GEV_BIN_LOW_74");
00211      queryStrings.push_back( "E_GEV_BIN_LOW_75");
00212      queryStrings.push_back( "E_GEV_BIN_LOW_76");
00213      queryStrings.push_back( "E_GEV_BIN_LOW_77");
00214      queryStrings.push_back( "E_GEV_BIN_LOW_78");
00215      queryStrings.push_back( "E_GEV_BIN_LOW_79");
00216      queryStrings.push_back( "E_GEV_BIN_LOW_80");
00217      queryStrings.push_back( "E_GEV_BIN_LOW_81");
00218      queryStrings.push_back( "E_GEV_BIN_LOW_82");
00219      queryStrings.push_back( "E_GEV_BIN_LOW_83");
00220      queryStrings.push_back( "E_GEV_BIN_LOW_84");
00221      queryStrings.push_back( "E_GEV_BIN_LOW_85");
00222      queryStrings.push_back( "E_GEV_BIN_LOW_86");
00223      queryStrings.push_back( "E_GEV_BIN_LOW_87");
00224      queryStrings.push_back( "E_GEV_BIN_LOW_88");
00225      queryStrings.push_back( "E_GEV_BIN_LOW_89");
00226      queryStrings.push_back( "E_GEV_BIN_LOW_90");
00227      queryStrings.push_back( "E_GEV_BIN_LOW_91");
00228      queryStrings.push_back( "E_GEV_BIN_LOW_92");
00229      queryStrings.push_back( "E_GEV_BIN_LOW_93");
00230      queryStrings.push_back( "E_GEV_BIN_LOW_94");
00231      queryStrings.push_back( "E_GEV_BIN_LOW_95");
00232      queryStrings.push_back( "E_GEV_BIN_LOW_96");
00233      queryStrings.push_back( "E_GEV_BIN_LOW_97");
00234      queryStrings.push_back( "E_GEV_BIN_LOW_98");
00235      queryStrings.push_back( "E_GEV_BIN_LOW_99");
00236      queryStrings.push_back( "E_GEV_BIN_LOW_100");
00237      queryStrings.push_back( "E_GEV_BIN_LOW_101");
00238      queryStrings.push_back( "E_GEV_BIN_LOW_102");
00239      queryStrings.push_back( "E_GEV_BIN_LOW_103");
00240      queryStrings.push_back( "E_GEV_BIN_LOW_104");
00241      queryStrings.push_back( "E_GEV_BIN_LOW_105");
00242      queryStrings.push_back( "E_GEV_BIN_LOW_106");
00243      queryStrings.push_back( "E_GEV_BIN_LOW_107");
00244      queryStrings.push_back( "E_GEV_BIN_LOW_108");
00245      queryStrings.push_back( "E_GEV_BIN_LOW_109");
00246      queryStrings.push_back( "E_GEV_BIN_LOW_110");
00247      queryStrings.push_back( "E_GEV_BIN_LOW_111");
00248      queryStrings.push_back( "E_GEV_BIN_LOW_112");
00249      queryStrings.push_back( "E_GEV_BIN_LOW_113");
00250      queryStrings.push_back( "E_GEV_BIN_LOW_114");
00251      queryStrings.push_back( "E_GEV_BIN_LOW_115");
00252      queryStrings.push_back( "E_GEV_BIN_LOW_116");
00253      queryStrings.push_back( "E_GEV_BIN_LOW_117");
00254      queryStrings.push_back( "E_GEV_BIN_LOW_118");
00255      queryStrings.push_back( "E_GEV_BIN_LOW_119");
00256      queryStrings.push_back( "E_GEV_BIN_LOW_120");
00257      queryStrings.push_back( "E_GEV_BIN_LOW_121");
00258      queryStrings.push_back( "E_GEV_BIN_LOW_122");
00259      queryStrings.push_back( "E_GEV_BIN_LOW_123");
00260      queryStrings.push_back( "E_GEV_BIN_LOW_124");
00261      queryStrings.push_back( "E_GEV_BIN_LOW_125");
00262      queryStrings.push_back( "E_GEV_BIN_LOW_126");
00263      queryStrings.push_back( "E_GEV_BIN_LOW_127");
00264 
00265      l1t::OMDSReader::QueryResults scaleResults =
00266        m_omdsReader.basicQuery( queryStrings,
00267                                 "CMS_GT",
00268                                 "L1T_SCALE_HTM_ENERGY",
00269                                 "L1T_SCALE_HTM_ENERGY.ID",
00270                                 htmScaleKeyResults
00271                                 );
00272 
00273      // L1T_SCALE_HTM_ENERGY
00274 
00275      std::vector<double> thresholds;
00276 
00277      if( scaleResults.queryFailed() ||
00278          scaleResults.numberRows() != 1 ) // check query successful
00279        {
00280          edm::LogError( "L1-O2O" ) << "Problem with L1HtMissScale key : when reading scale." ;
00281        }
00282      else {
00283        for( std::vector< std::string >::iterator thresh = queryStrings.begin();
00284             thresh != queryStrings.end(); ++thresh) {
00285          float tempScale;
00286          scaleResults.fillVariable(*thresh,tempScale);
00287          thresholds.push_back(tempScale);
00288        }
00289      }
00290 
00291      // get region LSB
00292      double rgnEtLsb=0.;
00293 
00294      l1t::OMDSReader::QueryResults lsbResults =
00295        m_omdsReader.basicQuery( "GCT_RGN_ET_LSB",
00296                                 "CMS_GCT",
00297                                 "GCT_PHYS_PARAMS",
00298                                 "GCT_PHYS_PARAMS.CONFIG_KEY",
00299                                 m_omdsReader.singleAttribute( objectKey ) ) ;
00300      
00301      if( lsbResults.queryFailed() ) {
00302          edm::LogError( "L1-O2O" ) << "Problem with L1HtMissScale key." ;
00303      }
00304      else {
00305       lsbResults.fillVariable( "GCT_RGN_ET_LSB", rgnEtLsb );
00306      }
00307 
00308      // return object
00309      return boost::shared_ptr< L1CaloEtScale >( new L1CaloEtScale( 0, 0x7f, rgnEtLsb, thresholds ) );
00310 
00311 }
00312 
00313 
00314 // ------------ method called to produce the data  ------------
00315 
00316 
00317 //define this as a plug-in
00318 DEFINE_FWK_EVENTSETUP_MODULE(L1HtMissScaleOnlineProd);