CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/L1TriggerConfig/RCTConfigProducers/src/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.12 2010/05/07 14:41:48 bachtis 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 #include "CondFormats/DataRecord/interface/L1RCTNoisyChannelMaskRcd.h"
00036 #include "CondFormats/L1TObjects/interface/L1RCTNoisyChannelMask.h"
00037 
00038 //
00039 // class declaration
00040 //
00041 
00042 class RCTConfigProducers : public edm::ESProducer {
00043 public:
00044   RCTConfigProducers(const edm::ParameterSet&);
00045   ~RCTConfigProducers();
00046   
00047   //typedef boost::shared_ptr<L1RCTParameters> ReturnType;
00048   //typedef edm::ESProducts< boost::shared_ptr<L1RCTParameters>, boost::shared_ptr<L1RCTChannelMask> > ReturnType;
00049   
00050   //ReturnType produce(const L1RCTParametersRcd&);
00051   boost::shared_ptr<L1RCTParameters> produceL1RCTParameters(const L1RCTParametersRcd&);
00052   boost::shared_ptr<L1RCTChannelMask> produceL1RCTChannelMask(const L1RCTChannelMaskRcd&);
00053   boost::shared_ptr<L1RCTNoisyChannelMask> produceL1RCTNoisyChannelMask(const L1RCTNoisyChannelMaskRcd&);
00054 
00055 private:
00056   // ----------member data ---------------------------
00057   L1RCTParameters rctParameters;
00058   L1RCTChannelMask rctChannelMask;
00059   L1RCTNoisyChannelMask rctNoisyChannelMask;
00060 };
00061 
00062 //
00063 // constants, enums and typedefs
00064 //
00065 
00066 //
00067 // static data member definitions
00068 //
00069 
00070 //
00071 // constructors and destructor
00072 //
00073 RCTConfigProducers::RCTConfigProducers(const edm::ParameterSet& iConfig)
00074 {
00075    //the following line is needed to tell the framework what
00076    // data is being produced
00077    //setWhatProduced(this);
00078   setWhatProduced(this, &RCTConfigProducers::produceL1RCTParameters);
00079   setWhatProduced(this, &RCTConfigProducers::produceL1RCTChannelMask);
00080   setWhatProduced(this, &RCTConfigProducers::produceL1RCTNoisyChannelMask);
00081 
00082    //now do what ever other initialization is needed
00083    rctParameters = 
00084      L1RCTParameters(iConfig.getParameter<double>("eGammaLSB"),
00085                          iConfig.getParameter<double>("jetMETLSB"),
00086                          iConfig.getParameter<double>("eMinForFGCut"),
00087                          iConfig.getParameter<double>("eMaxForFGCut"),
00088                          iConfig.getParameter<double>("hOeCut"),
00089                          iConfig.getParameter<double>("eMinForHoECut"),
00090                          iConfig.getParameter<double>("eMaxForHoECut"),
00091                          iConfig.getParameter<double>("hMinForHoECut"),
00092                          iConfig.getParameter<double>("eActivityCut"),
00093                          iConfig.getParameter<double>("hActivityCut"),
00094                          iConfig.getParameter<unsigned>("eicIsolationThreshold"),
00095                          iConfig.getParameter<unsigned>("jscQuietThresholdBarrel"),
00096                          iConfig.getParameter<unsigned>("jscQuietThresholdEndcap"),
00097                          iConfig.getParameter<bool>("noiseVetoHB"),
00098                          iConfig.getParameter<bool>("noiseVetoHEplus"),
00099                          iConfig.getParameter<bool>("noiseVetoHEminus"),
00100                          iConfig.getParameter<bool>("useCorrectionsLindsey"),
00101                          iConfig.getParameter<std::vector< double > >("eGammaECalScaleFactors"),
00102                          iConfig.getParameter<std::vector< double > >("eGammaHCalScaleFactors"),
00103                          iConfig.getParameter<std::vector< double > >("jetMETECalScaleFactors"),
00104                          iConfig.getParameter<std::vector< double > >("jetMETHCalScaleFactors"),
00105                          iConfig.getParameter<std::vector< double > >("ecal_calib_Lindsey"),
00106                          iConfig.getParameter<std::vector< double > >("hcal_calib_Lindsey"),
00107                          iConfig.getParameter<std::vector< double > >("hcal_high_calib_Lindsey"),
00108                          iConfig.getParameter<std::vector< double > >("cross_terms_Lindsey"),
00109                          iConfig.getParameter<std::vector< double > >("HoverE_low_Lindsey"),
00110                          iConfig.getParameter<std::vector< double > >("HoverE_high_Lindsey")
00111                          );
00112 
00113 
00114 
00115    // value of true if channel is masked, false if not masked
00116    for (int i = 0; i < 18; i++)
00117      {
00118        for (int j = 0; j < 2; j++)
00119          {
00120            for (int k = 0; k < 28; k++)
00121              {
00122                rctChannelMask.ecalMask[i][j][k] = false;
00123                rctChannelMask.hcalMask[i][j][k] = false;
00124              }
00125            for (int k = 0; k < 4; k++)
00126              {
00127                rctChannelMask.hfMask[i][j][k] = false;
00128              }
00129          }
00130      }
00131 
00132 
00133 
00134    //Now the hot tower mask
00135    
00136    //first the thresholds
00137    
00138    rctNoisyChannelMask.ecalThreshold = 0.0;
00139    rctNoisyChannelMask.hcalThreshold = 0.0;
00140    rctNoisyChannelMask.hfThreshold = 0.0;
00141 
00142    for (int i = 0; i < 18; i++)
00143      {
00144        for (int j = 0; j < 2; j++)
00145          {
00146            for (int k = 0; k < 28; k++)
00147              {
00148                rctNoisyChannelMask.ecalMask[i][j][k] = false;
00149                rctNoisyChannelMask.hcalMask[i][j][k] = false;
00150              }
00151            for (int k = 0; k < 4; k++)
00152              {
00153                rctNoisyChannelMask.hfMask[i][j][k] = false;
00154              }
00155          }
00156      }
00157 
00158 
00159 }
00160 
00161 
00162 RCTConfigProducers::~RCTConfigProducers()
00163 {
00164  
00165    // do anything here that needs to be done at desctruction time
00166    // (e.g. close files, deallocate resources etc.)
00167 
00168 }
00169 
00170 
00171 //
00172 // member functions
00173 //
00174 
00175 // ------------ method called to produce the data  ------------
00176 //RCTConfigProducers::ReturnType
00177 boost::shared_ptr<L1RCTParameters>
00178 RCTConfigProducers::produceL1RCTParameters(const L1RCTParametersRcd& iRecord)
00179 {
00180    using namespace edm::es;
00181    boost::shared_ptr<L1RCTParameters> pL1RCTParameters =
00182      boost::shared_ptr<L1RCTParameters>( new L1RCTParameters( rctParameters ) ) ;
00183    return pL1RCTParameters ;
00184    //return products( pL1RCTParameters, pL1RCTChannelMask );
00185 }
00186 
00187 boost::shared_ptr<L1RCTChannelMask>
00188 RCTConfigProducers::produceL1RCTChannelMask(const L1RCTChannelMaskRcd& iRecord)
00189 {
00190   using namespace edm::es;
00191    boost::shared_ptr<L1RCTChannelMask> pL1RCTChannelMask =
00192      boost::shared_ptr<L1RCTChannelMask>( new L1RCTChannelMask( rctChannelMask ) ) ;
00193    return pL1RCTChannelMask ;
00194 }
00195 
00196 boost::shared_ptr<L1RCTNoisyChannelMask>
00197 RCTConfigProducers::produceL1RCTNoisyChannelMask(const L1RCTNoisyChannelMaskRcd& iRecord)
00198 {
00199   using namespace edm::es;
00200    boost::shared_ptr<L1RCTNoisyChannelMask> pL1RCTChannelMask =
00201      boost::shared_ptr<L1RCTNoisyChannelMask>( new L1RCTNoisyChannelMask( rctNoisyChannelMask ) ) ;
00202    return pL1RCTChannelMask ;
00203 }
00204 
00205 
00206 //define this as a plug-in
00207 DEFINE_FWK_EVENTSETUP_MODULE(RCTConfigProducers);