test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
39 
40 //
41 // class declaration
42 //
43 
45 public:
48 
49 
50 private:
51  virtual void beginJob(void) ;
52  virtual void analyze(const edm::Event&, const edm::EventSetup&);
53  virtual void endJob();
54 
55 public:
56 
63 
64 private:
65 
67 
68  // output file
70 
71  // tree
72  TTree * tree_;
73 
74  // EDM input tags
78 
79 };
80 
81 
82 
84 {
85 
86  bmtfMuonToken_ = consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("bmtfMuonToken"));
87  omtfMuonToken_ = consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("omtfMuonToken"));
88  emtfMuonToken_ = consumes<l1t::RegionalMuonCandBxCollection>(iConfig.getUntrackedParameter<edm::InputTag>("emtfMuonToken"));
89 
90  maxL1UpgradeTfMuon_ = iConfig.getParameter<unsigned int>("maxL1UpgradeTfMuon");
91 
95 
96  // set up output
97  tree_=fs_->make<TTree>("L1UpgradeTfMuonTree", "L1UpgradeTfMuonTree");
98  tree_->Branch("L1UpgradeBmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeBmtfData, 32000, 3);
99  tree_->Branch("L1UpgradeOmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeOmtfData, 32000, 3);
100  tree_->Branch("L1UpgradeEmtfMuon", "L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat", &l1UpgradeEmtfData, 32000, 3);
101 
102 }
103 
104 
106 {
107 }
108 
109 
110 //
111 // member functions
112 //
113 
114 // ------------ method called to for each event ------------
115 void
117 {
118 
122 
126 
127  iEvent.getByToken(bmtfMuonToken_, bmtfMuon);
128  iEvent.getByToken(omtfMuonToken_, omtfMuon);
129  iEvent.getByToken(emtfMuonToken_, emtfMuon);
130 
131  if (bmtfMuon.isValid()){
133  } else {
134  edm::LogWarning("MissingProduct") << "L1Upgrade BMTF muons not found. Branch will not be filled" << std::endl;
135  }
136 
137  if (omtfMuon.isValid()){
139  } else {
140  edm::LogWarning("MissingProduct") << "L1Upgrade OMTF muons not found. Branch will not be filled" << std::endl;
141  }
142 
143  if (emtfMuon.isValid()){
145  } else {
146  edm::LogWarning("MissingProduct") << "L1Upgrade EMTF muons not found. Branch will not be filled" << std::endl;
147  }
148 
149  tree_->Fill();
150 
151 }
152 
153 // ------------ method called once each job just before starting event loop ------------
154 void
156 {
157 }
158 
159 // ------------ method called once each job just after ending the event loop ------------
160 void
162 }
163 
164 //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:462
#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
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > bmtfMuonToken_
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > omtfMuonToken_
bool isValid() const
Definition: HandleBase.h:75
L1Analysis::L1AnalysisL1UpgradeTfMuon l1UpgradeBmtf
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeBmtfData
L1AnalysisL1UpgradeTfMuonDataFormat * getData()
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > emtfMuonToken_
L1Analysis::L1AnalysisL1UpgradeTfMuonDataFormat * l1UpgradeOmtfData
edm::Service< TFileService > fs_
void SetTfMuon(const l1t::RegionalMuonCandBxCollection &muon, unsigned maxL1UpgradeTfMuon)