29 gen_ = consumes<GenEventInfoProduct>(
edm::InputTag(
"generator"));
34 file_ =
new TFile(histogramFile_.c_str(),
"RECREATE");
35 mcTruthTree_ =
new TTree(
"mcTruthTree",
"mcTruthTree");
37 mcTruthTree_->Branch(
"ptJet", &ptJet_,
"ptJet_/F");
38 mcTruthTree_->Branch(
"ptGen", &ptGen_,
"ptGen_/F");
39 mcTruthTree_->Branch(
"ptHat", &ptHat_,
"ptHat_/F");
40 mcTruthTree_->Branch(
"emfJet", &emfJet_,
"emfJet_/F");
41 mcTruthTree_->Branch(
"etaJet", &etaJet_,
"etaJet_/F");
42 mcTruthTree_->Branch(
"etaGen", &etaGen_,
"etaGen_/F");
43 mcTruthTree_->Branch(
"phiJet", &phiJet_,
"phiJet_/F");
44 mcTruthTree_->Branch(
"phiGen", &phiGen_,
"phiGen_/F");
45 mcTruthTree_->Branch(
"dR", &dR_,
"dR_/F");
46 mcTruthTree_->Branch(
"rank", &rank_,
"rank_/I");
50 if (file_ !=
nullptr) {
52 mcTruthTree_->Write();
61 CaloJetCollection::const_iterator i_jet, i_matched;
62 GenJetCollection::const_iterator i_genjet;
63 event.getByToken(genjets_, genjets);
64 event.getByToken(jets_, jets);
65 event.getByToken(gen_, hEventInfo);
69 if (!jets->empty() && !genjets->empty()) {
70 for (i_genjet = genjets->begin(); i_genjet != genjets->end(); i_genjet++) {
72 for (i_jet = jets->begin(); i_jet != jets->end(); i_jet++) {
73 rr =
radius(i_genjet, i_jet);
79 ptGen_ = i_genjet->pt();
80 etaGen_ = i_genjet->eta();
81 phiGen_ = i_genjet->phi();
82 ptJet_ = i_matched->pt();
83 etaJet_ = i_matched->eta();
84 phiJet_ = i_matched->phi();
85 emfJet_ = i_matched->emEnergyFraction();
T getParameter(std::string const &) const
const std::vector< double > & binningValues() const
CaloMCTruthTreeProducer(edm::ParameterSet const &cfg)
~CaloMCTruthTreeProducer() override
void analyze(edm::Event const &e, edm::EventSetup const &iSetup) override