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 
19 // system include files
20 #include <memory>
21 
22 // framework
29 
30 // data formats
32 
33 // ROOT output stuff
36 #include "TTree.h"
37 
40 
41 //
42 // class declaration
43 //
44 
46 public:
49 
50 
51 private:
52  void beginJob(void) override ;
53  void analyze(const edm::Event&, const edm::EventSetup&) override;
54  void endJob() override;
55 
56 public:
57 
66 
67 private:
68 
70 
71  // output file
73 
74  // tree
75  TTree * tree_;
76 
77  // EDM input tags
81 
84 
85 };
86 
87 
88 
90 {
91 
92  bmtfMuonToken_ = consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("bmtfMuonToken"));
93  omtfMuonToken_ = consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("omtfMuonToken"));
94  emtfMuonToken_ = consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("emtfMuonToken"));
95 
96  bmtfPhInputToken_ = consumes<L1MuDTChambPhContainer>(iConfig.getUntrackedParameter<edm::InputTag>("bmtfInputPhMuonToken"));
97  bmtfThInputToken_ = consumes<L1MuDTChambThContainer>(iConfig.getUntrackedParameter<edm::InputTag>("bmtfInputThMuonToken"));
98 
99  maxL1UpgradeTfMuon_ = iConfig.getParameter<unsigned int>("maxL1UpgradeTfMuon");
100 
101 
106 
107 
108  // set up output
109  tree_=fs_->make<TTree>("L1UpgradeTfMuonTree", "L1UpgradeTfMuonTree");
110  tree_->Branch("L1UpgradeBmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeBmtfData, 32000, 3);
111  tree_->Branch("L1UpgradeOmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeOmtfData, 32000, 3);
112  tree_->Branch("L1UpgradeEmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeEmtfData, 32000, 3);
113 
114  tree_->Branch("L1UpgradeBmtfInputs", "L1Analysis::L1AnalysisBMTFInputsDataFormat", &l1UpgradeBmtfInputsData, 32000, 3);
115 
116 
117 }
118 
119 
121 {
122 }
123 
124 
125 //
126 // member functions
127 //
128 
129 // ------------ method called to for each event ------------
130 void
132 {
133 
138 
139 
145 
146  iEvent.getByToken(bmtfMuonToken_, bmtfMuon);
147  iEvent.getByToken(omtfMuonToken_, omtfMuon);
148  iEvent.getByToken(emtfMuonToken_, emtfMuon);
149  iEvent.getByToken(bmtfPhInputToken_, bmtfPhInputs);
150  iEvent.getByToken(bmtfThInputToken_, bmtfThInputs);
151 
152  if (bmtfMuon.isValid()){
154  } else {
155  edm::LogWarning("MissingProduct") << "L1Upgrade BMTF muons not found. Branch will not be filled" << std::endl;
156  }
157 
158  if (omtfMuon.isValid()){
160  } else {
161  edm::LogWarning("MissingProduct") << "L1Upgrade OMTF muons not found. Branch will not be filled" << std::endl;
162  }
163 
164  if (emtfMuon.isValid()){
166  } else {
167  edm::LogWarning("MissingProduct") << "L1Upgrade EMTF muons not found. Branch will not be filled" << std::endl;
168  }
169 
170 
171  int max_inputs = maxL1UpgradeTfMuon_*4;
172 
173  if (!bmtfPhInputs.isValid()) {
174  edm::LogWarning("MissingProduct") << "L1Upgrade BMTF Ph Inputs not found. Branch will not be filled" << std::endl;
175  }
176  else l1UpgradeBmtfInputs.SetBMPH(bmtfPhInputs, max_inputs);
177 
178  if (!bmtfThInputs.isValid()) {
179  edm::LogWarning("MissingProduct") << "L1Upgrade BMTF Th Inputs not found. Branch will not be filled" << std::endl;
180  }
181  else l1UpgradeBmtfInputs.SetBMTH(bmtfThInputs, max_inputs);
182 
183 
184 
185  tree_->Fill();
186 
187 }
188 
189 // ------------ method called once each job just before starting event loop ------------
190 void
192 {
193 }
194 
195 // ------------ method called once each job just after ending the event loop ------------
196 void
198 }
199 
200 //define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
L1Analysis::L1AnalysisL1UpgradeTfMuon l1UpgradeEmtf
L1UpgradeTfMuonTreeProducer(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
L1AnalysisBMTFInputsDataFormat * getData()
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeEmtfData
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
L1Analysis::L1AnalysisL1UpgradeTfMuon l1UpgradeOmtf
L1Analysis::L1AnalysisBMTFInputs l1UpgradeBmtfInputs
void analyze(const edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< L1MuDTChambThContainer > bmtfThInputToken_
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > bmtfMuonToken_
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > omtfMuonToken_
void SetBMPH(const edm::Handle< L1MuDTChambPhContainer > L1MuDTChambPhContainer, unsigned int maxDTPH)
bool isValid() const
Definition: HandleBase.h:74
L1Analysis::L1AnalysisL1UpgradeTfMuon l1UpgradeBmtf
edm::EDGetTokenT< L1MuDTChambPhContainer > bmtfPhInputToken_
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeBmtfData
L1Analysis::L1AnalysisBMTFInputsDataFormat * l1UpgradeBmtfInputsData
void SetBMTH(const edm::Handle< L1MuDTChambThContainer > L1MuDTChambThContainer, unsigned int maxDTTH)
L1AnalysisL1UpgradeTfMuonDataFormat * getData()
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > emtfMuonToken_
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeOmtfData
edm::Service< TFileService > fs_
void SetTfMuon(const l1t::RegionalMuonCandBxCollection &muon, unsigned maxL1UpgradeTfMuon)