File indexing completed on 2024-04-06 12:21:35
0001 #ifndef L1RCTProducer_h
0002 #define L1RCTProducer_h
0003
0004 #include "FWCore/Framework/interface/stream/EDProducer.h"
0005
0006 #include "DataFormats/Common/interface/Handle.h"
0007 #include "FWCore/Framework/interface/ESHandle.h"
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011
0012 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0013 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0014 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0015
0016
0017 #include "CondFormats/DataRecord/interface/L1CaloEcalScaleRcd.h"
0018 #include "CondFormats/DataRecord/interface/L1CaloHcalScaleRcd.h"
0019 #include "CondFormats/L1TObjects/interface/L1CaloEcalScale.h"
0020 #include "CondFormats/L1TObjects/interface/L1CaloHcalScale.h"
0021
0022 #include "CondFormats/DataRecord/interface/L1RCTChannelMaskRcd.h"
0023 #include "CondFormats/DataRecord/interface/L1RCTNoisyChannelMaskRcd.h"
0024 #include "CondFormats/DataRecord/interface/L1RCTParametersRcd.h"
0025 #include "CondFormats/L1TObjects/interface/L1RCTChannelMask.h"
0026 #include "CondFormats/L1TObjects/interface/L1RCTNoisyChannelMask.h"
0027 #include "CondFormats/L1TObjects/interface/L1RCTParameters.h"
0028
0029 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
0030 #include "CondFormats/RunInfo/interface/RunInfo.h"
0031
0032 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCT.h"
0033 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTLookupTables.h"
0034
0035 #include "CondFormats/DataRecord/interface/L1EmEtScaleRcd.h"
0036 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h"
0037
0038 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0039 #include <string>
0040 #include <memory>
0041
0042 class L1RCT;
0043 class L1RCTLookupTables;
0044
0045 class L1RCTProducer : public edm::stream::EDProducer<> {
0046 public:
0047 explicit L1RCTProducer(const edm::ParameterSet &ps);
0048
0049 void beginRun(edm::Run const &r, const edm::EventSetup &c) final;
0050 void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &context) final;
0051 void produce(edm::Event &e, const edm::EventSetup &c) final;
0052
0053 private:
0054 void updateConfiguration(const edm::EventSetup &);
0055
0056 void updateFedVector(const L1RCTChannelMask &, const L1RCTNoisyChannelMask &, const std::vector<int> &Feds);
0057 const std::vector<int> getFedVectorFromRunInfo(const edm::ESGetToken<RunInfo, RunInfoRcd> &,
0058 const edm::EventSetup &) const;
0059 const std::vector<int> getFedVectorFromOmds(const edm::EventSetup &) const;
0060
0061 void printFedVector(const std::vector<int> &);
0062 void printUpdatedFedMask();
0063 void printUpdatedFedMaskVerbose();
0064
0065 std::unique_ptr<L1RCTLookupTables> rctLookupTables;
0066 std::unique_ptr<L1RCT> rct;
0067 bool useEcal;
0068 bool useHcal;
0069 std::vector<edm::InputTag> ecalDigis;
0070 std::vector<edm::InputTag> hcalDigis;
0071 std::vector<int> bunchCrossings;
0072 bool getFedsFromOmds;
0073 unsigned int queryDelayInLS;
0074 unsigned int queryIntervalInLS;
0075 std::string conditionsLabel;
0076
0077
0078 std::unique_ptr<L1RCTChannelMask> fedUpdatedMask;
0079
0080
0081 const edm::ESGetToken<L1RCTParameters, L1RCTParametersRcd> rctParamsToken_;
0082 const edm::ESGetToken<L1CaloEtScale, L1EmEtScaleRcd> emScaleToken_;
0083 const edm::ESGetToken<L1CaloEcalScale, L1CaloEcalScaleRcd> ecalScaleToken_;
0084 const edm::ESGetToken<L1CaloHcalScale, L1CaloHcalScaleRcd> hcalScaleToken_;
0085
0086
0087 const edm::ESGetToken<RunInfo, RunInfoRcd> beginRunRunInfoToken_;
0088 edm::ESGetToken<RunInfo, RunInfoRcd> beginLumiRunInfoToken_;
0089 edm::ESGetToken<RunInfo, RunInfoRcd> omdsRunInfoToken_;
0090
0091
0092 const edm::ESGetToken<L1RCTChannelMask, L1RCTChannelMaskRcd> beginRunChannelMaskToken_;
0093 const edm::ESGetToken<L1RCTNoisyChannelMask, L1RCTNoisyChannelMaskRcd> beginRunHotChannelMaskToken_;
0094
0095
0096 edm::ESGetToken<L1RCTChannelMask, L1RCTChannelMaskRcd> beginLumiChannelMaskToken_;
0097 edm::ESGetToken<L1RCTNoisyChannelMask, L1RCTNoisyChannelMaskRcd> beginLumiHotChannelMaskToken_;
0098
0099 enum crateSection { c_min, ebOddFed = c_min, ebEvenFed, eeFed, hbheFed, hfFed, hfFedUp, c_max = hfFedUp };
0100
0101 static constexpr int minBarrel = 1;
0102 static constexpr int maxBarrel = 17;
0103 static constexpr int minEndcap = 17;
0104 static constexpr int maxEndcap = 28;
0105 static constexpr int minHF = 29;
0106 static constexpr int maxHF = 32;
0107 };
0108
0109 #endif