CMS 3D CMS Logo

L1ExtraTreeProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1Trigger/L1TNtuples
4 // Class: L1ExtraTreeProducer
5 //
13 //
14 // Original Author: Alex Tapper
15 // Created:
16 // $Id: L1ExtraTreeProducer.cc,v 1.8 2012/08/29 12:44:03 jbrooke Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // framework
30 
31 // data formats
43 
44 // ROOT output stuff
47 #include "TTree.h"
48 
50 
51 //
52 // class declaration
53 //
54 
56 public:
57  explicit L1ExtraTreeProducer(const edm::ParameterSet&);
58  ~L1ExtraTreeProducer() override;
59 
60 private:
61  void beginJob(void) override;
62  void analyze(const edm::Event&, const edm::EventSetup&) override;
63  void endJob() override;
64 
65 public:
68 
69 private:
70  unsigned maxL1Extra_;
71 
72  // output file
74 
75  // tree
76  TTree* tree_;
77 
78  // EDM input tags
89 };
90 
92  nonIsoEmToken_ = consumes<l1extra::L1EmParticleCollection>(
93  iConfig.getUntrackedParameter("nonIsoEmToken", edm::InputTag("l1extraParticles:NonIsolated")));
94  isoEmToken_ = consumes<l1extra::L1EmParticleCollection>(
95  iConfig.getUntrackedParameter("isoEmToken", edm::InputTag("l1extraParticles:Isolated")));
96  tauJetToken_ = consumes<l1extra::L1JetParticleCollection>(
97  iConfig.getUntrackedParameter("tauJetToken", edm::InputTag("l1extraParticles:Tau")));
98  isoTauJetToken_ = consumes<l1extra::L1JetParticleCollection>(
99  iConfig.getUntrackedParameter("isoTauJetToken", edm::InputTag("l1extraParticles:IsoTau")));
100  cenJetToken_ = consumes<l1extra::L1JetParticleCollection>(
101  iConfig.getUntrackedParameter("cenJetToken", edm::InputTag("l1extraParticles:Central")));
102  fwdJetToken_ = consumes<l1extra::L1JetParticleCollection>(
103  iConfig.getUntrackedParameter("fwdJetToken", edm::InputTag("l1extraParticles:Forward")));
104  muonToken_ = consumes<l1extra::L1MuonParticleCollection>(
105  iConfig.getUntrackedParameter("muonToken", edm::InputTag("l1extraParticles")));
106  metToken_ = consumes<l1extra::L1EtMissParticleCollection>(
107  iConfig.getUntrackedParameter("metToken", edm::InputTag("l1extraParticles:MET")));
108  mhtToken_ = consumes<l1extra::L1EtMissParticleCollection>(
109  iConfig.getUntrackedParameter("mhtToken", edm::InputTag("l1extraParticles:MHT")));
110  hfRingsToken_ = consumes<l1extra::L1HFRingsCollection>(
111  iConfig.getUntrackedParameter("hfRingsToken", edm::InputTag("l1extraParticles")));
112 
113  maxL1Extra_ = iConfig.getParameter<unsigned int>("maxL1Extra");
114 
117 
118  // set up output
119  tree_ = fs_->make<TTree>("L1ExtraTree", "L1ExtraTree");
120  tree_->Branch("L1Extra", "L1Analysis::L1AnalysisL1ExtraDataFormat", &l1ExtraData, 32000, 3);
121 }
122 
124  // do anything here that needs to be done at desctruction time
125  // (e.g. close files, deallocate resources etc.)
126 }
127 
128 //
129 // member functions
130 //
131 
132 // ------------ method called to for each event ------------
134  l1Extra->Reset();
135 
143  ;
147 
148  iEvent.getByToken(nonIsoEmToken_, nonIsoEm);
149  iEvent.getByToken(isoEmToken_, isoEm);
150  iEvent.getByToken(tauJetToken_, tauJet);
151  iEvent.getByToken(isoTauJetToken_, isoTauJet);
152  iEvent.getByToken(cenJetToken_, cenJet);
153  iEvent.getByToken(fwdJetToken_, fwdJet);
154  iEvent.getByToken(muonToken_, muon);
155  iEvent.getByToken(metToken_, mets);
156  iEvent.getByToken(mhtToken_, mhts);
157  iEvent.getByToken(hfRingsToken_, hfRings);
158 
159  if (isoEm.isValid()) {
160  l1Extra->SetIsoEm(isoEm, maxL1Extra_);
161  } else {
162  edm::LogWarning("MissingProduct") << "L1Extra Iso Em not found. Branch will not be filled" << std::endl;
163  }
164 
165  if (nonIsoEm.isValid()) {
166  l1Extra->SetNonIsoEm(nonIsoEm, maxL1Extra_);
167  } else {
168  edm::LogWarning("MissingProduct") << "L1Extra Non Iso Em not found. Branch will not be filled" << std::endl;
169  }
170 
171  if (cenJet.isValid()) {
172  l1Extra->SetCenJet(cenJet, maxL1Extra_);
173  } else {
174  edm::LogWarning("MissingProduct") << "L1Extra Central Jets not found. Branch will not be filled" << std::endl;
175  }
176 
177  if (tauJet.isValid()) {
178  l1Extra->SetTauJet(tauJet, maxL1Extra_);
179  } else {
180  edm::LogWarning("MissingProduct") << "L1Extra Tau Jets not found. Branch will not be filled" << std::endl;
181  }
182 
183  if (isoTauJet.isValid()) {
184  l1Extra->SetIsoTauJet(isoTauJet, maxL1Extra_);
185  } else {
186  edm::LogWarning("MissingProduct") << "L1Extra Iso Tau Jets not found. Branch will not be filled" << std::endl;
187  }
188 
189  if (fwdJet.isValid()) {
190  l1Extra->SetFwdJet(fwdJet, maxL1Extra_);
191  } else {
192  edm::LogWarning("MissingProduct") << "L1Extra Forward Jets not found. Branch will not be filled" << std::endl;
193  }
194 
195  if (muon.isValid()) {
197  } else {
198  edm::LogWarning("MissingProduct") << "L1Extra Muons not found. Branch will not be filled" << std::endl;
199  }
200 
201  if (mets.isValid()) {
202  l1Extra->SetMet(mets);
203  } else {
204  edm::LogWarning("MissingProduct") << "L1Extra MET not found. Branch will not be filled" << std::endl;
205  }
206 
207  if (mhts.isValid()) {
208  l1Extra->SetMht(mhts);
209  } else {
210  edm::LogWarning("MissingProduct") << "L1Extra MHT not found. Branch will not be filled" << std::endl;
211  }
212 
213  if (hfRings.isValid()) {
214  l1Extra->SetHFring(hfRings);
215  } else {
216  edm::LogWarning("MissingProduct") << "L1Extra HF Rings not found. Branch will not be filled" << std::endl;
217  }
218 
219  tree_->Fill();
220 }
221 
222 // ------------ method called once each job just before starting event loop ------------
224 
225 // ------------ method called once each job just after ending the event loop ------------
227 
228 //define this as a plug-in
L1Analysis::L1AnalysisL1Extra
Definition: L1AnalysisL1Extra.h:26
L1ExtraTreeProducer::mhtToken_
edm::EDGetTokenT< l1extra::L1EtMissParticleCollection > mhtToken_
Definition: L1ExtraTreeProducer.cc:87
L1ExtraTreeProducer::~L1ExtraTreeProducer
~L1ExtraTreeProducer() override
Definition: L1ExtraTreeProducer.cc:123
L1ExtraTreeProducer::tree_
TTree * tree_
Definition: L1ExtraTreeProducer.cc:76
L1HFRingsFwd.h
MessageLogger.h
L1MuonParticleFwd.h
L1Analysis::L1AnalysisL1Extra::SetFwdJet
void SetFwdJet(const edm::Handle< l1extra::L1JetParticleCollection > fwdJet, unsigned maxL1Extra)
Definition: L1AnalysisL1Extra.cc:50
muon
Definition: MuonCocktails.h:17
edm::EDGetTokenT< l1extra::L1EmParticleCollection >
L1ExtraTreeProducer::cenJetToken_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > cenJetToken_
Definition: L1ExtraTreeProducer.cc:83
L1ExtraTreeProducer::metToken_
edm::EDGetTokenT< l1extra::L1EtMissParticleCollection > metToken_
Definition: L1ExtraTreeProducer.cc:86
L1Analysis::L1AnalysisL1Extra::SetCenJet
void SetCenJet(const edm::Handle< l1extra::L1JetParticleCollection > cenJet, unsigned maxL1Extra)
Definition: L1AnalysisL1Extra.cc:33
L1ExtraTreeProducer::beginJob
void beginJob(void) override
Definition: L1ExtraTreeProducer.cc:223
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
L1ExtraTreeProducer::hfRingsToken_
edm::EDGetTokenT< l1extra::L1HFRingsCollection > hfRingsToken_
Definition: L1ExtraTreeProducer.cc:88
L1HFRings.h
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
L1ExtraTreeProducer
Definition: L1ExtraTreeProducer.cc:55
L1ExtraTreeProducer::tauJetToken_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tauJetToken_
Definition: L1ExtraTreeProducer.cc:81
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
L1Analysis::L1AnalysisL1ExtraDataFormat
Definition: L1AnalysisL1ExtraDataFormat.h:14
L1Analysis::L1AnalysisL1Extra::SetTauJet
void SetTauJet(const edm::Handle< l1extra::L1JetParticleCollection > tauJet, unsigned maxL1Extra)
Definition: L1AnalysisL1Extra.cc:65
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
MakerMacros.h
L1Analysis::L1AnalysisL1Extra::SetIsoTauJet
void SetIsoTauJet(const edm::Handle< l1extra::L1JetParticleCollection > isoTauJet, unsigned maxL1Extra)
Definition: L1AnalysisL1Extra.cc:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11773
Service.h
L1Analysis::L1AnalysisL1Extra::Reset
void Reset()
Definition: L1AnalysisL1Extra.h:30
L1Analysis::L1AnalysisL1Extra::SetIsoEm
void SetIsoEm(const edm::Handle< l1extra::L1EmParticleCollection > isoEm, unsigned maxL1Extra)
Definition: L1AnalysisL1Extra.cc:7
L1EmParticleFwd.h
L1ExtraTreeProducer::muonToken_
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > muonToken_
Definition: L1ExtraTreeProducer.cc:85
TFileService.h
L1JetParticleFwd.h
edm::ParameterSet
Definition: ParameterSet.h:47
L1EtMissParticleFwd.h
Event.h
L1ExtraTreeProducer::fs_
edm::Service< TFileService > fs_
Definition: L1ExtraTreeProducer.cc:73
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
L1EmParticle.h
L1ExtraTreeProducer::fwdJetToken_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > fwdJetToken_
Definition: L1ExtraTreeProducer.cc:84
L1ExtraTreeProducer::l1ExtraData
L1Analysis::L1AnalysisL1ExtraDataFormat * l1ExtraData
Definition: L1ExtraTreeProducer.cc:67
L1Analysis::L1AnalysisL1Extra::SetMet
void SetMet(const edm::Handle< l1extra::L1EtMissParticleCollection > mets)
Definition: L1AnalysisL1Extra.cc:119
L1MuonParticle.h
L1ExtraTreeProducer::L1ExtraTreeProducer
L1ExtraTreeProducer(const edm::ParameterSet &)
Definition: L1ExtraTreeProducer.cc:91
L1ExtraTreeProducer::isoEmToken_
edm::EDGetTokenT< l1extra::L1EmParticleCollection > isoEmToken_
Definition: L1ExtraTreeProducer.cc:80
Frameworkfwd.h
L1Analysis::L1AnalysisL1Extra::SetMuon
void SetMuon(const edm::Handle< l1extra::L1MuonParticleCollection > muon, unsigned maxL1Extra)
Definition: L1AnalysisL1Extra.cc:95
L1Analysis::L1AnalysisL1Extra::SetHFring
void SetHFring(const edm::Handle< l1extra::L1HFRingsCollection > hfRings)
Definition: L1AnalysisL1Extra.cc:139
L1AnalysisL1Extra.h
L1ExtraTreeProducer::isoTauJetToken_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > isoTauJetToken_
Definition: L1ExtraTreeProducer.cc:82
L1ExtraTreeProducer::l1Extra
L1Analysis::L1AnalysisL1Extra * l1Extra
Definition: L1ExtraTreeProducer.cc:66
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1Analysis::L1AnalysisL1Extra::getData
L1AnalysisL1ExtraDataFormat * getData()
Definition: L1AnalysisL1Extra.h:41
L1Analysis::L1AnalysisL1Extra::SetMht
void SetMht(const edm::Handle< l1extra::L1EtMissParticleCollection > mhts)
Definition: L1AnalysisL1Extra.cc:129
L1Analysis::L1AnalysisL1Extra::SetNonIsoEm
void SetNonIsoEm(const edm::Handle< l1extra::L1EmParticleCollection > nonIsoEm, unsigned maxL1Extra)
Definition: L1AnalysisL1Extra.cc:20
L1EtMissParticle.h
ParameterSet.h
L1ExtraTreeProducer::maxL1Extra_
unsigned maxL1Extra_
Definition: L1ExtraTreeProducer.cc:70
L1ExtraTreeProducer::endJob
void endJob() override
Definition: L1ExtraTreeProducer.cc:226
L1ExtraTreeProducer::nonIsoEmToken_
edm::EDGetTokenT< l1extra::L1EmParticleCollection > nonIsoEmToken_
Definition: L1ExtraTreeProducer.cc:79
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
L1JetParticle.h
edm::InputTag
Definition: InputTag.h:15
L1GlobalTriggerReadoutRecord.h
L1ExtraTreeProducer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: L1ExtraTreeProducer.cc:133
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64