CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1TriggerKeyOnlineProd
00004 // Class:      L1TriggerKeyOnlineProd
00005 // 
00013 //
00014 // Original Author:  Werner Man-Li Sun
00015 //         Created:  Sun Mar  2 03:03:32 CET 2008
00016 // $Id: L1TriggerKeyOnlineProd.cc,v 1.11 2010/02/01 22:00:03 wsun Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 
00023 // user include files
00024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00025 
00026 #include "CondTools/L1Trigger/plugins/L1TriggerKeyOnlineProd.h"
00027 
00028 #include "CondTools/L1Trigger/interface/Exception.h"
00029 
00030 #include "FWCore/Framework/interface/EventSetup.h"
00031 
00032 //
00033 // class declaration
00034 //
00035 
00036 //
00037 // constants, enums and typedefs
00038 //
00039 
00040 //
00041 // static data member definitions
00042 //
00043 
00044 //
00045 // constructors and destructor
00046 //
00047 L1TriggerKeyOnlineProd::L1TriggerKeyOnlineProd(const edm::ParameterSet& iConfig)
00048   : m_subsystemLabels( iConfig.getParameter< std::vector< std::string > >(
00049       "subsystemLabels" ) )
00050 {
00051    //the following line is needed to tell the framework what
00052    // data is being produced
00053    setWhatProduced(this);
00054 
00055    //now do what ever other initialization is needed
00056 }
00057 
00058 
00059 L1TriggerKeyOnlineProd::~L1TriggerKeyOnlineProd()
00060 {
00061  
00062    // do anything here that needs to be done at desctruction time
00063    // (e.g. close files, deallocate resources etc.)
00064 
00065 }
00066 
00067 
00068 //
00069 // member functions
00070 //
00071 
00072 // ------------ method called to produce the data  ------------
00073 L1TriggerKeyOnlineProd::ReturnType
00074 L1TriggerKeyOnlineProd::produce(const L1TriggerKeyRcd& iRecord)
00075 {
00076    using namespace edm::es;
00077 
00078    // Start with "SubsystemKeysOnly"
00079    edm::ESHandle< L1TriggerKey > subsystemKeys ;
00080    try
00081      {
00082        iRecord.get( "SubsystemKeysOnly", subsystemKeys ) ;
00083      }
00084    catch( l1t::DataAlreadyPresentException& ex )
00085      {
00086        throw ex ;
00087      }
00088 
00089    boost::shared_ptr<L1TriggerKey> pL1TriggerKey ;
00090    pL1TriggerKey = boost::shared_ptr< L1TriggerKey >(
00091      new L1TriggerKey( *subsystemKeys ) ) ;
00092 
00093   // Collate object keys
00094   std::vector< std::string >::const_iterator itr = m_subsystemLabels.begin() ;
00095   std::vector< std::string >::const_iterator end = m_subsystemLabels.end() ;
00096   for( ; itr != end ; ++itr )
00097     {
00098       edm::ESHandle< L1TriggerKey > objectKeys ;
00099       try
00100         {
00101           iRecord.get( *itr, objectKeys ) ;
00102         }
00103       catch( l1t::DataAlreadyPresentException& ex )
00104         {
00105           throw ex ;
00106         }
00107 
00108       pL1TriggerKey->add( objectKeys->recordToKeyMap() ) ;
00109     }
00110 
00111    return pL1TriggerKey ;
00112 }
00113 
00114 //define this as a plug-in
00115 //DEFINE_FWK_EVENTSETUP_MODULE(L1TriggerKeyOnlineProd);