35 CandidateView::const_iterator shiftedObjectP4_matched;
36 bool isMatched_Object =
false;
38 for (CandidateView::const_iterator unshiftedObject = unshiftedObjects->begin();
39 unshiftedObject != unshiftedObjects->end();
41 isMatched_Object =
false;
44 for (CandidateView::const_iterator shiftedObject = shiftedObjects->begin(); shiftedObject != shiftedObjects->end();
46 double dR2 =
deltaR2(unshiftedObject->p4(), shiftedObject->p4());
48 shiftedObjectP4_matched = shiftedObject;
49 isMatched_Object =
true;
50 dR2bestMatch_Object = dR2;
53 if (isMatched_Object) {
55 objectEntryType(shiftedObjectP4_matched->p4(), unshiftedObject->p4(),
sqrt(dR2bestMatch_Object)));
59 auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
61 for (reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
62 originalPFCandidate != originalPFCandidates->end();
63 ++originalPFCandidate) {
65 bool applyShift =
false;
66 double dR2bestMatch_PFCandidate =
dRDefault;
67 for (std::vector<objectEntryType>::const_iterator
object =
objects_.begin();
object !=
objects_.end(); ++
object) {
68 if (!
object->isValidMatch_)
70 double dR2 =
deltaR2(originalPFCandidate->p4(),
object->unshiftedObjectP4_);
72 shift =
object->shift_;
74 dR2bestMatch_PFCandidate = dR2;
80 double shiftedPx = (1. +
shift) * originalPFCandidate->px();
81 double shiftedPy = (1. +
shift) * originalPFCandidate->py();
82 double shiftedPz = (1. +
shift) * originalPFCandidate->pz();
83 double mass = originalPFCandidate->mass();
84 double shiftedEn =
sqrt(shiftedPx * shiftedPx + shiftedPy * shiftedPy + shiftedPz * shiftedPz + mass * mass);
85 shiftedPFCandidateP4.SetPxPyPzE(shiftedPx, shiftedPy, shiftedPz, shiftedEn);
89 shiftedPFCandidate.setP4(shiftedPFCandidateP4);
91 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_
edm::EDGetTokenT< edm::View< reco::Candidate > > srcShiftedObjects_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
edm::EDGetTokenT< edm::View< reco::Candidate > > srcUnshiftedObjects_
std::vector< objectEntryType > objects_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
static unsigned int const shift
edm::View< Candidate > CandidateView
view of a collection containing candidates