86 #include <Math/VectorUtil.h>
92 using namespace ROOT::Math::VectorUtil;
103 int fillAlgoritDefinition(
const Jet& );
104 int fillPhysicsDefinition(
const Jet& );
129 produces<JetMatchedPartonsCollection>();
133 if ( iConfig.
exists(
"doPriority") ) {
161 aParton.
pdgId() <<
" " <<
162 aParton.
pt() <<
" " <<
163 aParton.
eta() <<
" " <<
164 aParton.
phi() << endl;
167 auto jetMatchedPartons = std::make_unique<JetMatchedPartonsCollection>(
reco::JetRefBaseProd(jets_h));
169 for (
size_t j = 0;
j < jets_h->size();
j++) {
183 if(theMappedPartonPhy>=0) pPH =
particles->at( theMappedPartonPhy );
184 if(theMappedPartonAlg>=0) pAL =
particles->at( theMappedPartonAlg );
186 (*jetMatchedPartons)[jets_h->refAt(j)]=
MatchedPartons(pHV,pN2,pN3,pPH,pAL);
218 int tempParticle = -1;
219 int tempPartonHighestPt = -1;
220 int tempNearest = -1;
223 bool foundPriority =
false;
244 for(
size_t m = 0;
m !=
particles->size() && !foundPriority; ++
m ) {
251 int ipdgId = aParton.
pdgId();
257 double dist =
DeltaR( theJet.
p4(), aParton.
p4() );
260 foundPriority =
true;
267 foundPriority =
false;
275 if( !foundPriority && aParton.
status() != 3 ) {
276 double dist =
DeltaR( theJet.
p4(), aParton.
p4() );
282 if( tempParticle == -1 && (
abs( aParton.
pdgId() ) == 4 ) ) tempParticle =
m;
283 if(
abs( aParton.
pdgId() ) == 5 ) tempParticle =
m;
284 if( aParton.
pt() > maxPt ) {
285 maxPt = aParton.
pt();
286 tempPartonHighestPt =
m;
292 if ( foundPriority ) {
300 if ( tempParticle == -1 ) tempParticle = tempPartonHighestPt;
329 float TheBiggerConeSize = 0.7;
330 int tempParticle = -1;
332 int tempNearest = -1;
334 bool foundPriority =
false;
336 vector<const reco::Candidate *> theContaminations;
337 theContaminations.clear();
358 for(
size_t m = 0;
m !=
particles->size() && !foundPriority; ++
m ) {
366 int ipdgId = aParticle.
pdgId();
372 double dist =
DeltaR( theJet.
p4(), aParticle.
p4() );
375 foundPriority =
true;
382 foundPriority =
false;
386 if ( !foundPriority ) {
389 bool isAParton =
false;
396 flavour == 21 ) isAParton =
true;
397 if(!isAParton)
continue;
398 double dist =
DeltaR( theJet.
p4(), aParticle.
p4() );
399 if( aParticle.
status() == 3 && dist < minDr ) {
413 flavour == 21 )
continue;
414 if( dist < TheBiggerConeSize ) theContaminations.push_back( &aParticle );
421 if ( !foundPriority ) {
424 if(nInTheCone != 1)
return -1;
425 if(theContaminations.size() == 0 )
return tempParticle;
428 vector<const Candidate *>::const_iterator itCont = theContaminations.begin();
429 for( ; itCont != theContaminations.end(); itCont++ ) {
430 int contaminatingFlavour =
abs( (*itCont)->pdgId() );
431 if( (*itCont)->numberOfMothers()>0 && (*itCont)->mother(0) ==
particles->at(tempParticle).get() )
continue;
432 if( initialPartonFlavour == 4 ) {
433 if( contaminatingFlavour == 4 )
continue;
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
int fillPhysicsDefinition(const Jet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
virtual int status() const =0
status word
bool exists(std::string const ¶meterName) const
checks if a parameter exists
virtual double phi() const final
momentum azimuthal angle
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int fillAlgoritDefinition(const Jet &)
edm::RefToBaseProd< reco::Jet > JetRefBaseProd
virtual int status() const final
status word
virtual size_type numberOfDaughters() const =0
number of daughters
edm::EDGetTokenT< GenParticleRefVector > m_ParticleSrcToken
Handle< GenParticleRefVector > particles
Abs< T >::type abs(const T &t)
JetPartonMatcher(const edm::ParameterSet &)
virtual int pdgId() const =0
PDG identifier.
vector< int > priorityList
virtual int pdgId() const final
PDG identifier.
double coneSizeToAssociate
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual double eta() const final
momentum pseudorapidity
edm::EDGetTokenT< edm::View< reco::Jet > > m_jetsSrcToken
int flavour(const Candidate &part)
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
virtual double pt() const final
transverse momentum
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector