86 #include <Math/VectorUtil.h>
92 using namespace ROOT::Math::VectorUtil;
124 produces<JetMatchedPartonsCollection>();
128 if (iConfig.
exists(
"doPriority")) {
130 priorityList = iConfig.
getParameter<vector<int> >(
"priorityList");
133 priorityList.clear();
146 iEvent.getByToken(m_jetsSrcToken, jets_h);
154 << aParton.
eta() <<
" " << aParton.
phi() << endl;
157 auto jetMatchedPartons = std::make_unique<JetMatchedPartonsCollection>(
reco::JetRefBaseProd(jets_h));
159 for (
size_t j = 0;
j < jets_h->size();
j++) {
160 const int theMappedPartonAlg = fillAlgoritDefinition((*jets_h)[
j], wv);
161 const int theMappedPartonPhy = fillPhysicsDefinition((*jets_h)[
j], wv);
175 if (theMappedPartonPhy >= 0)
176 pPH = wv.
particles->at(theMappedPartonPhy);
177 if (theMappedPartonAlg >= 0)
178 pAL = wv.
particles->at(theMappedPartonAlg);
180 (*jetMatchedPartons)[jets_h->refAt(
j)] =
MatchedPartons(pHV, pN2, pN3, pPH, pAL);
210 int tempParticle = -1;
211 int tempPartonHighestPt = -1;
212 int tempNearest = -1;
215 bool foundPriority =
false;
236 for (
size_t m = 0;
m < wv.
particles->size() && !foundPriority; ++
m) {
245 vector<int>::const_iterator ipriority =
find(priorityList.begin(), priorityList.end(),
flavour);
247 if (ipriority != priorityList.end()) {
250 double dist =
DeltaR(theJet.
p4(), aParton.
p4());
253 foundPriority =
true;
260 foundPriority =
false;
268 if (!foundPriority && aParton.
status() != 3) {
269 double dist =
DeltaR(theJet.
p4(), aParton.
p4());
275 if (tempParticle == -1 && (
flavour == 4))
281 tempPartonHighestPt =
m;
295 if (tempParticle == -1)
296 tempParticle = tempPartonHighestPt;
324 float TheBiggerConeSize = 0.7;
325 int tempParticle = -1;
327 int tempNearest = -1;
329 bool foundPriority =
false;
331 vector<const reco::Candidate*> theContaminations;
332 theContaminations.clear();
353 for (
size_t m = 0;
m < wv.
particles->size() && !foundPriority; ++
m) {
362 vector<int>::const_iterator ipriority =
find(priorityList.begin(), priorityList.end(),
flavour);
364 if (ipriority != priorityList.end()) {
367 double dist =
DeltaR(theJet.
p4(), aParticle.
p4());
370 foundPriority =
true;
377 foundPriority =
false;
381 if (!foundPriority) {
383 bool isAParton =
false;
388 double dist =
DeltaR(theJet.
p4(), aParticle.
p4());
389 if (aParticle.
status() == 3 && dist < minDr) {
402 if (dist < TheBiggerConeSize)
403 theContaminations.push_back(&aParticle);
409 if (!foundPriority) {
414 if (theContaminations.empty())
418 vector<const Candidate*>::const_iterator itCont = theContaminations.begin();
419 for (; itCont != theContaminations.end(); itCont++) {
420 int contaminatingFlavour =
abs((*itCont)->pdgId());
421 if ((*itCont)->numberOfMothers() > 0 && (*itCont)->mother(0) == wv.
particles->at(tempParticle).get())
423 if (initialPartonFlavour == 4) {
424 if (contaminatingFlavour == 4)