60 if (unshiftedObjectP4.energy() > 0.) {
61 shift_ = (shiftedObjectP4.energy() / unshiftedObjectP4.energy()) - 1.;
79 : moduleLabel_(
cfg.getParameter<
std::
string>(
"@module_label")),
89 produces<reco::PFCandidateCollection>();
108 std::vector<bool>
match(shiftedObjects->
size(),
false);
113 unshiftedObject != unshiftedObjects->
end();
115 bool isMatched_Object =
false;
125 double dR2 =
deltaR2(unshiftedObject->p4(), shiftedObject->p4());
127 shiftedObjectP4_matched = shiftedObject->p4();
128 isMatched_Object =
true;
129 dR2bestMatch_Object = dR2;
135 if (isMatched_Object) {
137 match[prevMatch] =
true;
144 auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
146 for (reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
147 originalPFCandidate != originalPFCandidates->end();
148 ++originalPFCandidate) {
150 bool applyShift =
false;
151 double dR2bestMatch_PFCandidate =
dRDefault;
155 for (std::vector<objectEntryType>::const_iterator
object =
objects_.begin();
object !=
objects_.end(); ++
object) {
156 if (!
object->isValidMatch_)
161 double dR2 =
deltaR2(originalPFCandidate->p4(),
object->unshiftedObjectP4_);
163 shift =
object->shift_;
165 dR2bestMatch_PFCandidate = dR2;
175 match[prevMatch] =
true;
177 shiftedPFCandidateP4 *= (1. +
shift);
181 shiftedPFCandidate.
setP4(shiftedPFCandidateP4);
183 shiftedPFCandidates->push_back(shiftedPFCandidate);
double dRmatch_PFCandidate_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
#define DEFINE_FWK_MODULE(type)
~ShiftedPFCandidateProducerForPFMVAMEt() override
std::vector< l1t::PFCandidate > PFCandidateCollection
double dR2match_PFCandidate_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
objectEntryType(const reco::Candidate::LorentzVector &shiftedObjectP4, const reco::Candidate::LorentzVector &unshiftedObjectP4, double dRmatch)
std::vector< objectEntryType > objects_
ShiftedPFCandidateProducerForPFMVAMEt(const edm::ParameterSet &)
reco::Candidate::LorentzVector unshiftedObjectP4_
edm::EDGetTokenT< CandidateView > srcShiftedObjectsToken_
edm::View< reco::Candidate > CandidateView
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
static unsigned int const shift
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
const_iterator begin() const
void produce(edm::Event &, const edm::EventSetup &) override
reco::Candidate::LorentzVector shiftedObjectP4_
const_iterator end() const
void setP4(const LorentzVector &p4) final
set 4-momentum
edm::EDGetTokenT< CandidateView > srcUnshiftedObjectsToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_