41 std::vector<bool>
match(shiftedObjects->
size(),
false);
46 unshiftedObject != unshiftedObjects->
end(); ++unshiftedObject ) {
47 bool isMatched_Object =
false;
53 shiftedObject != shiftedObjects->
end(); ++shiftedObject ) {
54 if(
match[ cnt ] )
continue;
56 double dR2 =
deltaR2(unshiftedObject->p4(), shiftedObject->p4());
58 shiftedObjectP4_matched = shiftedObject->p4();
59 isMatched_Object =
true;
60 dR2bestMatch_Object = dR2;
66 if ( isMatched_Object ) {
68 match[ prevMatch ] =
true;
69 objects_.push_back(objectEntryType(shiftedObjectP4_matched, unshiftedObject->p4(),
sqrt(dR2bestMatch_Object)));
75 auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
77 for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
78 originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
81 bool applyShift =
false;
82 double dR2bestMatch_PFCandidate =
dRDefault;
86 for ( std::vector<objectEntryType>::const_iterator
object =
objects_.begin();
88 if ( !
object->isValidMatch_ )
continue;
89 if(
match[ cnt ] )
continue;
91 double dR2 =
deltaR2(originalPFCandidate->p4(),
object->unshiftedObjectP4_);
93 shift =
object->shift_;
95 dR2bestMatch_PFCandidate = dR2;
105 match[ prevMatch ] =
true;
107 shiftedPFCandidateP4 *= (1. +
shift);
111 shiftedPFCandidate.setP4(shiftedPFCandidateP4);
113 shiftedPFCandidates->push_back(shiftedPFCandidate);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double dR2match_PFCandidate_
std::vector< objectEntryType > objects_
const_iterator begin() const
edm::EDGetTokenT< CandidateView > srcShiftedObjectsToken_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Particle reconstructed by the particle flow algorithm.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
static unsigned int const shift
const_iterator end() const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::EDGetTokenT< CandidateView > srcUnshiftedObjectsToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_