24 produces<JetCollection>();
40 evt.
getByToken(srcUnshiftedObjects_, unshiftedObjects);
43 evt.
getByToken(srcShiftedObjects_, shiftedObjects);
47 std::vector<bool>
match(shiftedObjects->size(),
false);
52 unshiftedObject != unshiftedObjects->end(); ++unshiftedObject ) {
53 bool isMatched_Object =
false;
60 shiftedObject != shiftedObjects->end(); ++shiftedObject ) {
61 if(
match[ cnt ] )
continue;
63 double dR2 =
deltaR2(unshiftedObject->p4(), shiftedObject->p4());
64 if ( dR2 < dR2match_Object_ && dR2 < dR2bestMatch_Object ) {
65 shiftedObjectP4_matched = shiftedObject->p4();
66 isMatched_Object =
true;
67 dR2bestMatch_Object = dR2;
73 if ( isMatched_Object ) {
75 match[ prevMatch ] =
true;
76 objects_.push_back(
objectEntryType(shiftedObjectP4_matched, unshiftedObject->p4(),
sqrt(dR2bestMatch_Object)));
81 match.assign(objects_.size(),
false);
85 for (
typename JetCollection::const_iterator originalJet = originalJets->begin();
86 originalJet != originalJets->end(); ++originalJet ) {
89 bool applyShift =
false;
94 for (
typename std::vector<objectEntryType>::const_iterator
object = objects_.begin();
95 object != objects_.end(); ++object ) {
96 if ( !object->isValidMatch_ )
continue;
97 if(
match[ cnt ] )
continue;
99 double dR2 =
deltaR2(originalJet->p4(),
object->unshiftedObjectP4_);
100 if ( dR2 < dR2match_Jet_ && dR2 < dR2bestMatch_Jet ) {
101 shift =
object->shift_;
103 dR2bestMatch_Jet = dR2;
113 match[ prevMatch ] =
true;
115 shiftedJetP4 *= (1. +
shift);
118 T shiftedJet(*originalJet);
119 shiftedJet.setP4(shiftedJetP4);
121 shiftedJets->push_back(shiftedJet);
124 evt.
put(shiftedJets);
T getParameter(std::string const &) const
ShiftedJetProducerByMatchedObjectT< reco::CaloJet > ShiftedCaloJetProducerByMatchedObject
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void produce(edm::Event &, const edm::EventSetup &)
std::vector< T > JetCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< edm::View< reco::Candidate > > srcShiftedObjects_
ShiftedJetProducerByMatchedObjectT< reco::PFJet > ShiftedPFJetProducerByMatchedObject
edm::EDGetTokenT< edm::View< reco::Candidate > > srcUnshiftedObjects_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
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< JetCollection > srcJets_
~ShiftedJetProducerByMatchedObjectT()
ShiftedJetProducerByMatchedObjectT(const edm::ParameterSet &)