8 : moduleLabel_(cfg.getParameter<
std::
string>(
"@module_label"))
10 , srcUnshiftedObjectsToken_(consumes<
CandidateView>(cfg.getParameter<
edm::InputTag>(
"srcUnshiftedObjects")))
11 , srcShiftedObjectsToken_(consumes<
CandidateView>(cfg.getParameter<
edm::InputTag>(
"srcShiftedObjects")))
20 produces<reco::PFCandidateCollection>();
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;
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);
double dRmatch_PFCandidate_
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
~ShiftedPFCandidateProducerForPFMVAMEt() override
double dR2match_PFCandidate_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< objectEntryType > objects_
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
ShiftedPFCandidateProducerForPFMVAMEt(const edm::ParameterSet &)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< CandidateView > srcShiftedObjectsToken_
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
const_iterator end() const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void produce(edm::Event &, const edm::EventSetup &) override
void setP4(const LorentzVector &p4) final
set 4-momentum
edm::EDGetTokenT< CandidateView > srcUnshiftedObjectsToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_