File indexing completed on 2024-04-06 12:21:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <memory>
0022
0023
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0030
0031
0032 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h"
0033
0034
0035 #include "FWCore/ServiceRegistry/interface/Service.h"
0036 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0037 #include "TTree.h"
0038
0039 #include "L1Trigger/L1TNtuples/interface/L1AnalysisL1Menu.h"
0040
0041
0042
0043
0044
0045 class L1MenuTreeProducer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
0046 public:
0047 explicit L1MenuTreeProducer(const edm::ParameterSet&);
0048 ~L1MenuTreeProducer() override;
0049
0050 private:
0051 void analyze(const edm::Event&, const edm::EventSetup&) override;
0052
0053 public:
0054 L1Analysis::L1AnalysisL1Menu* l1Menu;
0055 L1Analysis::L1AnalysisL1MenuDataFormat* l1MenuData;
0056
0057 private:
0058
0059 edm::Service<TFileService> fs_;
0060
0061
0062 TTree* tree_;
0063
0064
0065
0066 L1GtUtils l1GtUtils_;
0067 };
0068
0069 L1MenuTreeProducer::L1MenuTreeProducer(const edm::ParameterSet& iConfig)
0070 :
0071 l1GtUtils_(iConfig, consumesCollector(), true, L1GtUtils::UseEventSetupIn::Event) {
0072 usesResource(TFileService::kSharedResource);
0073
0074 l1Menu = new L1Analysis::L1AnalysisL1Menu();
0075 l1MenuData = l1Menu->getData();
0076
0077
0078 tree_ = fs_->make<TTree>("L1MenuTree", "L1MenuTree");
0079 tree_->Branch("L1Menu", "L1Analysis::L1AnalysisL1MenuDataFormat", &l1MenuData, 32000, 0 );
0080 }
0081
0082 L1MenuTreeProducer::~L1MenuTreeProducer() {}
0083
0084
0085
0086
0087
0088
0089 void L1MenuTreeProducer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0090 l1Menu->Reset();
0091
0092
0093 edm::LogInfo("L1TNtuples") << "Extracting menu ... " << std::endl;
0094 l1GtUtils_.retrieveL1EventSetup(iSetup);
0095
0096
0097 edm::LogInfo("L1TNtuples") << "L1 trigger menu name and implementation:"
0098 << "\n"
0099 << l1GtUtils_.l1TriggerMenu() << "\n"
0100 << l1GtUtils_.l1TriggerMenuImplementation() << std::endl;
0101
0102
0103 l1Menu->SetPrescaleFactorIndex(l1GtUtils_, iEvent);
0104
0105 tree_->Fill();
0106 }
0107
0108
0109 DEFINE_FWK_MODULE(L1MenuTreeProducer);