86 #include <Math/VectorUtil.h> 124 produces<JetMatchedPartonsCollection>();
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());
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))
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());
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) {
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())
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)
T getParameter(std::string const &) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
int pdgId() const final
PDG identifier.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int fillAlgoritDefinition(const Jet &, WorkingVariables &) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
double pt() const final
transverse momentum
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::RefToBaseProd< reco::Jet > JetRefBaseProd
edm::EDGetTokenT< GenParticleRefVector > m_ParticleSrcToken
#define DEFINE_FWK_MODULE(type)
Abs< T >::type abs(const T &t)
const LorentzVector & p4() const final
four-momentum Lorentz vector
JetPartonMatcher(const edm::ParameterSet &)
vector< int > priorityList
size_t numberOfDaughters() const override
number of daughters
~JetPartonMatcher() override
double coneSizeToAssociate
edm::EDGetTokenT< edm::View< reco::Jet > > m_jetsSrcToken
int status() const final
status word
int fillPhysicsDefinition(const Jet &, WorkingVariables &) const
double phi() const final
momentum azimuthal angle
Handle< GenParticleRefVector > particles