17 produces<reco::PFCandidateCollection>();
41 bool isMatched_Object =
false;
42 double dR2bestMatch_Object = 1.e+3;
44 unshiftedObject != unshiftedObjects->end(); ++unshiftedObject ) {
45 isMatched_Object =
false;
46 dR2bestMatch_Object = 1.e+3;
49 shiftedObject != shiftedObjects->end(); ++shiftedObject ) {
50 double dR2 =
deltaR2(unshiftedObject->p4(), shiftedObject->p4());
52 shiftedObjectP4_matched = shiftedObject;
53 isMatched_Object =
true;
54 dR2bestMatch_Object = dR2;
57 if ( isMatched_Object ) {
64 for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
65 originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
68 bool applyShift =
false;
69 double dR2bestMatch_PFCandidate = 1.e+3;
70 for ( std::vector<objectEntryType>::const_iterator
object =
objects_.begin();
72 if ( !
object->isValidMatch_ )
continue;
73 double dR2 =
deltaR2(originalPFCandidate->p4(),
object->unshiftedObjectP4_);
75 shift =
object->shift_;
77 dR2bestMatch_PFCandidate = dR2;
83 double shiftedPx = (1. +
shift)*originalPFCandidate->px();
84 double shiftedPy = (1. +
shift)*originalPFCandidate->py();
85 double shiftedPz = (1. +
shift)*originalPFCandidate->pz();
86 double mass = originalPFCandidate->mass();
87 double shiftedEn = TMath::Sqrt(shiftedPx*shiftedPx + shiftedPy*shiftedPy + shiftedPz*shiftedPz + mass*mass);
88 shiftedPFCandidateP4.SetPxPyPzE(shiftedPx, shiftedPy, shiftedPz, shiftedEn);
92 shiftedPFCandidate.
setP4(shiftedPFCandidateP4);
94 shiftedPFCandidates->push_back(shiftedPFCandidate);
97 evt.
put(shiftedPFCandidates);
T getParameter(std::string const &) const
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
edm::EDGetTokenT< edm::View< reco::Candidate > > srcShiftedObjects_
edm::View< reco::Candidate > CandidateView
double dRmatch_PFCandidate_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double deltaR2(const T1 &t1, const T2 &t2)
edm::EDGetTokenT< edm::Handle< reco::PFCandidateCollection > > srcPFCandidates_
edm::EDGetTokenT< edm::View< reco::Candidate > > srcUnshiftedObjects_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< objectEntryType > objects_
~ShiftedPFCandidateProducerByMatchedObject()
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
ShiftedPFCandidateProducerByMatchedObject(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &)