CMS 3D CMS Logo

L1UpgradeTfMuonTreeProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1Trigger/L1Ntuples
4 // Class: L1UpgradeTfMuonTreeProducer
5 //
11 //
12 // Original Author:
13 // Created:
14 // $Id: L1UpgradeTfMuonTreeProducer.cc,v 1.8 2012/08/29 12:44:03 jbrooke Exp $
15 //
16 //
17 
18 // system include files
19 #include <memory>
20 
21 // framework
28 
29 // data formats
31 
32 // ROOT output stuff
35 #include "TTree.h"
36 
39 
40 //
41 // class declaration
42 //
43 
45 public:
48 
49 private:
50  void beginJob(void) override;
51  void analyze(const edm::Event&, const edm::EventSetup&) override;
52  void endJob() override;
53 
54 public:
63 
64 private:
66 
67  // output file
69 
70  // tree
71  TTree* tree_;
72 
73  // EDM input tags
77 
80 };
81 
84  consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("bmtfMuonToken"));
86  consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("omtfMuonToken"));
88  consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("emtfMuonToken"));
89 
91  consumes<L1MuDTChambPhContainer>(iConfig.getUntrackedParameter<edm::InputTag>("bmtfInputPhMuonToken"));
93  consumes<L1MuDTChambThContainer>(iConfig.getUntrackedParameter<edm::InputTag>("bmtfInputThMuonToken"));
94 
95  maxL1UpgradeTfMuon_ = iConfig.getParameter<unsigned int>("maxL1UpgradeTfMuon");
96 
101 
102  // set up output
103  tree_ = fs_->make<TTree>("L1UpgradeTfMuonTree", "L1UpgradeTfMuonTree");
104  tree_->Branch("L1UpgradeBmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeBmtfData, 32000, 3);
105  tree_->Branch("L1UpgradeOmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeOmtfData, 32000, 3);
106  tree_->Branch("L1UpgradeEmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeEmtfData, 32000, 3);
107 
108  tree_->Branch(
109  "L1UpgradeBmtfInputs", "L1Analysis::L1AnalysisBMTFInputsDataFormat", &l1UpgradeBmtfInputsData, 32000, 3);
110 }
111 
113 
114 //
115 // member functions
116 //
117 
118 // ------------ method called to for each event ------------
124 
130 
131  iEvent.getByToken(bmtfMuonToken_, bmtfMuon);
132  iEvent.getByToken(omtfMuonToken_, omtfMuon);
133  iEvent.getByToken(emtfMuonToken_, emtfMuon);
134  iEvent.getByToken(bmtfPhInputToken_, bmtfPhInputs);
135  iEvent.getByToken(bmtfThInputToken_, bmtfThInputs);
136 
137  if (bmtfMuon.isValid()) {
139  } else {
140  edm::LogWarning("MissingProduct") << "L1Upgrade BMTF muons not found. Branch will not be filled" << std::endl;
141  }
142 
143  if (omtfMuon.isValid()) {
145  } else {
146  edm::LogWarning("MissingProduct") << "L1Upgrade OMTF muons not found. Branch will not be filled" << std::endl;
147  }
148 
149  if (emtfMuon.isValid()) {
151  } else {
152  edm::LogWarning("MissingProduct") << "L1Upgrade EMTF muons not found. Branch will not be filled" << std::endl;
153  }
154 
155  int max_inputs = maxL1UpgradeTfMuon_ * 4;
156 
157  if (!bmtfPhInputs.isValid()) {
158  edm::LogWarning("MissingProduct") << "L1Upgrade BMTF Ph Inputs not found. Branch will not be filled" << std::endl;
159  } else
160  l1UpgradeBmtfInputs.SetBMPH(bmtfPhInputs, max_inputs);
161 
162  if (!bmtfThInputs.isValid()) {
163  edm::LogWarning("MissingProduct") << "L1Upgrade BMTF Th Inputs not found. Branch will not be filled" << std::endl;
164  } else
165  l1UpgradeBmtfInputs.SetBMTH(bmtfThInputs, max_inputs);
166 
167  tree_->Fill();
168 }
169 
170 // ------------ method called once each job just before starting event loop ------------
172 
173 // ------------ method called once each job just after ending the event loop ------------
175 
176 //define this as a plug-in
L1UpgradeTfMuonTreeProducer::fs_
edm::Service< TFileService > fs_
Definition: L1UpgradeTfMuonTreeProducer.cc:68
MessageLogger.h
L1UpgradeTfMuonTreeProducer::bmtfPhInputToken_
edm::EDGetTokenT< L1MuDTChambPhContainer > bmtfPhInputToken_
Definition: L1UpgradeTfMuonTreeProducer.cc:78
L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon
void SetTfMuon(const l1t::RegionalMuonCandBxCollection &muon, unsigned maxL1UpgradeTfMuon)
Definition: L1AnalysisL1UpgradeTfMuon.cc:7
L1UpgradeTfMuonTreeProducer::l1UpgradeEmtfData
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeEmtfData
Definition: L1UpgradeTfMuonTreeProducer.cc:61
L1Analysis::L1AnalysisL1UpgradeTfMuon::getData
L1AnalysisL1UpgradeTfMuonDataFormat * getData()
Definition: L1AnalysisL1UpgradeTfMuon.h:16
L1UpgradeTfMuonTreeProducer::emtfMuonToken_
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > emtfMuonToken_
Definition: L1UpgradeTfMuonTreeProducer.cc:76
edm::EDGetTokenT
Definition: EDGetToken.h:33
L1Analysis::L1AnalysisBMTFInputs::SetBMTH
void SetBMTH(const edm::Handle< L1MuDTChambThContainer > L1MuDTChambThContainer, unsigned int maxDTTH)
Definition: L1AnalysisBMTFInputs.cc:37
L1Analysis::L1AnalysisBMTFInputs::SetBMPH
void SetBMPH(const edm::Handle< L1MuDTChambPhContainer > L1MuDTChambPhContainer, unsigned int maxDTPH)
Definition: L1AnalysisBMTFInputs.cc:13
L1UpgradeTfMuonTreeProducer::l1UpgradeOmtfData
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeOmtfData
Definition: L1UpgradeTfMuonTreeProducer.cc:60
L1UpgradeTfMuonTreeProducer::L1UpgradeTfMuonTreeProducer
L1UpgradeTfMuonTreeProducer(const edm::ParameterSet &)
Definition: L1UpgradeTfMuonTreeProducer.cc:82
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
edm::Handle
Definition: AssociativeIterator.h:50
L1UpgradeTfMuonTreeProducer::l1UpgradeBmtf
L1Analysis::L1AnalysisL1UpgradeTfMuon l1UpgradeBmtf
Definition: L1UpgradeTfMuonTreeProducer.cc:55
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
L1Analysis::L1AnalysisL1UpgradeTfMuon::Reset
void Reset()
Definition: L1AnalysisL1UpgradeTfMuon.h:14
L1UpgradeTfMuonTreeProducer
Definition: L1UpgradeTfMuonTreeProducer.cc:44
MakerMacros.h
L1UpgradeTfMuonTreeProducer::~L1UpgradeTfMuonTreeProducer
~L1UpgradeTfMuonTreeProducer() override
Definition: L1UpgradeTfMuonTreeProducer.cc:112
L1UpgradeTfMuonTreeProducer::l1UpgradeBmtfData
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeBmtfData
Definition: L1UpgradeTfMuonTreeProducer.cc:59
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
L1Analysis::L1AnalysisBMTFInputs
Definition: L1AnalysisBMTFInputs.h:19
Service.h
L1Analysis::L1AnalysisBMTFInputs::getData
L1AnalysisBMTFInputsDataFormat * getData()
Definition: L1AnalysisBMTFInputs.h:28
L1Analysis::L1AnalysisBMTFInputs::Reset
void Reset()
Definition: L1AnalysisBMTFInputs.h:27
L1UpgradeTfMuonTreeProducer::endJob
void endJob() override
Definition: L1UpgradeTfMuonTreeProducer.cc:174
L1UpgradeTfMuonTreeProducer::tree_
TTree * tree_
Definition: L1UpgradeTfMuonTreeProducer.cc:71
edm::LogWarning
Definition: MessageLogger.h:141
TFileService.h
L1UpgradeTfMuonTreeProducer::bmtfThInputToken_
edm::EDGetTokenT< L1MuDTChambThContainer > bmtfThInputToken_
Definition: L1UpgradeTfMuonTreeProducer.cc:79
edm::ParameterSet
Definition: ParameterSet.h:36
L1UpgradeTfMuonTreeProducer::beginJob
void beginJob(void) override
Definition: L1UpgradeTfMuonTreeProducer.cc:171
Event.h
L1UpgradeTfMuonTreeProducer::l1UpgradeBmtfInputs
L1Analysis::L1AnalysisBMTFInputs l1UpgradeBmtfInputs
Definition: L1UpgradeTfMuonTreeProducer.cc:58
L1UpgradeTfMuonTreeProducer::l1UpgradeOmtf
L1Analysis::L1AnalysisL1UpgradeTfMuon l1UpgradeOmtf
Definition: L1UpgradeTfMuonTreeProducer.cc:56
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
L1AnalysisBMTFInputs.h
edm::EventSetup
Definition: EventSetup.h:57
L1UpgradeTfMuonTreeProducer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: L1UpgradeTfMuonTreeProducer.cc:119
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat
Definition: L1AnalysisL1UpgradeTfMuonDataFormat.h:7
L1UpgradeTfMuonTreeProducer::maxL1UpgradeTfMuon_
unsigned maxL1UpgradeTfMuon_
Definition: L1UpgradeTfMuonTreeProducer.cc:65
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
L1UpgradeTfMuonTreeProducer::l1UpgradeEmtf
L1Analysis::L1AnalysisL1UpgradeTfMuon l1UpgradeEmtf
Definition: L1UpgradeTfMuonTreeProducer.cc:57
Frameworkfwd.h
L1UpgradeTfMuonTreeProducer::omtfMuonToken_
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > omtfMuonToken_
Definition: L1UpgradeTfMuonTreeProducer.cc:75
L1UpgradeTfMuonTreeProducer::l1UpgradeBmtfInputsData
L1Analysis::L1AnalysisBMTFInputsDataFormat * l1UpgradeBmtfInputsData
Definition: L1UpgradeTfMuonTreeProducer.cc:62
RegionalMuonCand.h
ParameterSet.h
L1AnalysisL1UpgradeTfMuon.h
L1Analysis::L1AnalysisBMTFInputsDataFormat
Definition: L1AnalysisBMTFInputsDataFormat.h:7
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
L1UpgradeTfMuonTreeProducer::bmtfMuonToken_
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > bmtfMuonToken_
Definition: L1UpgradeTfMuonTreeProducer.cc:74
L1Analysis::L1AnalysisL1UpgradeTfMuon
Definition: L1AnalysisL1UpgradeTfMuon.h:9