File indexing completed on 2024-04-06 12:18:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <vector>
0017
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/stream/EDFilter.h"
0021 #include "FWCore/Framework/interface/ESWatcher.h"
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0024 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0025 #include "FWCore/Utilities/interface/InputTag.h"
0026 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
0027 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
0028
0029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0030
0031
0032 #define PHYSICS_BITS_SIZE 128
0033 #define TECHNICAL_BITS_SIZE 64
0034
0035
0036
0037
0038
0039 class HLTLevel1Activity : public edm::stream::EDFilter<> {
0040 public:
0041 explicit HLTLevel1Activity(const edm::ParameterSet &);
0042 ~HLTLevel1Activity() override;
0043 static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0044 bool filter(edm::Event &, edm::EventSetup const &) final;
0045
0046 private:
0047 edm::InputTag m_gtReadoutRecordTag;
0048 edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_gtReadoutRecordToken;
0049 std::vector<int> m_bunchCrossings;
0050 std::vector<bool> m_selectPhysics;
0051 std::vector<bool> m_selectTechnical;
0052 std::vector<bool> m_maskedPhysics;
0053 std::vector<bool> m_maskedTechnical;
0054 unsigned int m_daqPartitions;
0055 bool m_ignoreL1Mask;
0056 bool m_invert;
0057
0058 edm::ESWatcher<L1GtTriggerMaskAlgoTrigRcd> m_watchPhysicsMask;
0059 edm::ESWatcher<L1GtTriggerMaskTechTrigRcd> m_watchTechnicalMask;
0060 };
0061
0062 #include "FWCore/Framework/interface/EventSetup.h"
0063 #include "FWCore/Framework/interface/ESHandle.h"
0064 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0065 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
0066
0067
0068
0069
0070 HLTLevel1Activity::HLTLevel1Activity(const edm::ParameterSet &config)
0071 : m_gtReadoutRecordTag(config.getParameter<edm::InputTag>("L1GtReadoutRecordTag")),
0072 m_gtReadoutRecordToken(consumes<L1GlobalTriggerReadoutRecord>(m_gtReadoutRecordTag)),
0073 m_bunchCrossings(config.getParameter<std::vector<int>>("bunchCrossings")),
0074 m_selectPhysics(PHYSICS_BITS_SIZE),
0075 m_selectTechnical(TECHNICAL_BITS_SIZE),
0076 m_maskedPhysics(PHYSICS_BITS_SIZE),
0077 m_maskedTechnical(TECHNICAL_BITS_SIZE),
0078 m_daqPartitions(config.getParameter<unsigned int>("daqPartitions")),
0079 m_ignoreL1Mask(config.getParameter<bool>("ignoreL1Mask")),
0080 m_invert(config.getParameter<bool>("invert")) {
0081 unsigned long long low = config.getParameter<unsigned long long>("physicsLoBits");
0082 unsigned long long high = config.getParameter<unsigned long long>("physicsHiBits");
0083 unsigned long long tech = config.getParameter<unsigned long long>("technicalBits");
0084 for (unsigned int i = 0; i < 64; i++) {
0085 m_selectPhysics[i] = low & (0x01ULL << (unsigned long long)i);
0086 m_maskedPhysics[i] = low & (0x01ULL << (unsigned long long)i);
0087 }
0088 for (unsigned int i = 0; i < 64; i++) {
0089 m_selectPhysics[i + 64] = high & (0x01ULL << (unsigned long long)i);
0090 m_maskedPhysics[i + 64] = high & (0x01ULL << (unsigned long long)i);
0091 }
0092 for (unsigned int i = 0; i < 64; i++) {
0093 m_selectTechnical[i] = tech & (0x01ULL << (unsigned long long)i);
0094 m_maskedTechnical[i] = tech & (0x01ULL << (unsigned long long)i);
0095 }
0096 }
0097
0098 HLTLevel1Activity::~HLTLevel1Activity() = default;
0099
0100 void HLTLevel1Activity::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0101 edm::ParameterSetDescription desc;
0102 desc.add<edm::InputTag>("L1GtReadoutRecordTag", edm::InputTag("hltGtDigis"));
0103 desc.add<std::vector<int>>("bunchCrossings", {0, -1, 1});
0104 desc.add<unsigned int>("daqPartitions", 1);
0105 desc.add<bool>("ignoreL1Mask", false);
0106 desc.add<bool>("invert", false);
0107 desc.add<unsigned long long int>("physicsLoBits", 0x0000000000000001LL);
0108 desc.add<unsigned long long int>("physicsHiBits", 0x0000000000040000LL);
0109 desc.add<unsigned long long int>("technicalBits", 0x0000000000000001LL);
0110 descriptions.add("hltLevel1Activity", desc);
0111 }
0112
0113
0114
0115
0116
0117
0118 bool HLTLevel1Activity::filter(edm::Event &event, edm::EventSetup const &setup) {
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168 return false;
0169 }
0170
0171
0172 #include "FWCore/Framework/interface/MakerMacros.h"
0173 DEFINE_FWK_MODULE(HLTLevel1Activity);