49 maxDR_( iConfig.getParameter<double>(
"maxDR") )
51 produces<edm::ValueMap<float>>(
"chargedHadronPUEnergyFraction");
52 produces<edm::ValueMap<float>>(
"chargedHadronCHSEnergyFraction");
78 unsigned int nJet = srcJet->size();
80 std::vector<float> chargedHadronPUEnergyFraction(nJet,-1);
81 std::vector<float> chargedHadronCHSEnergyFraction(nJet,-1);
83 for (
unsigned int ij = 0; ij < nJet; ++ij ) {
84 auto jet = srcJet->ptrAt(ij);
86 auto chpuf = std::get<0>(
vals);
87 auto chef = std::get<1>(
vals);
88 chargedHadronPUEnergyFraction[ij] = chpuf;
89 chargedHadronCHSEnergyFraction[ij] = chef;
92 std::unique_ptr<edm::ValueMap<float>> chargedHadronPUEnergyFractionV(
new edm::ValueMap<float>());
94 fillerPU.
insert(srcJet,chargedHadronPUEnergyFraction.begin(),chargedHadronPUEnergyFraction.end());
96 iEvent.
put(
std::move(chargedHadronPUEnergyFractionV),
"chargedHadronPUEnergyFraction");
98 std::unique_ptr<edm::ValueMap<float>> chargedHadronCHSEnergyFractionV(
new edm::ValueMap<float>());
100 fillerCHE.
insert(srcJet,chargedHadronCHSEnergyFraction.begin(),chargedHadronCHSEnergyFraction.end());
102 iEvent.
put(
std::move(chargedHadronCHSEnergyFractionV),
"chargedHadronCHSEnergyFraction");
106 template <
typename T>
107 std::tuple<float,float>
111 std::vector<unsigned int> jet2pu;
116 for (
unsigned int icand = 0; icand < cands.size(); ++icand ) {
117 auto cand = cands.ptrAt(icand);
118 if (
cand->fromPV()!=0)
continue;
121 jet2pu.emplace_back(
cand.key() );
131 std::vector<unsigned int> used;
133 for (
auto const & ic : jetConstituents ) {
135 if ( icpc->charge()!=0) {
137 if (icpc->fromPV()==0) {
138 used.push_back( ic.key() );
143 for (
auto pidx : jet2pu) {
144 auto const & dtr = cands.ptrAt(pidx);
146 if (dtr->charge()!=0 and
std::find(used.begin(),used.end(),dtr.key() )==used.end())
147 pue += dtr->energy();
151 auto puf = pue / rawP4.energy();
152 auto chf = che / rawP4.energy();
154 return std::tuple<float,float>(puf,chf);
157 template <
typename T>
162 desc.
add<
edm::InputTag>(
"srcPF")->setComment(
"PF candidate input collection");
163 desc.
add<
double>(
"maxDR")->setComment(
"Maximum DR to consider for jet-->pf cand association");
165 descriptions.
add(modname,desc);
const LorentzVector correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
BetaStarVarProducer< pat::PackedCandidate > BetaStarPackedCandidateVarProducer
void insert(const H &h, I begin, I end)
~BetaStarVarProducer() override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_
edm::EDGetTokenT< edm::View< T > > srcPF_
double energy() const override
energy
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::tuple< float, float > calculateCHSEnergies(edm::Ptr< pat::Jet > const &jet, edm::View< T > const &cands) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
BetaStarVarProducer(const edm::ParameterSet &iConfig)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const reco::CompositePtrCandidate::daughters & daughterPtrVector() const override
references to daughtes