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;
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);
116 evt.
put(shiftedPFCandidates);
double dRmatch_PFCandidate_
T getParameter(std::string const &) const
void produce(edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
double dR2match_PFCandidate_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
virtual void setP4(const LorentzVector &p4)
set 4-momentum
std::vector< objectEntryType > objects_
ShiftedPFCandidateProducerForPFMVAMEt(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double deltaR2(const T1 &t1, const T2 &t2)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
~ShiftedPFCandidateProducerForPFMVAMEt()
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
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::EDGetTokenT< CandidateView > srcUnshiftedObjectsToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_