CMS 3D CMS Logo

HGCalTriggerNtupleGenJet.cc
Go to the documentation of this file.
4 
6 
8 public:
10 
11  void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final;
12  void fill(const edm::Event&, const edm::EventSetup&) final;
13 
14 private:
15  void clear() final;
16 
18 
19  int genjet_n_;
20  std::vector<float> genjet_energy_;
21  std::vector<float> genjet_pt_;
22  std::vector<float> genjet_eta_;
23  std::vector<float> genjet_phi_;
24 };
25 
27 
29 
31  const edm::ParameterSet& conf,
32  edm::ConsumesCollector&& collector) {
33  genjet_token_ = collector.consumes<reco::GenJetCollection>(conf.getParameter<edm::InputTag>("GenJets"));
34  tree.Branch("genjet_n", &genjet_n_, "genjet_n/I");
35  tree.Branch("genjet_energy", &genjet_energy_);
36  tree.Branch("genjet_pt", &genjet_pt_);
37  tree.Branch("genjet_eta", &genjet_eta_);
38  tree.Branch("genjet_phi", &genjet_phi_);
39 }
40 
43  e.getByToken(genjet_token_, genjets_h);
44  const reco::GenJetCollection& genjets = *genjets_h;
45 
46  clear();
47  genjet_n_ = genjets.size();
48  genjet_energy_.reserve(genjet_n_);
49  genjet_pt_.reserve(genjet_n_);
50  genjet_eta_.reserve(genjet_n_);
51  genjet_phi_.reserve(genjet_n_);
52  for (const auto& jet : genjets) {
53  genjet_energy_.emplace_back(jet.energy());
54  genjet_pt_.emplace_back(jet.pt());
55  genjet_eta_.emplace_back(jet.eta());
56  genjet_phi_.emplace_back(jet.phi());
57  }
58 }
59 
61  genjet_n_ = 0;
62  genjet_energy_.clear();
63  genjet_pt_.clear();
64  genjet_eta_.clear();
65  genjet_phi_.clear();
66 }
HGCalTriggerNtupleGenJet::genjet_pt_
std::vector< float > genjet_pt_
Definition: HGCalTriggerNtupleGenJet.cc:21
GenJetCollection.h
reco::GenJetCollection
std::vector< GenJet > GenJetCollection
collection of GenJet objects
Definition: GenJetCollection.h:14
HGCalTriggerNtupleGenJet::genjet_n_
int genjet_n_
Definition: HGCalTriggerNtupleGenJet.cc:19
tree
Definition: tree.py:1
edm::Handle< reco::GenJetCollection >
HGCalTriggerNtupleGenJet::initialize
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
Definition: HGCalTriggerNtupleGenJet.cc:30
HGCalTriggerNtupleGenJet
Definition: HGCalTriggerNtupleGenJet.cc:7
GenParticle.h
HGCalTriggerNtupleBase
Definition: HGCalTriggerNtupleBase.h:10
HGCalTriggerNtupleGenJet::genjet_phi_
std::vector< float > genjet_phi_
Definition: HGCalTriggerNtupleGenJet.cc:23
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
HGCalTriggerNtupleGenJet::genjet_energy_
std::vector< float > genjet_energy_
Definition: HGCalTriggerNtupleGenJet.cc:20
edm::ParameterSet
Definition: ParameterSet.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
HGCalTriggerNtupleBase.h
edm::EventSetup
Definition: EventSetup.h:57
HGCalTriggerNtupleGenJet::clear
void clear() final
Definition: HGCalTriggerNtupleGenJet.cc:60
edm::EDGetToken
Definition: EDGetToken.h:35
HGCalTriggerNtupleGenJet::genjet_eta_
std::vector< float > genjet_eta_
Definition: HGCalTriggerNtupleGenJet.cc:22
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalTriggerNtupleGenJet::genjet_token_
edm::EDGetToken genjet_token_
Definition: HGCalTriggerNtupleGenJet.cc:17
GenJet.h
edm::Event
Definition: Event.h:73
HGCalTriggerNtupleGenJet::fill
void fill(const edm::Event &, const edm::EventSetup &) final
Definition: HGCalTriggerNtupleGenJet.cc:41
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HGCalTriggerNtupleGenJet::HGCalTriggerNtupleGenJet
HGCalTriggerNtupleGenJet(const edm::ParameterSet &)
Definition: HGCalTriggerNtupleGenJet.cc:28