|
|
Go to the documentation of this file.
52 class JetFlavourIdentifier;
122 : useUserData_(iConfig.exists(
"userData")), printWarning_(
true) {
126 if (iConfig.
exists(
"embedCaloTowers")) {
154 iConfig.
getParameter<std::vector<edm::InputTag>>(
"jetCorrFactorsSource"),
155 [
this](
edm::InputTag const &
tag) { return consumes<edm::ValueMap<JetCorrFactors>>(tag); });
161 return mayConsume<reco::JetFloatAssociation::Container>(
tag);
197 if ((
pos != std::string::npos) && (
pos !=
label.length() - 7)) {
200 if (!it->instance().empty()) {
213 if ((
pos != std::string::npos) && (
pos !=
label.length() - 8)) {
228 produces<std::vector<Jet>>();
229 produces<reco::GenJetCollection>(
"genJets");
230 produces<std::vector<CaloTower>>(
"caloTowers");
231 produces<reco::PFCandidateCollection>(
"pfCandidates");
232 produces<edm::OwnVector<reco::BaseTagInfo>>(
"tagInfos");
239 if (
iEvent.isRealData()) {
280 std::vector<edm::ValueMap<JetCorrFactors>> jetCorrs;
285 jetCorrs.push_back(*jetCorr);
290 std::vector<edm::Handle<reco::JetFloatAssociation::Container>> jetDiscriminators;
297 std::vector<edm::Handle<edm::View<reco::BaseTagInfo>>> jetTagInfos;
319 auto patJets = std::make_unique<std::vector<Jet>>();
321 auto genJetsOut = std::make_unique<reco::GenJetCollection>();
322 auto caloTowersOut = std::make_unique<std::vector<CaloTower>>();
323 auto pfCandidatesOut = std::make_unique<reco::PFCandidateCollection>();
324 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
335 unsigned int idx = itJet -
jets->begin();
345 cj = dynamic_cast<const reco::CaloJet *>(jetRef.
get());
347 jptj = dynamic_cast<const reco::JPTJet *>(jetRef.
get());
352 for (std::vector<CaloTowerPtr>::const_iterator towBegin = itowers.begin(),
353 towEnd = itowers.end(),
357 if (itow->isAvailable() && itow->isNonnull()) {
358 caloTowersOut->push_back(**itow);
361 edm::Ptr<CaloTower> caloForwardRef(h_caloTowersOut.id(), caloTowerRef.key(), h_caloTowersOut.productGetter());
373 const reco::PFJet *cj = dynamic_cast<const reco::PFJet *>(jetRef.
get());
376 for (std::vector<reco::PFCandidatePtr>::const_iterator partBegin = iparticles.begin(),
377 partEnd = iparticles.end(),
381 pfCandidatesOut->push_back(**ipart);
385 h_pfCandidatesOut.id(), pfCollectionRef.key(), h_pfCandidatesOut.productGetter());
402 std::vector<std::string>
levels = jetCorrs[0][jetRef].correctionLabels();
404 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L2L3Residual"));
406 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L3Absolute"));
408 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"Uncorrected"));
411 <<
"L2L3Residual and L3Absolute are not part of the jetCorrFactors\n"
412 <<
"of module " << jetCorrs[0][jetRef].jecSet() <<
". Jets will remain"
441 genJetsOut->push_back(*genjet);
468 for (
size_t k = 0;
k < jetDiscriminators.size(); ++
k) {
469 float value = (*jetDiscriminators[
k])[jetRef];
474 for (
size_t k = 0;
k < jetTagInfos.size(); ++
k) {
479 if ((
idx < taginfos.
size()) && (taginfos[
idx].
jet() == jetRef)) {
486 if (itTI->jet() == jetRef) {
492 if (
match.isNonnull()) {
493 tagInfosOut->push_back(
match->clone());
496 h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1);
520 const reco::JPTJet *jptj = dynamic_cast<const reco::JPTJet *>(jetRef.get());
552 ->setComment(
"embed external CaloTowers (not to be used on AOD input)");
553 iDesc.
add<
bool>(
"embedPFCandidates",
true)->setComment(
"embed external PFCandidates");
556 iDesc.
add<
bool>(
"addGenPartonMatch",
true)->setComment(
"add MC matching");
557 iDesc.
add<
bool>(
"embedGenPartonMatch",
false)->setComment(
"embed MC matched MC information");
560 iDesc.
add<
bool>(
"addGenJetMatch",
true)->setComment(
"add MC matching");
561 iDesc.
add<
bool>(
"embedGenJetMatch",
false)->setComment(
"embed MC matched MC information");
564 iDesc.
add<
bool>(
"addJetCharge",
true);
568 iDesc.
add<
bool>(
"addJetID",
true)->setComment(
"Add jet ID information");
571 iDesc.
add<
bool>(
"addPartonJetMatch",
false);
575 iDesc.
add<
bool>(
"addAssociatedTracks",
true);
579 iDesc.
add<
bool>(
"addTagInfos",
true);
580 std::vector<edm::InputTag> emptyVInputTags;
581 iDesc.
add<std::vector<edm::InputTag>>(
"tagInfoSources", emptyVInputTags);
584 iDesc.
add<
bool>(
"addJetCorrFactors",
true);
585 iDesc.
add<std::vector<edm::InputTag>>(
"jetCorrFactorsSource", emptyVInputTags);
588 iDesc.
add<
bool>(
"addBTagInfo",
true);
589 iDesc.
add<
bool>(
"addDiscriminators",
true);
590 iDesc.
add<std::vector<edm::InputTag>>(
"discriminatorSources", emptyVInputTags);
593 iDesc.
add<
bool>(
"getJetMCFlavour",
true);
594 iDesc.
add<
bool>(
"useLegacyJetMCFlavour",
false);
595 iDesc.
add<
bool>(
"addJetFlavourInfo",
false);
604 iDesc.
add(
"efficiencies", efficienciesPSet);
605 iDesc.
add<
bool>(
"addEfficiencies",
false);
612 descriptions.
add(
"PATJetProducer", iDesc);
std::vector< edm::InputTag > discriminatorTags_
Jets made from CaloJets corrected for ZSP and tracks.
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
void addBDiscriminatorPair(const std::pair< std::string, float > &thePair)
method to add a algolabel-discriminator pair
Jets made from CaloTowers.
const_iterator begin() const
void initializeJEC(unsigned int level, const JetCorrFactors::Flavor &flavor=JetCorrFactors::NONE, unsigned int set=0)
initialize the jet to a given JEC level during creation starting from Uncorrected
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
PATJetProducer(const edm::ParameterSet &iConfig)
std::vector< GenJet > GenJetCollection
collection of GenJet objects
void setHadronFlavour(int hadronFl)
method to set the hadron-based flavour of the jet
void setJetID(reco::JetID const &id)
methods for jet ID
static void fillDescription(edm::ParameterSetDescription &iDesc)
void setPFCandidates(const PFCandidateFwdPtrCollection &pfCandidates)
method to store the PFCandidate constituents internally
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)
Log< level::Warning, false > LogWarning
pat::helper::EfficiencyLoader efficiencyLoader_
void setGenParton(const reco::GenParticleRef &gp, bool embed=false)
method to set the matched parton
bool enabled() const
'true' if this there is at least one efficiency configured
GreaterByPt< CaloTower > caloPTComparator_
void setPartonFlavour(int partonFl)
method to set the parton-based flavour of the jet
bool embedGenPartonMatch_
Class for the storage of jet correction factors.
std::vector< std::string > discriminatorLabels_
edm::EDGetTokenT< reco::JetFlavourMatchingCollection > jetPartonMapToken_
#define DEFINE_FWK_MODULE(type)
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
~PATJetProducer() override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void addJECFactors(const JetCorrFactors &jec)
add more sets of energy correction factors
std::vector< edm::InputTag > tagInfoTags_
void setCaloTowers(const CaloTowerFwdPtrCollection &caloTowers)
method to store the CaloJet constituents internally
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 >
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
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.
void setGenJetRef(const edm::FwdRef< reco::GenJetCollection > &gj)
method to set the matched generated jet reference, embedding if requested
edm::EDGetTokenT< edm::Association< reco::GenJetCollection > > genJetToken_
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
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_
bool isPFJet() const
check to see if the jet is a reco::PFJet
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.
void addTagInfo(const std::string &label, const TagInfoFwdPtrCollection::value_type &info)
pat::helper::KinResolutionsLoader resolutionLoader_
T getParameter(std::string const &) const
void setJetCharge(float jetCharge)
method to set the jet charge
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::vector< edm::EDGetTokenT< edm::ValueMap< JetCorrFactors > > > jetCorrFactorsTokens_
const_iterator end() const
void setJetFlavourInfo(const reco::JetFlavourInfo &jetFlavourInfo)
method to set the JetFlavourInfo of the jet
Ptr< value_type > ptrAt(size_type i) const
void setAssociatedTracks(const reco::TrackRefVector &tracks)
method to set the vector of refs to the tracks associated to this jet
edm::EDGetTokenT< reco::JetTracksAssociation::Container > trackAssociationToken_