Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:15

0001 // -*- C++ -*-
0002 //
0003 // Package:    RCTConfigProducers
0004 // Class:      RCTConfigProducers
0005 //
0006 /**\class RCTConfigProducers RCTConfigProducers.h L1TriggerConfig/RCTConfigProducers/src/RCTConfigProducers.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Sridhara Dasu
0015 //         Created:  Mon Jul 16 23:48:35 CEST 2007
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/ModuleFactory.h"
0024 #include "FWCore/Framework/interface/ESProducer.h"
0025 #include "FWCore/Framework/interface/ESProducts.h"
0026 #include "FWCore/Framework/interface/ESHandle.h"
0027 
0028 #include "CondFormats/DataRecord/interface/L1RCTParametersRcd.h"
0029 #include "CondFormats/L1TObjects/interface/L1RCTParameters.h"
0030 #include "CondFormats/DataRecord/interface/L1RCTChannelMaskRcd.h"
0031 #include "CondFormats/L1TObjects/interface/L1RCTChannelMask.h"
0032 #include "CondFormats/DataRecord/interface/L1RCTNoisyChannelMaskRcd.h"
0033 #include "CondFormats/L1TObjects/interface/L1RCTNoisyChannelMask.h"
0034 
0035 //
0036 // class declaration
0037 //
0038 
0039 class RCTConfigProducers : public edm::ESProducer {
0040 public:
0041   RCTConfigProducers(const edm::ParameterSet&);
0042   ~RCTConfigProducers() override;
0043 
0044   //typedef std::shared_ptr<L1RCTParameters> ReturnType;
0045   //typedef edm::ESProducts< std::shared_ptr<L1RCTParameters>, std::shared_ptr<L1RCTChannelMask> > ReturnType;
0046 
0047   //ReturnType produce(const L1RCTParametersRcd&);
0048   std::unique_ptr<L1RCTParameters> produceL1RCTParameters(const L1RCTParametersRcd&);
0049   std::unique_ptr<L1RCTChannelMask> produceL1RCTChannelMask(const L1RCTChannelMaskRcd&);
0050   std::unique_ptr<L1RCTNoisyChannelMask> produceL1RCTNoisyChannelMask(const L1RCTNoisyChannelMaskRcd&);
0051 
0052 private:
0053   // ----------member data ---------------------------
0054   L1RCTParameters rctParameters;
0055   L1RCTChannelMask rctChannelMask;
0056   L1RCTNoisyChannelMask rctNoisyChannelMask;
0057 };
0058 
0059 //
0060 // constants, enums and typedefs
0061 //
0062 
0063 //
0064 // static data member definitions
0065 //
0066 
0067 //
0068 // constructors and destructor
0069 //
0070 RCTConfigProducers::RCTConfigProducers(const edm::ParameterSet& iConfig) {
0071   //the following line is needed to tell the framework what
0072   // data is being produced
0073   //setWhatProduced(this);
0074   setWhatProduced(this, &RCTConfigProducers::produceL1RCTParameters);
0075   setWhatProduced(this, &RCTConfigProducers::produceL1RCTChannelMask);
0076   setWhatProduced(this, &RCTConfigProducers::produceL1RCTNoisyChannelMask);
0077 
0078   //now do what ever other initialization is needed
0079   rctParameters = L1RCTParameters(iConfig.getParameter<double>("eGammaLSB"),
0080                                   iConfig.getParameter<double>("jetMETLSB"),
0081                                   iConfig.getParameter<double>("eMinForFGCut"),
0082                                   iConfig.getParameter<double>("eMaxForFGCut"),
0083                                   iConfig.getParameter<double>("hOeCut"),
0084                                   iConfig.getParameter<double>("eMinForHoECut"),
0085                                   iConfig.getParameter<double>("eMaxForHoECut"),
0086                                   iConfig.getParameter<double>("hMinForHoECut"),
0087                                   iConfig.getParameter<double>("eActivityCut"),
0088                                   iConfig.getParameter<double>("hActivityCut"),
0089                                   iConfig.getParameter<unsigned>("eicIsolationThreshold"),
0090                                   iConfig.getParameter<unsigned>("jscQuietThresholdBarrel"),
0091                                   iConfig.getParameter<unsigned>("jscQuietThresholdEndcap"),
0092                                   iConfig.getParameter<bool>("noiseVetoHB"),
0093                                   iConfig.getParameter<bool>("noiseVetoHEplus"),
0094                                   iConfig.getParameter<bool>("noiseVetoHEminus"),
0095                                   iConfig.getParameter<bool>("useCorrectionsLindsey"),
0096                                   iConfig.getParameter<std::vector<double> >("eGammaECalScaleFactors"),
0097                                   iConfig.getParameter<std::vector<double> >("eGammaHCalScaleFactors"),
0098                                   iConfig.getParameter<std::vector<double> >("jetMETECalScaleFactors"),
0099                                   iConfig.getParameter<std::vector<double> >("jetMETHCalScaleFactors"),
0100                                   iConfig.getParameter<std::vector<double> >("ecal_calib_Lindsey"),
0101                                   iConfig.getParameter<std::vector<double> >("hcal_calib_Lindsey"),
0102                                   iConfig.getParameter<std::vector<double> >("hcal_high_calib_Lindsey"),
0103                                   iConfig.getParameter<std::vector<double> >("cross_terms_Lindsey"),
0104                                   iConfig.getParameter<std::vector<double> >("HoverE_low_Lindsey"),
0105                                   iConfig.getParameter<std::vector<double> >("HoverE_high_Lindsey"));
0106 
0107   // value of true if channel is masked, false if not masked
0108   for (int i = 0; i < 18; i++) {
0109     for (int j = 0; j < 2; j++) {
0110       for (int k = 0; k < 28; k++) {
0111         rctChannelMask.ecalMask[i][j][k] = false;
0112         rctChannelMask.hcalMask[i][j][k] = false;
0113       }
0114       for (int k = 0; k < 4; k++) {
0115         rctChannelMask.hfMask[i][j][k] = false;
0116       }
0117     }
0118   }
0119 
0120   //Now the hot tower mask
0121 
0122   //first the thresholds
0123 
0124   rctNoisyChannelMask.ecalThreshold = 0.0;
0125   rctNoisyChannelMask.hcalThreshold = 0.0;
0126   rctNoisyChannelMask.hfThreshold = 0.0;
0127 
0128   for (int i = 0; i < 18; i++) {
0129     for (int j = 0; j < 2; j++) {
0130       for (int k = 0; k < 28; k++) {
0131         rctNoisyChannelMask.ecalMask[i][j][k] = false;
0132         rctNoisyChannelMask.hcalMask[i][j][k] = false;
0133       }
0134       for (int k = 0; k < 4; k++) {
0135         rctNoisyChannelMask.hfMask[i][j][k] = false;
0136       }
0137     }
0138   }
0139 }
0140 
0141 RCTConfigProducers::~RCTConfigProducers() {
0142   // do anything here that needs to be done at desctruction time
0143   // (e.g. close files, deallocate resources etc.)
0144 }
0145 
0146 //
0147 // member functions
0148 //
0149 
0150 // ------------ method called to produce the data  ------------
0151 //RCTConfigProducers::ReturnType
0152 std::unique_ptr<L1RCTParameters> RCTConfigProducers::produceL1RCTParameters(const L1RCTParametersRcd& iRecord) {
0153   return std::make_unique<L1RCTParameters>(rctParameters);
0154 }
0155 
0156 std::unique_ptr<L1RCTChannelMask> RCTConfigProducers::produceL1RCTChannelMask(const L1RCTChannelMaskRcd& iRecord) {
0157   return std::make_unique<L1RCTChannelMask>(rctChannelMask);
0158 }
0159 
0160 std::unique_ptr<L1RCTNoisyChannelMask> RCTConfigProducers::produceL1RCTNoisyChannelMask(
0161     const L1RCTNoisyChannelMaskRcd& iRecord) {
0162   return std::make_unique<L1RCTNoisyChannelMask>(rctNoisyChannelMask);
0163 }
0164 
0165 //define this as a plug-in
0166 DEFINE_FWK_EVENTSETUP_MODULE(RCTConfigProducers);