16 produces<reco::PFCandidateCollection>();
39 CandidateView::const_iterator shiftedObjectP4_matched;
40 bool isMatched_Object =
false;
42 for ( CandidateView::const_iterator unshiftedObject = unshiftedObjects->begin();
43 unshiftedObject != unshiftedObjects->end(); ++unshiftedObject ) {
44 isMatched_Object =
false;
47 for ( CandidateView::const_iterator shiftedObject = shiftedObjects->begin();
48 shiftedObject != shiftedObjects->end(); ++shiftedObject ) {
49 double dR2 =
deltaR2(unshiftedObject->p4(), shiftedObject->p4());
51 shiftedObjectP4_matched = shiftedObject;
52 isMatched_Object =
true;
53 dR2bestMatch_Object = dR2;
56 if ( isMatched_Object ) {
61 auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
63 for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
64 originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
67 bool applyShift =
false;
68 double dR2bestMatch_PFCandidate =
dRDefault;
69 for ( std::vector<objectEntryType>::const_iterator
object =
objects_.begin();
71 if ( !
object->isValidMatch_ )
continue;
72 double dR2 =
deltaR2(originalPFCandidate->p4(),
object->unshiftedObjectP4_);
74 shift =
object->shift_;
76 dR2bestMatch_PFCandidate = dR2;
82 double shiftedPx = (1. +
shift)*originalPFCandidate->px();
83 double shiftedPy = (1. +
shift)*originalPFCandidate->py();
84 double shiftedPz = (1. +
shift)*originalPFCandidate->pz();
85 double mass = originalPFCandidate->mass();
86 double shiftedEn =
sqrt(shiftedPx*shiftedPx + shiftedPy*shiftedPy + shiftedPz*shiftedPz + mass*mass);
87 shiftedPFCandidateP4.SetPxPyPzE(shiftedPx, shiftedPy, shiftedPz, shiftedEn);
91 shiftedPFCandidate.
setP4(shiftedPFCandidateP4);
93 shiftedPFCandidates->push_back(shiftedPFCandidate);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double dR2match_PFCandidate_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
~ShiftedPFCandidateProducerByMatchedObject() override
edm::EDGetTokenT< edm::View< reco::Candidate > > srcShiftedObjects_
#define DEFINE_FWK_MODULE(type)
double dRmatch_PFCandidate_
edm::EDGetTokenT< edm::View< reco::Candidate > > srcUnshiftedObjects_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::vector< objectEntryType > objects_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
static unsigned int const shift
ShiftedPFCandidateProducerByMatchedObject(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
void setP4(const LorentzVector &p4) final
set 4-momentum
edm::View< Candidate > CandidateView
view of a collection containing candidates