|
|
Go to the documentation of this file.
26 : useUserData_(iConfig.exists(
"userData")), printWarning_(iConfig.getParameter<
bool>(
"printWarning")) {
32 iConfig.
getParameter<std::vector<edm::InputTag>>(
"jetCorrFactorsSource"),
33 [
this](
edm::InputTag const&
tag) { return mayConsume<edm::ValueMap<JetCorrFactors>>(tag); });
39 return mayConsume<reco::JetFloatAssociation::Container>(
tag);
53 if ((
pos != std::string::npos) && (
pos !=
label.length() - 7)) {
56 if (!it->instance().empty()) {
69 if ((
pos != std::string::npos) && (
pos !=
label.length() - 8)) {
84 produces<std::vector<Jet>>();
85 produces<edm::OwnVector<reco::BaseTagInfo>>(
"tagInfos");
96 std::vector<edm::ValueMap<JetCorrFactors>> jetCorrs;
101 jetCorrs.push_back(*jetCorr);
106 std::vector<edm::Handle<reco::JetFloatAssociation::Container>> jetDiscriminators;
113 std::vector<edm::Handle<edm::View<reco::BaseTagInfo>>> jetTagInfos;
122 auto patJets = std::make_unique<std::vector<Jet>>();
124 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
131 unsigned int idx = itJet -
jets->begin();
148 std::vector<std::string>
levels = jetCorrs[0][jetRef].correctionLabels();
150 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L2L3Residual"));
152 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L3Absolute"));
154 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"Uncorrected"));
157 <<
"L2L3Residual and L3Absolute are not part of the jetCorrFactors\n"
158 <<
"of module " << jetCorrs[0][jetRef].jecSet() <<
". Jets will remain"
168 for (
size_t k = 0;
k < jetDiscriminators.size(); ++
k) {
169 float value = (*jetDiscriminators[
k])[jetRef];
174 for (
size_t k = 0;
k < jetTagInfos.size(); ++
k) {
179 if ((
idx < taginfos.
size()) && (taginfos[
idx].
jet() == jetRef)) {
186 if (itTI->jet() == jetRef) {
192 if (
match.isNonnull()) {
193 tagInfosOut->push_back(
match->clone());
196 h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1);
213 ajet.
refToOrig_ = patJetRef->originalObjectRef();
236 iDesc.
add<
bool>(
"addTagInfos",
true);
237 std::vector<edm::InputTag> emptyVInputTags;
238 iDesc.
add<std::vector<edm::InputTag>>(
"tagInfoSources", emptyVInputTags);
241 iDesc.
add<
bool>(
"addJetCorrFactors",
true);
242 iDesc.
add<std::vector<edm::InputTag>>(
"jetCorrFactorsSource", emptyVInputTags);
245 iDesc.
add<
bool>(
"addBTagInfo",
true);
246 iDesc.
add<
bool>(
"addDiscriminators",
true);
247 iDesc.
add<std::vector<edm::InputTag>>(
"discriminatorSources", emptyVInputTags);
250 iDesc.
add<
bool>(
"printWarning",
true);
257 descriptions.
add(
"PATJetUpdater", iDesc);
void addBDiscriminatorPair(const std::pair< std::string, float > &thePair)
method to add a algolabel-discriminator pair
const_iterator begin() const
Assists in assimilating all pat::UserData into pat objects.
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)
std::vector< edm::EDGetTokenT< edm::View< reco::BaseTagInfo > > > tagInfoTokens_
std::vector< std::string > discriminatorLabels_
static void fillDescription(edm::ParameterSetDescription &iDesc)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< edm::EDGetTokenT< reco::JetFloatAssociation::Container > > discriminatorTokens_
std::vector< pat::JetCorrFactors > jec_
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)
GreaterByPt< Jet > pTComparator_
Class for the storage of jet correction factors.
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::Ptr< reco::Candidate > refToOrig_
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
void addJECFactors(const JetCorrFactors &jec)
add more sets of energy correction factors
PATJetUpdater(const edm::ParameterSet &iConfig)
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 setComment(std::string const &value)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< edm::EDGetTokenT< edm::ValueMap< JetCorrFactors > > > jetCorrFactorsTokens_
const LorentzVector correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
Container::value_type value_type
std::vector< std::string > tagInfoLabels_
std::vector< edm::InputTag > discriminatorTags_
pat::PATUserDataHelper< pat::Jet > userDataHelper_
T getParameter(std::string const &) const
void setP4(const LorentzVector &p4) final
set 4-momentum
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
std::vector< edm::InputTag > tagInfoTags_
void addTagInfo(const std::string &label, const TagInfoFwdPtrCollection::value_type &info)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator end() const
Ptr< value_type > ptrAt(size_type i) const
~PATJetUpdater() override