26 consumes<PFCandToVertexAssMap>(
cfg.getParameter<
edm::InputTag>(
"srcPFCandToVertexAssociations"));
29 dZcut_ =
cfg.getParameter<
double>(
"dZcut");
34 if (neutralJetOption_string ==
"PU")
36 else if (neutralJetOption_string ==
"noPU")
40 <<
"Invalid Configuration Parameter 'neutralJetOption' = " << neutralJetOption_string <<
" !!\n";
42 verbosity_ = (
cfg.exists(
"verbosity")) ?
cfg.getParameter<
int>(
"verbosity") : 0;
44 produces<edm::ValueMap<double>>(
"Discriminant");
45 produces<edm::ValueMap<int>>(
"Id");
59 LogDebug(
"computeJVF") <<
"<computeJVF>:" << std::endl
60 <<
" jet: Pt = " <<
jet.pt() <<
", eta = " <<
jet.eta() <<
", phi = " <<
jet.phi()
63 double trackSum_isVtxAssociated = 0.;
64 double trackSum_isNotVtxAssociated = 0.;
66 std::vector<reco::PFCandidatePtr> pfConsts =
jet.getPFConstituents();
67 for (std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = pfConsts.begin();
68 jetConstituent != pfConsts.end();
70 if ((*jetConstituent)->charge() == 0)
74 if ((*jetConstituent)->gsfTrackRef().isNonnull() && (*jetConstituent)->gsfTrackRef().isAvailable())
75 trackPt = (*jetConstituent)->gsfTrackRef()->pt();
76 else if ((*jetConstituent)->trackRef().isNonnull() && (*jetConstituent)->trackRef().isAvailable())
77 trackPt = (*jetConstituent)->trackRef()->pt();
79 trackPt = (*jetConstituent)->pt();
82 int jetConstituent_vtxAssociationType =
86 double jetConstituentPt = (*jetConstituent)->pt();
87 if (jetConstituent_isVtxAssociated) {
88 LogDebug(
"computeJVF") <<
"associated track: Pt = " << (*jetConstituent)->pt()
89 <<
", eta = " << (*jetConstituent)->eta() <<
", phi = " << (*jetConstituent)->phi()
91 <<
" (vtxAssociationType = " << jetConstituent_vtxAssociationType <<
")" << std::endl;
93 trackSum_isVtxAssociated += jetConstituentPt;
95 LogDebug(
"computeJVF") <<
"unassociated track: Pt = " << (*jetConstituent)->pt()
96 <<
", eta = " << (*jetConstituent)->eta() <<
", phi = " << (*jetConstituent)->phi()
98 <<
" (vtxAssociationType = " << jetConstituent_vtxAssociationType <<
")" << std::endl;
100 trackSum_isNotVtxAssociated += jetConstituentPt;
105 double trackSum = trackSum_isVtxAssociated + trackSum_isNotVtxAssociated;
109 jvf = trackSum_isVtxAssociated / trackSum;
112 LogDebug(
"computeJVF") <<
"trackSum: associated = " << trackSum_isVtxAssociated
113 <<
", unassociated = " << trackSum_isNotVtxAssociated << std::endl
114 <<
" --> JVF = " << jvf << std::endl;
136 std::vector<double> jetIdDiscriminants;
137 std::vector<int> jetIdFlags;
139 size_t numJets =
jets->size();
140 for (
size_t iJet = 0; iJet < numJets; ++iJet) {
143 double jetJVF = computeJVF(
145 jetIdDiscriminants.push_back(jetJVF);
152 jetIdFlags.push_back(jetIdFlag);
155 auto jetIdDiscriminants_ptr = std::make_unique<edm::ValueMap<double>>();
157 jetIdDiscriminantFiller.insert(
jets, jetIdDiscriminants.begin(), jetIdDiscriminants.end());
158 jetIdDiscriminantFiller.fill();
160 auto jetIdFlags_ptr = std::make_unique<edm::ValueMap<int>>();
162 jetIdFlagFiller.insert(
jets, jetIdFlags.begin(), jetIdFlags.end());
163 jetIdFlagFiller.fill();
165 evt.
put(
std::move(jetIdDiscriminants_ptr),
"Discriminant");
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
#define DEFINE_FWK_MODULE(type)
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Jets made from PFObjects.
edm::EDGetTokenT< PFCandToVertexAssMap > srcPFCandToVertexAssociations_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
JVFJetIdProducer(const edm::ParameterSet &)
~JVFJetIdProducer() override
Abs< T >::type abs(const T &t)
int isVertexAssociated(const reco::PFCandidatePtr &, const PFCandToVertexAssMap &, const reco::VertexCollection &, double)
edm::EDGetTokenT< reco::VertexCollection > srcHardScatterVertex_
void produce(edm::Event &, const edm::EventSetup &) override