|
|
Go to the documentation of this file.
26 : useUserData_(iConfig.exists(
"userData")), printWarning_(iConfig.getParameter<
bool>(
"printWarning")) {
33 iConfig.
getParameter<std::vector<edm::InputTag>>(
"jetCorrFactorsSource"),
34 [
this](
edm::InputTag const&
tag) { return mayConsume<edm::ValueMap<JetCorrFactors>>(tag); });
40 return mayConsume<reco::JetFloatAssociation::Container>(
tag);
54 if ((
pos != std::string::npos) && (
pos !=
label.length() - 7)) {
57 if (!it->instance().empty()) {
70 if ((
pos != std::string::npos) && (
pos !=
label.length() - 8)) {
85 produces<std::vector<Jet>>();
86 produces<edm::OwnVector<reco::BaseTagInfo>>(
"tagInfos");
97 std::vector<edm::ValueMap<JetCorrFactors>> jetCorrs;
102 jetCorrs.push_back(*jetCorr);
107 std::vector<edm::Handle<reco::JetFloatAssociation::Container>> jetDiscriminators;
114 std::vector<edm::Handle<edm::View<reco::BaseTagInfo>>> jetTagInfos;
123 auto patJets = std::make_unique<std::vector<Jet>>();
125 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
132 unsigned int idx = itJet -
jets->begin();
149 std::vector<std::string>
levels = jetCorrs[0][jetRef].correctionLabels();
151 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L2L3Residual"));
153 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"L3Absolute"));
155 ajet.
initializeJEC(jetCorrs[0][jetRef].jecLevel(
"Uncorrected"));
158 <<
"L2L3Residual and L3Absolute are not part of the jetCorrFactors\n"
159 <<
"of module " << jetCorrs[0][jetRef].jecSet() <<
". Jets will remain"
169 for (
size_t k = 0;
k < jetDiscriminators.size(); ++
k) {
170 float value = (*jetDiscriminators[
k])[jetRef];
175 for (
size_t k = 0;
k < jetTagInfos.size(); ++
k) {
180 if ((
idx < taginfos.
size()) && (taginfos[
idx].
jet() == jetRef)) {
187 if (itTI->jet() == jetRef) {
193 if (
match.isNonnull()) {
194 tagInfosOut->push_back(
match->clone());
197 h_tagInfosOut.id(), &tagInfosOut->back(), tagInfosOut->size() - 1);
214 ajet.
refToOrig_ = patJetRef->originalObjectRef();
239 iDesc.
add<
bool>(
"sort",
true);
242 iDesc.
add<
bool>(
"addTagInfos",
true);
243 std::vector<edm::InputTag> emptyVInputTags;
244 iDesc.
add<std::vector<edm::InputTag>>(
"tagInfoSources", emptyVInputTags);
247 iDesc.
add<
bool>(
"addJetCorrFactors",
true);
248 iDesc.
add<std::vector<edm::InputTag>>(
"jetCorrFactorsSource", emptyVInputTags);
251 iDesc.
add<
bool>(
"addBTagInfo",
true);
252 iDesc.
add<
bool>(
"addDiscriminators",
true);
253 iDesc.
add<std::vector<edm::InputTag>>(
"discriminatorSources", emptyVInputTags);
256 iDesc.
add<
bool>(
"printWarning",
true);
263 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)
Log< level::Warning, false > LogWarning
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_
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)
T getParameter(std::string const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const_iterator end() const
Ptr< value_type > ptrAt(size_type i) const
~PATJetUpdater() override