File indexing completed on 2024-04-06 12:18:24
0001 #ifndef HLTPrescaler_H
0002 #define HLTPrescaler_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <atomic>
0016 #include <memory>
0017
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/Framework/interface/Frameworkfwd.h"
0020 #include "FWCore/Framework/interface/stream/EDFilter.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 #include "FWCore/PrescaleService/interface/PrescaleService.h"
0023
0024
0025 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0026
0027
0028 #include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h"
0029
0030 namespace edm {
0031 class ConfigurationDescriptions;
0032 }
0033
0034 namespace trigger {
0035 struct Efficiency {
0036 Efficiency() : eventCount_(0), acceptCount_(0) {}
0037 mutable std::atomic<unsigned int> eventCount_;
0038 mutable std::atomic<unsigned int> acceptCount_;
0039 };
0040 }
0041
0042 class HLTPrescaler : public edm::stream::EDFilter<edm::GlobalCache<trigger::Efficiency> > {
0043 public:
0044
0045
0046
0047 explicit HLTPrescaler(edm::ParameterSet const& iConfig, const trigger::Efficiency* efficiency);
0048 ~HLTPrescaler() override;
0049
0050 static std::unique_ptr<trigger::Efficiency> initializeGlobalCache(edm::ParameterSet const&) {
0051 return std::make_unique<trigger::Efficiency>();
0052 }
0053
0054
0055
0056
0057 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0058 void beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& iSetup) override;
0059 bool filter(edm::Event& iEvent, edm::EventSetup const& iSetup) override;
0060 void endStream() override;
0061 static void globalEndJob(const trigger::Efficiency* efficiency);
0062
0063 private:
0064
0065
0066
0067
0068
0069 unsigned int prescaleSet_;
0070
0071
0072 unsigned int prescaleFactor_;
0073
0074
0075 unsigned int eventCount_;
0076
0077
0078 unsigned int acceptCount_;
0079
0080
0081 unsigned int offsetCount_;
0082 unsigned int offsetPhase_;
0083
0084
0085 edm::service::PrescaleService* prescaleService_;
0086
0087
0088 bool newLumi_;
0089
0090
0091 edm::InputTag gtDigiTag_;
0092 edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> gtDigi1Token_;
0093 edm::EDGetTokenT<GlobalAlgBlkBxCollection> gtDigi2Token_;
0094
0095
0096 static const unsigned int prescaleSeed_;
0097 };
0098
0099 #endif