|
|
Produces pat::Jet's.
More...
#include "PhysicsTools/PatAlgos/interface/PATJetProducer.h"
Produces pat::Jet's.
The PATJetProducer produces analysis-level pat::Jet's starting from a collection of objects of JetType.
- Author
- Steven Lowette, Jeremy Andrea
- Version
- Id
- PATJetProducer.h,v 1.26 2010/08/09 18:13:54 srappocc Exp
Definition at line 43 of file PATJetProducer.h.
◆ PATJetProducer()
Definition at line 40 of file PATJetProducer.cc.
45 if (iConfig.
exists(
"embedCaloTowers")) {
73 iConfig.
getParameter<std::vector<edm::InputTag>>(
"jetCorrFactorsSource"),
74 [
this](
edm::InputTag const &
tag) { return consumes<edm::ValueMap<JetCorrFactors>>(tag); });
80 return mayConsume<reco::JetFloatAssociation::Container>(
tag);
116 if ((
pos != std::string::npos) && (
pos !=
label.length() - 7)) {
119 if (!it->instance().empty()) {
132 if ((
pos != std::string::npos) && (
pos !=
label.length() - 8)) {
147 produces<std::vector<Jet>>();
148 produces<reco::GenJetCollection>(
"genJets");
149 produces<std::vector<CaloTower>>(
"caloTowers");
150 produces<reco::PFCandidateCollection>(
"pfCandidates");
151 produces<edm::OwnVector<reco::BaseTagInfo>>(
"tagInfos");
References addAssociatedTracks_, addBTagInfo_, addDiscriminators_, addEfficiencies_, addGenJetMatch_, addGenPartonMatch_, addJetCharge_, addJetCorrFactors_, addJetFlavourInfo_, addJetID_, addPartonJetMatch_, addResolutions_, addTagInfos_, discriminatorLabels_, discriminatorTags_, discriminatorTokens_, efficiencyLoader_, embedCaloTowers_, embedGenJetMatch_, embedGenPartonMatch_, embedPFCandidates_, edm::ParameterSet::exists(), funct::false, genJetToken_, genPartonToken_, getJetMCFlavour_, edm::ParameterSet::getParameter(), jetChargeToken_, jetCorrFactorsTokens_, jetFlavourInfoToken_, jetIDMapToken_, jetPartonMapToken_, jetsToken_, label, resolutionLoader_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, tagInfoLabels_, tagInfoTags_, tagInfoTokens_, trackAssociationToken_, useLegacyJetMCFlavour_, userDataHelper_, useUserData_, and edm::vector_transform().
◆ ~PATJetProducer()
PATJetProducer::~PATJetProducer |
( |
| ) |
|
|
override |
◆ fillDescriptions()
Definition at line 462 of file PATJetProducer.cc.
471 ->setComment(
"embed external CaloTowers (not to be used on AOD input)");
472 iDesc.
add<
bool>(
"embedPFCandidates",
true)->setComment(
"embed external PFCandidates");
475 iDesc.
add<
bool>(
"addGenPartonMatch",
true)->setComment(
"add MC matching");
476 iDesc.
add<
bool>(
"embedGenPartonMatch",
false)->setComment(
"embed MC matched MC information");
479 iDesc.
add<
bool>(
"addGenJetMatch",
true)->setComment(
"add MC matching");
480 iDesc.
add<
bool>(
"embedGenJetMatch",
false)->setComment(
"embed MC matched MC information");
483 iDesc.
add<
bool>(
"addJetCharge",
true);
487 iDesc.
add<
bool>(
"addJetID",
true)->setComment(
"Add jet ID information");
490 iDesc.
add<
bool>(
"addPartonJetMatch",
false);
494 iDesc.
add<
bool>(
"addAssociatedTracks",
true);
498 iDesc.
add<
bool>(
"addTagInfos",
true);
499 std::vector<edm::InputTag> emptyVInputTags;
500 iDesc.
add<std::vector<edm::InputTag>>(
"tagInfoSources", emptyVInputTags);
503 iDesc.
add<
bool>(
"addJetCorrFactors",
true);
504 iDesc.
add<std::vector<edm::InputTag>>(
"jetCorrFactorsSource", emptyVInputTags);
507 iDesc.
add<
bool>(
"addBTagInfo",
true);
508 iDesc.
add<
bool>(
"addDiscriminators",
true);
509 iDesc.
add<std::vector<edm::InputTag>>(
"discriminatorSources", emptyVInputTags);
512 iDesc.
add<
bool>(
"getJetMCFlavour",
true);
513 iDesc.
add<
bool>(
"useLegacyJetMCFlavour",
false);
514 iDesc.
add<
bool>(
"addJetFlavourInfo",
false);
523 iDesc.
add(
"efficiencies", efficienciesPSet);
524 iDesc.
add<
bool>(
"addEfficiencies",
false);
531 descriptions.
add(
"PATJetProducer", iDesc);
References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), pat::helper::KinResolutionsLoader::fillDescription(), pat::PATUserDataHelper< ObjectType >::fillDescription(), HLT_2018_cff::InputTag, edm::ParameterSetDescription::setAllowAnything(), and edm::ParameterSetDescription::setComment().
◆ produce()
Definition at line 156 of file PATJetProducer.cc.
158 if (
iEvent.isRealData()) {
199 std::vector<edm::ValueMap<JetCorrFactors>> jetCorrs;
204 jetCorrs.push_back(*jetCorr);
209 std::vector<edm::Handle<reco::JetFloatAssociation::Container>> jetDiscriminators;
216 std::vector<edm::Handle<edm::View<reco::BaseTagInfo>>> jetTagInfos;
238 auto patJets = std::make_unique<std::vector<Jet>>();
240 auto genJetsOut = std::make_unique<reco::GenJetCollection>();
241 auto caloTowersOut = std::make_unique<std::vector<CaloTower>>();
242 auto pfCandidatesOut = std::make_unique<reco::PFCandidateCollection>();
243 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
254 unsigned int idx = itJet -
jets->begin();
263 if (ajet.isCaloJet())
264 cj = dynamic_cast<const reco::CaloJet *>(jetRef.
get());
266 jptj = dynamic_cast<const reco::JPTJet *>(jetRef.
get());
271 for (std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(),
272 towEnd = itowers.end(),
276 if (itow->isAvailable() && itow->isNonnull()) {
277 caloTowersOut->push_back(**itow);
280 edm::Ptr<CaloTower> caloForwardRef(h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter());
287 ajet.setCaloTowers(itowersRef);
292 const reco::PFJet *cj = dynamic_cast<const reco::PFJet *>(jetRef.
get());
295 for (std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
296 partEnd = iparticles.end(),
300 pfCandidatesOut->push_back(**ipart);
304 h_pfCandidatesOut.id(), pfCollectionRef.key(), h_pfCandidatesOut.productGetter());
310 ajet.setPFCandidates(iparticlesRef);
319 ajet.addJECFactors(jcf);
321 std::vector<std::string>
levels = jetCorrs[0][jetRef].correctionLabels();
323 ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L2L3Residual"));
325 ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L3Absolute"));
327 ajet.initializeJEC(jetCorrs[0][jetRef].jecLevel(
"Uncorrected"));
330 <<
"L2L3Residual and L3Absolute are not part of the jetCorrFactors\n"
331 <<
"of module " << jetCorrs[0][jetRef].jecSet() <<
". Jets will remain"
360 genJetsOut->push_back(*genjet);
367 ajet.setGenJetRef(genjetFwdRef);
387 for (
size_t k = 0;
k < jetDiscriminators.size(); ++
k) {
388 float value = (*jetDiscriminators[
k])[jetRef];
393 for (
size_t k = 0;
k < jetTagInfos.size(); ++
k) {
398 if ((
idx < taginfos.
size()) && (taginfos[
idx].
jet() == jetRef)) {
405 if (itTI->jet() == jetRef) {
411 if (
match.isNonnull()) {
412 tagInfosOut->push_back(
match->clone());
415 h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1);
427 ajet.setAssociatedTracks((*hTrackAss)[jetRef]);
430 ajet.setJetCharge((*hJetChargeAss)[jetRef]);
435 ajet.setJetID(
jetId);
439 const reco::JPTJet *jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get());
441 ajet.setJetID(
jetId);
References pat::PATUserDataHelper< ObjectType >::add(), addAssociatedTracks_, pat::Jet::addBDiscriminatorPair(), addBTagInfo_, addDiscriminators_, addGenJetMatch_, addGenPartonMatch_, pat::Jet::addJECFactors(), addJetCharge_, addJetCorrFactors_, addJetFlavourInfo_, addJetID_, addPartonJetMatch_, pat::Jet::addTagInfo(), addTagInfos_, edm::View< T >::begin(), discriminatorLabels_, discriminatorTokens_, efficiencyLoader_, embedCaloTowers_, embedGenPartonMatch_, embedPFCandidates_, pat::helper::EfficiencyLoader::enabled(), pat::helper::KinResolutionsLoader::enabled(), edm::View< T >::end(), spr::find(), jetProducer_cfi::genJetMatch, genJetToken_, genPartonToken_, edm::RefToBase< T >::get(), reco::CaloJet::getCaloConstituents(), reco::JPTJet::getCaloJetRef(), getJetMCFlavour_, reco::PFJet::getPFConstituents(), mps_fire::i, training_settings::idx, iEvent, pat::Jet::initializeJEC(), edm::Ref< C, T, F >::isAvailable(), pat::Jet::isCaloJet(), pat::Jet::isJPTJet(), edm::Ref< C, T, F >::isNonnull(), pat::Jet::isPFJet(), metsig::jet, jetChargeToken_, jetCorrFactorsTokens_, jetFlavourInfoToken_, PhotonMonitor_cff::jetId, jetIDMapToken_, jetPartonMapToken_, singleTopDQM_cfi::jets, jetsToken_, dqmdumpme::k, jets_cff::levels, match(), eostools::move(), pat::helper::EfficiencyLoader::newEvent(), pat::helper::KinResolutionsLoader::newEvent(), hemisphereProducer_cfi::patJets, printWarning_, pTComparator_, edm::View< T >::ptrAt(), resolutionLoader_, pat::Jet::setAssociatedTracks(), pat::Jet::setCaloTowers(), pat::helper::EfficiencyLoader::setEfficiencies(), pat::Jet::setGenJetRef(), pat::Jet::setGenParton(), pat::Jet::setHadronFlavour(), pat::Jet::setJetCharge(), pat::Jet::setJetFlavourInfo(), pat::Jet::setJetID(), pat::Jet::setPartonFlavour(), pat::Jet::setPFCandidates(), pat::helper::KinResolutionsLoader::setResolutions(), edm::View< T >::size(), tagInfoLabels_, tagInfoTokens_, trackAssociationToken_, useLegacyJetMCFlavour_, userDataHelper_, and useUserData_.
◆ addAssociatedTracks_
bool pat::PATJetProducer::addAssociatedTracks_ |
|
private |
◆ addBTagInfo_
bool pat::PATJetProducer::addBTagInfo_ |
|
private |
◆ addDiscriminators_
bool pat::PATJetProducer::addDiscriminators_ |
|
private |
◆ addEfficiencies_
bool pat::PATJetProducer::addEfficiencies_ |
|
private |
◆ addGenJetMatch_
bool pat::PATJetProducer::addGenJetMatch_ |
|
private |
◆ addGenPartonMatch_
bool pat::PATJetProducer::addGenPartonMatch_ |
|
private |
◆ addJetCharge_
bool pat::PATJetProducer::addJetCharge_ |
|
private |
◆ addJetCorrFactors_
bool pat::PATJetProducer::addJetCorrFactors_ |
|
private |
◆ addJetFlavourInfo_
bool pat::PATJetProducer::addJetFlavourInfo_ |
|
private |
◆ addJetID_
bool pat::PATJetProducer::addJetID_ |
|
private |
◆ addPartonJetMatch_
bool pat::PATJetProducer::addPartonJetMatch_ |
|
private |
◆ addResolutions_
bool pat::PATJetProducer::addResolutions_ |
|
private |
◆ addTagInfos_
bool pat::PATJetProducer::addTagInfos_ |
|
private |
◆ caloPTComparator_
◆ discriminatorLabels_
std::vector<std::string> pat::PATJetProducer::discriminatorLabels_ |
|
private |
◆ discriminatorTags_
std::vector<edm::InputTag> pat::PATJetProducer::discriminatorTags_ |
|
private |
◆ discriminatorTokens_
◆ efficiencyLoader_
◆ embedCaloTowers_
bool pat::PATJetProducer::embedCaloTowers_ |
|
private |
◆ embedGenJetMatch_
bool pat::PATJetProducer::embedGenJetMatch_ |
|
private |
◆ embedGenPartonMatch_
bool pat::PATJetProducer::embedGenPartonMatch_ |
|
private |
◆ embedPFCandidates_
bool pat::PATJetProducer::embedPFCandidates_ |
|
private |
◆ genJetToken_
◆ genPartonToken_
◆ getJetMCFlavour_
bool pat::PATJetProducer::getJetMCFlavour_ |
|
private |
◆ jetChargeToken_
◆ jetCorrFactorsTokens_
◆ jetFlavourInfoToken_
◆ jetIDMapToken_
◆ jetPartonMapToken_
◆ jetsToken_
◆ printWarning_
bool pat::PATJetProducer::printWarning_ |
|
private |
◆ pTComparator_
◆ resolutionLoader_
◆ tagInfoLabels_
std::vector<std::string> pat::PATJetProducer::tagInfoLabels_ |
|
private |
◆ tagInfoTags_
◆ tagInfoTokens_
◆ trackAssociationToken_
◆ useLegacyJetMCFlavour_
bool pat::PATJetProducer::useLegacyJetMCFlavour_ |
|
private |
◆ userDataHelper_
◆ useUserData_
bool pat::PATJetProducer::useUserData_ |
|
private |
std::vector< edm::InputTag > discriminatorTags_
Jets made from CaloJets corrected for ZSP and tracks.
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
Jets made from CaloTowers.
const_iterator begin() const
Assists in assimilating all pat::UserData into pat objects.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genPartonToken_
edm::EDGetTokenT< reco::JetIDValueMap > jetIDMapToken_
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
std::vector< GenJet > GenJetCollection
collection of GenJet objects
static void fillDescription(edm::ParameterSetDescription &iDesc)
bool enabled() const
'true' if this there is at least one efficiency configured
std::vector< edm::EDGetTokenT< reco::JetFloatAssociation::Container > > discriminatorTokens_
std::vector< edm::FwdPtr< CaloTower > > CaloTowerFwdPtrCollection
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
pat::helper::EfficiencyLoader efficiencyLoader_
bool enabled() const
'true' if this there is at least one efficiency configured
bool embedGenPartonMatch_
Class for the storage of jet correction factors.
std::vector< std::string > discriminatorLabels_
edm::EDGetTokenT< reco::JetFlavourMatchingCollection > jetPartonMapToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
pat::PATUserDataHelper< pat::Jet > userDataHelper_
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
const edm::RefToBase< reco::Jet > & getCaloJetRef() const
std::vector< edm::InputTag > tagInfoTags_
value_type const * get() const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > tagInfoTokens_
void setComment(std::string const &value)
genJetMatch
switch on/off embedding of matched genJet's
std::vector< std::string > tagInfoLabels_
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfoToken_
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
bool isNonnull() const
Checks for non-null.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetToken_
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Container::value_type value_type
void setAllowAnything()
allow any parameter label/value pairs
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
edm::EDGetTokenT< reco::JetFloatAssociation::Container > jetChargeToken_
T getParameter(std::string const &) const
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
GreaterByPt< Jet > pTComparator_
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
bool useLegacyJetMCFlavour_
bool addAssociatedTracks_
Jets made from PFObjects.
pat::helper::KinResolutionsLoader resolutionLoader_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::vector< edm::EDGetTokenT< edm::ValueMap< JetCorrFactors > > > jetCorrFactorsTokens_
const_iterator end() const
Ptr< value_type > ptrAt(size_type i) const
edm::EDGetTokenT< reco::JetTracksAssociation::Container > trackAssociationToken_