184 std::vector<edm::ValueMap<JetCorrFactors> > jetCorrs;
189 jetCorrs.push_back( *jetCorr );
194 std::vector<edm::Handle<reco::JetFloatAssociation::Container> > jetDiscriminators;
201 std::vector<edm::Handle<edm::View<reco::BaseTagInfo> > > jetTagInfos;
220 auto patJets = std::make_unique<std::vector<Jet>>();
222 auto genJetsOut = std::make_unique<reco::GenJetCollection>();
223 auto caloTowersOut = std::make_unique<std::vector<CaloTower>>();
224 auto pfCandidatesOut = std::make_unique<reco::PFCandidateCollection>();
225 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
236 unsigned int idx = itJet - jets->begin();
245 if ( ajet.isCaloJet()) cj = dynamic_cast<const reco::CaloJet *>(jetRef.
get());
252 for ( std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(), towEnd = itowers.end(), itow = towBegin; itow != towEnd; ++itow ) {
253 if( itow->isAvailable() && itow->isNonnull() ){
254 caloTowersOut->push_back( **itow );
257 edm::Ptr<CaloTower> caloForwardRef ( h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter() );
264 ajet.setCaloTowers( itowersRef );
272 for ( std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
273 partEnd = iparticles.end(), ipart = partBegin;
274 ipart != partEnd; ++ipart ) {
275 pfCandidatesOut->push_back( **ipart );
284 ajet.setPFCandidates( iparticlesRef );
293 ajet.addJECFactors(jcf);
295 std::vector<std::string>
levels = jetCorrs[0][jetRef].correctionLabels();
296 if(
std::find(levels.begin(), levels.end(),
"L2L3Residual")!=levels.end()){
297 ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L2L3Residual"));
299 else if(
std::find(levels.begin(), levels.end(),
"L3Absolute")!=levels.end()){
300 ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L3Absolute"));
303 ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel(
"Uncorrected"));
305 edm::LogWarning(
"L3Absolute not found") <<
"L2L3Residual and L3Absolute are not part of the jetCorrFactors\n" 306 <<
"of module " << jetCorrs[0][jetRef].jecSet() <<
". Jets will remain" 335 genJetsOut->push_back( *genjet );
342 ajet.setGenJetRef(genjetFwdRef );
362 for (
size_t k=0;
k<jetDiscriminators.size(); ++
k) {
363 float value = (*jetDiscriminators[
k])[jetRef];
368 for (
size_t k=0;
k<jetTagInfos.size(); ++
k) {
373 if ((idx < taginfos.
size()) && (taginfos[idx].
jet() == jetRef)) {
374 match = taginfos.
ptrAt(idx);
378 if (itTI->jet() == jetRef) { match = taginfos.
ptrAt( itTI - taginfos.
begin() );
break; }
382 tagInfosOut->push_back( match->
clone() );
397 if (
addJetCharge_) ajet.setJetCharge( (*hJetChargeAss)[jetRef] );
402 ajet.setJetID( jetId );
405 else if (
addJetID_ && ajet.isJPTJet() ){
408 ajet.setJetID( jetId );
424 iEvent.
put(
std::move(pfCandidatesOut),
"pfCandidates" );
bool enabled() const
'true' if this there is at least one efficiency configured
value_type const * get() const
pat::helper::EfficiencyLoader efficiencyLoader_
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > tagInfoTokens_
edm::EDGetTokenT< reco::JetTracksAssociation::Container > trackAssociationToken_
Jets made from CaloTowers.
virtual BaseTagInfo * clone(void) const
clone
std::vector< std::string > tagInfoLabels_
std::vector< edm::EDGetTokenT< edm::ValueMap< JetCorrFactors > > > jetCorrFactorsTokens_
bool addAssociatedTracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Ptr< value_type > ptrAt(size_type i) const
pat::helper::KinResolutionsLoader resolutionLoader_
std::vector< GenJet > GenJetCollection
collection of GenJet objects
std::vector< std::string > discriminatorLabels_
const edm::RefToBase< reco::Jet > & getCaloJetRef() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfoToken_
Jets made from PFObjects.
GreaterByPt< Jet > pTComparator_
bool enabled() const
'true' if this there is at least one efficiency configured
edm::EDGetTokenT< reco::JetFloatAssociation::Container > jetChargeToken_
Container::value_type value_type
const_iterator begin() const
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
Jets made from CaloJets corrected for ZSP and tracks.
Class for the storage of jet correction factors.
edm::EDGetTokenT< reco::JetIDValueMap > jetIDMapToken_
genJetMatch
switch on/off embedding of matched genJet's
RefProd< PROD > getRefBeforePut()
bool isNonnull() const
Checks for non-null.
pat::PATUserDataHelper< pat::Jet > userDataHelper_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::EDGetTokenT< reco::JetFlavourMatchingCollection > jetPartonMapToken_
bool useLegacyJetMCFlavour_
std::vector< edm::FwdPtr< CaloTower > > CaloTowerFwdPtrCollection
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetToken_
std::vector< edm::EDGetTokenT< reco::JetFloatAssociation::Container > > discriminatorTokens_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genPartonToken_
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
const_iterator end() const
bool embedGenPartonMatch_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.