CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/L1TriggerConfig/L1ScalesProducers/src/L1EmEtScaleOnlineProd.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1EmEtScaleOnlineProd
00004 // Class:      L1EmEtScaleOnlineProd
00005 // 
00013 //
00014 // Original Author:  Werner Man-Li Sun
00015 //         Created:  Tue Sep 16 22:43:22 CEST 2008
00016 // $Id: L1EmEtScaleOnlineProd.cc,v 1.2 2009/10/06 13:42:13 efron 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/L1EmEtScaleRcd.h"
00028 
00029 
00030 //
00031 // class declaration
00032 //
00033 
00034 class L1EmEtScaleOnlineProd :
00035   public L1ConfigOnlineProdBase< L1EmEtScaleRcd, L1CaloEtScale > {
00036    public:
00037       L1EmEtScaleOnlineProd(const edm::ParameterSet&);
00038       ~L1EmEtScaleOnlineProd();
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 L1EmEtScaleOnlineProd::L1EmEtScaleOnlineProd(
00060   const edm::ParameterSet& iConfig)
00061   : L1ConfigOnlineProdBase< L1EmEtScaleRcd, 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 L1EmEtScaleOnlineProd::~L1EmEtScaleOnlineProd()
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 L1EmEtScaleOnlineProd::newObject( const std::string& objectKey )
00080 {
00081      using namespace edm::es;
00082 
00083      // ~~~~~~~~~ Cut values ~~~~~~~~~
00084 
00085 
00086      std::vector< std::string > queryStrings ;
00087      queryStrings.push_back( "ET_GEV_BIN_LOW_0");
00088      queryStrings.push_back( "ET_GEV_BIN_LOW_1");
00089      queryStrings.push_back( "ET_GEV_BIN_LOW_2");
00090      queryStrings.push_back( "ET_GEV_BIN_LOW_3");
00091      queryStrings.push_back( "ET_GEV_BIN_LOW_4");
00092      queryStrings.push_back( "ET_GEV_BIN_LOW_5");
00093      queryStrings.push_back( "ET_GEV_BIN_LOW_6");
00094      queryStrings.push_back( "ET_GEV_BIN_LOW_7");
00095      queryStrings.push_back( "ET_GEV_BIN_LOW_8");
00096      queryStrings.push_back( "ET_GEV_BIN_LOW_9");
00097      queryStrings.push_back( "ET_GEV_BIN_LOW_10");
00098      queryStrings.push_back( "ET_GEV_BIN_LOW_11");
00099      queryStrings.push_back( "ET_GEV_BIN_LOW_12");
00100      queryStrings.push_back( "ET_GEV_BIN_LOW_13");
00101      queryStrings.push_back( "ET_GEV_BIN_LOW_14");
00102      queryStrings.push_back( "ET_GEV_BIN_LOW_15");
00103      queryStrings.push_back( "ET_GEV_BIN_LOW_16");
00104      queryStrings.push_back( "ET_GEV_BIN_LOW_17");
00105      queryStrings.push_back( "ET_GEV_BIN_LOW_18");
00106      queryStrings.push_back( "ET_GEV_BIN_LOW_19");
00107      queryStrings.push_back( "ET_GEV_BIN_LOW_20");
00108      queryStrings.push_back( "ET_GEV_BIN_LOW_21");
00109      queryStrings.push_back( "ET_GEV_BIN_LOW_22");
00110      queryStrings.push_back( "ET_GEV_BIN_LOW_23");
00111      queryStrings.push_back( "ET_GEV_BIN_LOW_24");
00112      queryStrings.push_back( "ET_GEV_BIN_LOW_25");
00113      queryStrings.push_back( "ET_GEV_BIN_LOW_26");
00114      queryStrings.push_back( "ET_GEV_BIN_LOW_27");
00115      queryStrings.push_back( "ET_GEV_BIN_LOW_28");
00116      queryStrings.push_back( "ET_GEV_BIN_LOW_29");
00117      queryStrings.push_back( "ET_GEV_BIN_LOW_30");
00118      queryStrings.push_back( "ET_GEV_BIN_LOW_31");
00119      queryStrings.push_back( "ET_GEV_BIN_LOW_32");
00120      queryStrings.push_back( "ET_GEV_BIN_LOW_33");
00121      queryStrings.push_back( "ET_GEV_BIN_LOW_34");
00122      queryStrings.push_back( "ET_GEV_BIN_LOW_35");
00123      queryStrings.push_back( "ET_GEV_BIN_LOW_36");
00124      queryStrings.push_back( "ET_GEV_BIN_LOW_37");
00125      queryStrings.push_back( "ET_GEV_BIN_LOW_38");
00126      queryStrings.push_back( "ET_GEV_BIN_LOW_39");
00127      queryStrings.push_back( "ET_GEV_BIN_LOW_40");
00128      queryStrings.push_back( "ET_GEV_BIN_LOW_41");
00129      queryStrings.push_back( "ET_GEV_BIN_LOW_42");
00130      queryStrings.push_back( "ET_GEV_BIN_LOW_43");
00131      queryStrings.push_back( "ET_GEV_BIN_LOW_44");
00132      queryStrings.push_back( "ET_GEV_BIN_LOW_45");
00133      queryStrings.push_back( "ET_GEV_BIN_LOW_46");
00134      queryStrings.push_back( "ET_GEV_BIN_LOW_47");
00135      queryStrings.push_back( "ET_GEV_BIN_LOW_48");
00136      queryStrings.push_back( "ET_GEV_BIN_LOW_49");
00137      queryStrings.push_back( "ET_GEV_BIN_LOW_50");
00138      queryStrings.push_back( "ET_GEV_BIN_LOW_51");
00139      queryStrings.push_back( "ET_GEV_BIN_LOW_52");
00140      queryStrings.push_back( "ET_GEV_BIN_LOW_53");
00141      queryStrings.push_back( "ET_GEV_BIN_LOW_54");
00142      queryStrings.push_back( "ET_GEV_BIN_LOW_55");
00143      queryStrings.push_back( "ET_GEV_BIN_LOW_56");
00144      queryStrings.push_back( "ET_GEV_BIN_LOW_57");
00145      queryStrings.push_back( "ET_GEV_BIN_LOW_58");
00146      queryStrings.push_back( "ET_GEV_BIN_LOW_59");
00147      queryStrings.push_back( "ET_GEV_BIN_LOW_60");
00148      queryStrings.push_back( "ET_GEV_BIN_LOW_61");
00149      queryStrings.push_back( "ET_GEV_BIN_LOW_62");
00150      queryStrings.push_back( "ET_GEV_BIN_LOW_63");
00151 
00152      const l1t::OMDSReader::QueryResults scaleKeyResults =
00153        m_omdsReader.singleAttribute( objectKey ) ;
00154 
00155     
00156      l1t::OMDSReader::QueryResults scaleResults =
00157        m_omdsReader.basicQuery( queryStrings,
00158                                 "CMS_GT",
00159                                 "L1T_SCALE_CALO_ET_THRESHOLD",
00160                                 "L1T_SCALE_CALO_ET_THRESHOLD.ID",
00161                                 m_omdsReader.basicQuery( "L1T_SCALE_CALO_ET_THRESHOLD_ID",
00162                                                         "CMS_RCT",
00163                                                         "L1CALOEMETTHRESH",
00164                                                         "L1CALOEMETTHRESH.NAME",
00165                                                         scaleKeyResults
00166                                                         ));
00167 
00168 
00169 
00170      if( scaleResults.queryFailed() ||
00171          scaleResults.numberRows() != 1 ) // check query successful
00172        {
00173          edm::LogError( "L1-O2O" ) << "Problem with L1EmEtScale key." ;
00174          return boost::shared_ptr< L1CaloEtScale >() ;
00175        }
00176      std::vector<double> m_thresholds;
00177 
00178      for( std::vector< std::string >::iterator thresh = queryStrings.begin();
00179           thresh != queryStrings.end(); ++thresh) {
00180        float tempScale;
00181        scaleResults.fillVariable(*thresh,tempScale);
00182        m_thresholds.push_back(tempScale);
00183      }
00184   
00185      l1t::OMDSReader::QueryResults lsbResults =
00186        m_omdsReader.basicQuery("INPUTLSB",
00187                                "CMS_RCT",
00188                                "L1CALOEMETTHRESH",
00189                                "L1CALOEMETTHRESH.NAME",
00190                                scaleKeyResults
00191                                );
00192    if( lsbResults.queryFailed() ||
00193          lsbResults.numberRows() != 1 ) // check query successful
00194        {
00195          edm::LogError( "L1-O2O" ) << "Problem with L1EmEtScale key." ;
00196          return boost::shared_ptr< L1CaloEtScale >() ;
00197        }
00198 
00199      double m_lsb;
00200      lsbResults.fillVariable(m_lsb);
00201 
00202      //     std::cout << " input lsb " << m_lsb <<std::endl;
00203 
00204      //~~~~~~~~~ Instantiate new L1EmEtScale object. ~~~~~~~~~
00205 
00206      // Default objects for Lindsey 
00207 
00208      return boost::shared_ptr< L1CaloEtScale >( new L1CaloEtScale( m_lsb,m_thresholds ) );
00209 }
00210 
00211 
00212 // ------------ method called to produce the data  ------------
00213 
00214 
00215 //define this as a plug-in
00216 DEFINE_FWK_EVENTSETUP_MODULE(L1EmEtScaleOnlineProd);