CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
L1UpgradeTfMuonShowerTreeProducer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 
4 // framework
11 
12 // data formats
14 
15 // ROOT output stuff
18 #include "TTree.h"
19 
21 
22 //
23 // class declaration
24 //
25 
26 class L1UpgradeTfMuonShowerTreeProducer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
27 public:
29  ~L1UpgradeTfMuonShowerTreeProducer() override = default;
30 
31 private:
32  void beginJob(void) override;
33  void analyze(const edm::Event&, const edm::EventSetup&) override;
34  void endJob() override;
35 
36 public:
39 
40 private:
42 
43  // output file
45 
46  // tree
47  TTree* tree_;
48 
49  // EDM input tags
51 };
52 
54  emtfMuonShowerToken_ = consumes<l1t::RegionalMuonShowerBxCollection>(
55  iConfig.getUntrackedParameter<edm::InputTag>("emtfMuonShowerToken"));
56 
57  maxL1UpgradeTfMuonShower_ = iConfig.getParameter<unsigned int>("maxL1UpgradeTfMuonShower");
58 
60 
61  usesResource(TFileService::kSharedResource);
62 
63  // set up output
64  tree_ = fs_->make<TTree>("L1UpgradeTfMuonShowerTree", "L1UpgradeTfMuonShowerTree");
65  tree_->Branch(
66  "L1UpgradeEmtfMuonShower", "L1Analysis::L1AnalysisL1UpgradeTfMuonShowerDataFormat", &l1UpgradeEmtfData, 32000, 3);
67 }
68 
69 //
70 // member functions
71 //
72 
73 // ------------ method called to for each event ------------
76 
78 
79  iEvent.getByToken(emtfMuonShowerToken_, emtfMuonShower);
80 
81  if (emtfMuonShower.isValid()) {
83  } else {
84  edm::LogWarning("MissingProduct") << "L1Upgrade EMTF muons not found. Branch will not be filled" << std::endl;
85  }
86 
87  tree_->Fill();
88 }
89 
90 // ------------ method called once each job just before starting event loop ------------
92 
93 // ------------ method called once each job just after ending the event loop ------------
95 
96 //define this as a plug-in
static const std::string kSharedResource
Definition: TFileService.h:76
L1UpgradeTfMuonShowerTreeProducer(const edm::ParameterSet &)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
L1AnalysisL1UpgradeTfMuonShowerDataFormat * getData()
~L1UpgradeTfMuonShowerTreeProducer() override=default
edm::EDGetTokenT< l1t::RegionalMuonShowerBxCollection > emtfMuonShowerToken_
void analyze(const edm::Event &, const edm::EventSetup &) override
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:224
void SetTfMuonShower(const l1t::RegionalMuonShowerBxCollection &muon, unsigned maxL1UpgradeTfMuonShower)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool isValid() const
Definition: HandleBase.h:70
L1Analysis::L1AnalysisL1UpgradeTfMuonShowerDataFormat * l1UpgradeEmtfData
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
Log< level::Warning, false > LogWarning
L1Analysis::L1AnalysisL1UpgradeTfMuonShower l1UpgradeEmtf