CMS 3D CMS Logo

RCTConfigProducers.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    RCTConfigProducers
00004 // Class:      RCTConfigProducers
00005 // 
00013 //
00014 // Original Author:  Sridhara Dasu
00015 //         Created:  Mon Jul 16 23:48:35 CEST 2007
00016 // $Id: RCTConfigProducers.cc,v 1.9 2008/05/15 18:49:07 wsun Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include "boost/shared_ptr.hpp"
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/ModuleFactory.h"
00027 #include "FWCore/Framework/interface/ESProducer.h"
00028 #include "FWCore/Framework/interface/ESProducts.h"
00029 #include "FWCore/Framework/interface/ESHandle.h"
00030 
00031 #include "CondFormats/DataRecord/interface/L1RCTParametersRcd.h"
00032 #include "CondFormats/L1TObjects/interface/L1RCTParameters.h"
00033 #include "CondFormats/DataRecord/interface/L1RCTChannelMaskRcd.h"
00034 #include "CondFormats/L1TObjects/interface/L1RCTChannelMask.h"
00035 
00036 //
00037 // class declaration
00038 //
00039 
00040 class RCTConfigProducers : public edm::ESProducer {
00041 public:
00042   RCTConfigProducers(const edm::ParameterSet&);
00043   ~RCTConfigProducers();
00044   
00045   //typedef boost::shared_ptr<L1RCTParameters> ReturnType;
00046   //typedef edm::ESProducts< boost::shared_ptr<L1RCTParameters>, boost::shared_ptr<L1RCTChannelMask> > ReturnType;
00047   
00048   //ReturnType produce(const L1RCTParametersRcd&);
00049   boost::shared_ptr<L1RCTParameters> produceL1RCTParameters(const L1RCTParametersRcd&);
00050   boost::shared_ptr<L1RCTChannelMask> produceL1RCTChannelMask(const L1RCTChannelMaskRcd&);
00051 
00052 private:
00053   // ----------member data ---------------------------
00054   L1RCTParameters *rctParameters;
00055   L1RCTChannelMask *rctChannelMask;
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 RCTConfigProducers::RCTConfigProducers(const edm::ParameterSet& iConfig)
00070 {
00071    //the following line is needed to tell the framework what
00072    // data is being produced
00073    //setWhatProduced(this);
00074   setWhatProduced(this, &RCTConfigProducers::produceL1RCTParameters);
00075   setWhatProduced(this, &RCTConfigProducers::produceL1RCTChannelMask);
00076 
00077    //now do what ever other initialization is needed
00078    rctParameters = 
00079      new L1RCTParameters(iConfig.getParameter<double>("eGammaLSB"),
00080                          iConfig.getParameter<double>("jetMETLSB"),
00081                          iConfig.getParameter<double>("eMinForFGCut"),
00082                          iConfig.getParameter<double>("eMaxForFGCut"),
00083                          iConfig.getParameter<double>("hOeCut"),
00084                          iConfig.getParameter<double>("eMinForHoECut"),
00085                          iConfig.getParameter<double>("eMaxForHoECut"),
00086                          iConfig.getParameter<double>("hMinForHoECut"),
00087                          iConfig.getParameter<double>("eActivityCut"),
00088                          iConfig.getParameter<double>("hActivityCut"),
00089                          iConfig.getParameter<unsigned>("eicIsolationThreshold"),
00090                          iConfig.getParameter<unsigned>("jscQuietThresholdBarrel"),
00091                          iConfig.getParameter<unsigned>("jscQuietThresholdEndcap"),
00092                          iConfig.getParameter<bool>("noiseVetoHB"),
00093                          iConfig.getParameter<bool>("noiseVetoHEplus"),
00094                          iConfig.getParameter<bool>("noiseVetoHEminus"),
00095                          iConfig.getParameter<std::vector< double > >("eGammaECalScaleFactors"),
00096                          iConfig.getParameter<std::vector< double > >("eGammaHCalScaleFactors"),
00097                          iConfig.getParameter<std::vector< double > >("jetMETECalScaleFactors"),
00098                          iConfig.getParameter<std::vector< double > >("jetMETHCalScaleFactors")
00099                          );
00100 
00101    // value of true if channel is masked, false if not masked
00102    rctChannelMask = new L1RCTChannelMask ;
00103    for (int i = 0; i < 18; i++)
00104      {
00105        for (int j = 0; j < 2; j++)
00106          {
00107            for (int k = 0; k < 28; k++)
00108              {
00109                rctChannelMask->ecalMask[i][j][k] = false;
00110                rctChannelMask->hcalMask[i][j][k] = false;
00111              }
00112            for (int k = 0; k < 4; k++)
00113              {
00114                rctChannelMask->hfMask[i][j][k] = false;
00115              }
00116          }
00117      }
00118 }
00119 
00120 
00121 RCTConfigProducers::~RCTConfigProducers()
00122 {
00123  
00124    // do anything here that needs to be done at desctruction time
00125    // (e.g. close files, deallocate resources etc.)
00126 
00127 }
00128 
00129 
00130 //
00131 // member functions
00132 //
00133 
00134 // ------------ method called to produce the data  ------------
00135 //RCTConfigProducers::ReturnType
00136 boost::shared_ptr<L1RCTParameters>
00137 RCTConfigProducers::produceL1RCTParameters(const L1RCTParametersRcd& iRecord)
00138 {
00139    using namespace edm::es;
00140    boost::shared_ptr<L1RCTParameters> pL1RCTParameters =
00141      (boost::shared_ptr<L1RCTParameters>) rctParameters;
00142    return pL1RCTParameters ;
00143    //return products( pL1RCTParameters, pL1RCTChannelMask );
00144 }
00145 
00146 boost::shared_ptr<L1RCTChannelMask>
00147 RCTConfigProducers::produceL1RCTChannelMask(const L1RCTChannelMaskRcd& iRecord)
00148 {
00149   using namespace edm::es;
00150    boost::shared_ptr<L1RCTChannelMask> pL1RCTChannelMask =
00151      (boost::shared_ptr<L1RCTChannelMask>) rctChannelMask;
00152    return pL1RCTChannelMask ;
00153 }
00154 
00155 //define this as a plug-in
00156 DEFINE_FWK_EVENTSETUP_MODULE(RCTConfigProducers);

Generated on Tue Jun 9 17:40:28 2009 for CMSSW by  doxygen 1.5.4