101 CandidateView::const_iterator shiftedObjectP4_matched;
102 bool isMatched_Object =
false;
104 for (CandidateView::const_iterator unshiftedObject = unshiftedObjects->begin();
105 unshiftedObject != unshiftedObjects->end();
107 isMatched_Object =
false;
110 for (CandidateView::const_iterator shiftedObject = shiftedObjects->begin(); shiftedObject != shiftedObjects->end();
112 double dR2 =
deltaR2(unshiftedObject->p4(), shiftedObject->p4());
114 shiftedObjectP4_matched = shiftedObject;
115 isMatched_Object =
true;
116 dR2bestMatch_Object =
dR2;
119 if (isMatched_Object) {
121 objectEntryType(shiftedObjectP4_matched->p4(), unshiftedObject->p4(),
sqrt(dR2bestMatch_Object)));
125 auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
127 for (reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
128 originalPFCandidate != originalPFCandidates->end();
129 ++originalPFCandidate) {
131 bool applyShift =
false;
132 double dR2bestMatch_PFCandidate =
dRDefault;
133 for (std::vector<objectEntryType>::const_iterator
object =
objects_.begin();
object !=
objects_.end(); ++
object) {
134 if (!
object->isValidMatch_)
136 double dR2 =
deltaR2(originalPFCandidate->p4(),
object->unshiftedObjectP4_);
138 shift =
object->shift_;
140 dR2bestMatch_PFCandidate =
dR2;
146 double shiftedPx = (1. +
shift) * originalPFCandidate->px();
147 double shiftedPy = (1. +
shift) * originalPFCandidate->py();
148 double shiftedPz = (1. +
shift) * originalPFCandidate->pz();
149 double mass = originalPFCandidate->mass();
150 double shiftedEn =
sqrt(shiftedPx * shiftedPx + shiftedPy * shiftedPy + shiftedPz * shiftedPz +
mass *
mass);
151 shiftedPFCandidateP4.SetPxPyPzE(shiftedPx, shiftedPy, shiftedPz, shiftedEn);
155 shiftedPFCandidate.setP4(shiftedPFCandidateP4);
157 shiftedPFCandidates->push_back(shiftedPFCandidate);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double dR2match_PFCandidate_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< edm::View< reco::Candidate > > srcShiftedObjects_
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
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