86 #include <Math/VectorUtil.h>
92 using namespace ROOT::Math::VectorUtil;
124 produces<JetMatchedPartonsCollection>();
127 coneSizeToAssociate = iConfig.
getParameter<
double>(
"coneSizeToAssociate");
128 if (iConfig.
exists(
"doPriority")) {
130 priorityList = iConfig.
getParameter<vector<int> >(
"priorityList");
133 priorityList.clear();
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());
251 if (dist <= coneSizeToAssociate) {
253 foundPriority =
true;
260 foundPriority =
false;
268 if (!foundPriority && aParton.
status() != 3) {
269 double dist =
DeltaR(theJet.
p4(), aParton.
p4());
270 if (dist <= coneSizeToAssociate) {
275 if (tempParticle == -1 && (flavour == 4))
279 if (aParton.
pt() > maxPt) {
280 maxPt = aParton.
pt();
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());
368 if (dist <= coneSizeToAssociate) {
370 foundPriority =
true;
377 foundPriority =
false;
381 if (!foundPriority) {
383 bool isAParton =
false;
384 if (flavour == 1 || flavour == 2 || flavour == 3 || flavour == 4 || flavour == 5 || flavour == 21)
388 double dist =
DeltaR(theJet.
p4(), aParticle.
p4());
389 if (aParticle.
status() == 3 && dist < minDr) {
393 if (aParticle.
status() == 3 && dist <= coneSizeToAssociate) {
400 if (flavour == 1 || flavour == 2 || flavour == 3 || flavour == 21)
402 if (dist < TheBiggerConeSize)
403 theContaminations.push_back(&aParticle);
409 if (!foundPriority) {
414 if (theContaminations.empty())
416 int initialPartonFlavour =
abs((wv.
particles->at(tempParticle).get())->pdgId());
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)
Log< level::Info, true > LogVerbatim
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double pt() const final
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
int fillAlgoritDefinition(const Jet &, WorkingVariables &) const
size_t numberOfDaughters() const override
number of daughters
bool exists(std::string const ¶meterName) const
checks if a parameter exists
int status() const final
status word
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const LorentzVector & p4() const final
four-momentum Lorentz vector
int pdgId() const final
PDG identifier.
edm::RefToBaseProd< reco::Jet > JetRefBaseProd
edm::EDGetTokenT< GenParticleRefVector > m_ParticleSrcToken
Abs< T >::type abs(const T &t)
JetPartonMatcher(const edm::ParameterSet &)
vector< int > priorityList
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
T getParameter(std::string const &) const
~JetPartonMatcher() override
double coneSizeToAssociate
edm::EDGetTokenT< edm::View< reco::Jet > > m_jetsSrcToken
int fillPhysicsDefinition(const Jet &, WorkingVariables &) const
double phi() const final
momentum azimuthal angle
Handle< GenParticleRefVector > particles
double eta() const final
momentum pseudorapidity