56 std::vector<float> pxs, pys, pzs, vzs;
57 std::vector<bool> isPUs;
62 pxs.emplace_back(pruned_cand.px());
63 pys.emplace_back(pruned_cand.py());
64 pzs.emplace_back(pruned_cand.pz());
65 vzs.emplace_back(pruned_cand.vz());
66 isPUs.emplace_back(
false);
72 for (
const auto& pu_cand : *hPUCands) {
75 bool associated{
false};
76 for (
size_t i = 0;
i < pzs.size(); ++
i) {
77 if (fabs(1. - pxs.at(
i) / pu_cand.px()) <
tolerance_ && fabs(1. - pys.at(
i) / pu_cand.py()) <
tolerance_ &&
85 pxs.emplace_back(pu_cand.px());
86 pys.emplace_back(pu_cand.py());
87 pzs.emplace_back(pu_cand.pz());
88 vzs.emplace_back(pu_cand.vz());
89 isPUs.emplace_back(
true);
92 auto protons_table = std::make_unique<nanoaod::FlatTable>(isPUs.size(),
table_name_,
false);
93 protons_table->addColumn<
float>(
"px", pxs,
"proton horizontal momentum", 8);
94 protons_table->addColumn<
float>(
"py", pys,
"proton vertical momentum", 8);
95 protons_table->addColumn<
float>(
"pz", pzs,
"proton longitudinal momentum", 8);
96 protons_table->addColumn<
float>(
"vz", vzs,
"proton vertex longitudinal coordinate", 8);
97 protons_table->addColumn<
bool>(
"isPU", isPUs,
"pileup proton?");
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< reco::GenParticleCollection > puAltCandsToken_
const StringCutObjectSelector< reco::Candidate > protonsCut_
bool get(ProductID const &oid, Handle< PROD > &result) const
const edm::EDGetTokenT< reco::GenParticleCollection > puCandsToken_
bool use_alt_coll_
Are we using premix/mix collection name for PU protons?
const std::string table_name_
const edm::EDGetTokenT< reco::GenParticleCollection > prunedCandsToken_