31 template <
class T,
class C=T >
41 distMax_( params.getParameter<double>(
"distMax" ) ),
42 value_( params.existsAs<std::
string>(
"value") ? params.getParameter<std::
string>(
"value") :
"" ),
43 values_( params.existsAs<std::vector<std::
string> >(
"values") ? params.getParameter<std::vector<std::
string> >(
"values") : std::vector<std::
string>() ),
44 valueLabels_( params.existsAs<std::vector<std::
string> >(
"valueLabels") ? params.getParameter<std::vector<std::
string> >(
"valueLabels") : std::vector<std::
string>() ),
45 lazyParser_( params.existsAs<bool>(
"lazyParser") ? params.getParameter<bool>(
"lazyParser") :
false ),
51 produces< JetValueMap >();
66 edm::LogWarning(
"ValueLabelMismatch") <<
"The number of value labels does not match the number of values. Values will not be evaluated.";
81 std::vector<float>
values( h_jets1->size(), -99999 );
82 std::map<std::string, std::vector<float> > valuesMap;
86 valuesMap.insert( std::make_pair(
valueLabels_[
i], std::vector<float>( h_jets1->size(), -99999 ) ) );
88 std::vector<bool> jets1_locks( h_jets1->size(),
false );
91 iend = h_jets2->end(), ijet = ibegin;
92 ijet != iend; ++ijet )
94 float matched_dR2 = 1e9;
95 int matched_index = -1;
98 jend = h_jets1->end(), jjet = jbegin;
99 jjet != jend; ++jjet )
101 int index=jjet - jbegin;
103 if( jets1_locks.at(index) )
continue;
105 float temp_dR2 =
reco::deltaR2(ijet->eta(),ijet->phi(),jjet->eta(),jjet->phi());
106 if ( temp_dR2 < matched_dR2 )
108 matched_dR2 = temp_dR2;
109 matched_index =
index;
113 if( matched_index>=0 )
116 edm::LogInfo(
"MatchedJetsFarApart") <<
"Matched jets separated by dR greater than distMax=" <<
distMax_;
119 jets1_locks.at(matched_index) =
true;
133 std::auto_ptr< JetValueMap > jetValueMap (
new JetValueMap() );
140 iEvent.
put(jetValueMap);
146 std::auto_ptr< JetValueMap > jetValueMap (
new JetValueMap() );
166 std::map<std::string, std::unique_ptr<const StringObjectFunction<C> > >
evaluationMap_;
edm::ValueMap< float > JetValueMap
JetDeltaRValueMapProducer(edm::ParameterSet const ¶ms)
const std::vector< std::string > valueLabels_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
JetDeltaRValueMapProducer< reco::Jet, pat::Jet > RecoJetToPatJetDeltaRValueMapProducer
void insert(const H &h, I begin, I end)
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::map< std::string, std::unique_ptr< const StringObjectFunction< C > > > evaluationMap_
JetDeltaRValueMapProducer< pat::Jet > PatJetDeltaRValueMapProducer
const edm::EDGetTokenT< typename edm::View< C > > matchedToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
const edm::EDGetTokenT< typename edm::View< T > > srcToken_
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
JetDeltaRValueMapProducer< reco::Jet > RecoJetDeltaRValueMapProducer
volatile std::atomic< bool > shutdown_flag false
const std::vector< std::string > values_
virtual ~JetDeltaRValueMapProducer()