CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ShiftedPFCandidateProducerForPFNoPUMEt Class Reference

#include <ShiftedPFCandidateProducerForPFNoPUMEt.h>

Inheritance diagram for ShiftedPFCandidateProducerForPFNoPUMEt:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ShiftedPFCandidateProducerForPFNoPUMEt (const edm::ParameterSet &)
 
 ~ShiftedPFCandidateProducerForPFNoPUMEt () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

JetCorrectionUncertaintyjecUncertainty_
 
bool jecValidFileName_
 
edm::FileInPath jetCorrInputFileName_
 
JetCorrectorParametersjetCorrParameters_
 
std::string jetCorrPayloadName_
 
std::string jetCorrUncertaintyTag_
 
double minJetPt_
 
std::string moduleLabel_
 
double shiftBy_
 
edm::EDGetTokenT< reco::PFJetCollectionsrcJetsToken_
 
edm::EDGetTokenT< reco::PFCandidateCollectionsrcPFCandidatesToken_
 
double unclEnUncertainty_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Vary energy of PFCandidates which are (are not) within jets of Pt > 10 GeV by jet energy uncertainty (by 10% "unclustered" energy uncertainty)

NOTE: Auxiliary class specific to estimating systematic uncertainty on PFMET reconstructed by no-PU MET reconstruction algorithm (implemented in JetMETCorrections/Type1MET/src/PFNoPUMETProducer.cc)

In case all PFCandidates not within jets of Pt > 30 GeV would be varied by the 10% "unclustered" energy uncertainty, the systematic uncertainty on the reconstructed no-PU MET would be overestimated significantly !!

Author
Christian Veelken, LLR

Definition at line 42 of file ShiftedPFCandidateProducerForPFNoPUMEt.h.

Constructor & Destructor Documentation

◆ ShiftedPFCandidateProducerForPFNoPUMEt()

ShiftedPFCandidateProducerForPFNoPUMEt::ShiftedPFCandidateProducerForPFNoPUMEt ( const edm::ParameterSet cfg)
explicit

Definition at line 10 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

11  : srcPFCandidatesToken_(consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates"))),
12  srcJetsToken_(consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets"))) {
13  jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag");
14 
15  jecValidFileName_ = cfg.exists("jetCorrInputFileName");
16  if (jecValidFileName_) {
17  jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName");
19  throw cms::Exception("ShiftedJetProducerT")
20  << " Failed to find JEC parameter file = " << jetCorrInputFileName_ << " !!\n";
21  edm::LogInfo("ShiftedPFCandidateProducerForPFNoPUMEt")
22  << "Reading JEC parameters = " << jetCorrUncertaintyTag_ << " from file = " << jetCorrInputFileName_.fullPath()
23  << "." << std::endl;
26  } else {
27  edm::LogInfo("ShiftedPFCandidateProducerForPFNoPUMEt")
28  << "Reading JEC parameters = " << jetCorrUncertaintyTag_ << " from DB/SQLlite file." << std::endl;
29  jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName");
30  }
31 
32  minJetPt_ = cfg.getParameter<double>("minJetPt");
33 
34  shiftBy_ = cfg.getParameter<double>("shiftBy");
35 
36  unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty");
37 
38  produces<reco::PFCandidateCollection>();
39 }

References looper::cfg, edm::FileInPath::fullPath(), jecUncertainty_, jecValidFileName_, jetCorrInputFileName_, jetCorrParameters_, jetCorrPayloadName_, jetCorrUncertaintyTag_, edm::FileInPath::location(), minJetPt_, shiftBy_, AlCaHLTBitMon_QueryRunRegistry::string, unclEnUncertainty_, and edm::FileInPath::Unknown.

◆ ~ShiftedPFCandidateProducerForPFNoPUMEt()

ShiftedPFCandidateProducerForPFNoPUMEt::~ShiftedPFCandidateProducerForPFNoPUMEt ( )
override

Definition at line 41 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

41  {
42  if (jecValidFileName_) {
43  delete jetCorrParameters_;
44  delete jecUncertainty_;
45  }
46 }

References jecUncertainty_, jecValidFileName_, and jetCorrParameters_.

Member Function Documentation

◆ produce()

void ShiftedPFCandidateProducerForPFNoPUMEt::produce ( edm::Event evt,
const edm::EventSetup es 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 48 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

48  {
49  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
50  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
51 
54 
55  std::vector<const reco::PFJet*> selectedJets;
56  for (reco::PFJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); ++jet) {
57  if (jet->pt() > minJetPt_)
58  selectedJets.push_back(&(*jet));
59  }
60 
61  if (!jetCorrPayloadName_.empty()) {
63  es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet);
64  const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_];
65  delete jecUncertainty_;
66  jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters);
67  }
68 
69  auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
70 
71  for (reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
72  originalPFCandidate != originalPFCandidates->end();
73  ++originalPFCandidate) {
74  const reco::PFJet* jet_matched = nullptr;
75  for (auto jet : selectedJets) {
76  for (auto jetc : jet->getPFConstituents()) {
77  if (deltaR2(originalPFCandidate->p4(), jetc->p4()) < dR2Match) {
78  jet_matched = jet;
79  break;
80  }
81  }
82  if (jet_matched)
83  break;
84  }
85 
86  double shift = 0.;
87  if (jet_matched != nullptr) {
88  jecUncertainty_->setJetEta(jet_matched->eta());
89  jecUncertainty_->setJetPt(jet_matched->pt());
90 
92  } else {
94  }
95 
96  shift *= shiftBy_;
97 
98  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
99  shiftedPFCandidateP4 *= (1. + shift);
100 
101  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
102  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
103 
104  shiftedPFCandidates->push_back(shiftedPFCandidate);
105  }
106 
107  evt.put(std::move(shiftedPFCandidates));
108 }

References HLTMuonOfflineAnalyzer_cfi::deltaR2, dR2Match, reco::LeafCandidate::eta(), edm::EventSetup::get(), get, edm::Event::getByToken(), JetCorrectionUncertainty::getUncertainty(), jecUncertainty_, metsig::jet, jetCorrPayloadName_, jetCorrUncertaintyTag_, singleTopDQM_cfi::jets, minJetPt_, eostools::move(), reco::LeafCandidate::pt(), edm::Event::put(), objectSelection_cff::selectedJets, JetCorrectionUncertainty::setJetEta(), JetCorrectionUncertainty::setJetPt(), reco::LeafCandidate::setP4(), edm::shift, shiftBy_, srcJetsToken_, srcPFCandidatesToken_, and unclEnUncertainty_.

Member Data Documentation

◆ jecUncertainty_

JetCorrectionUncertainty* ShiftedPFCandidateProducerForPFNoPUMEt::jecUncertainty_
private

◆ jecValidFileName_

bool ShiftedPFCandidateProducerForPFNoPUMEt::jecValidFileName_
private

◆ jetCorrInputFileName_

edm::FileInPath ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrInputFileName_
private

◆ jetCorrParameters_

JetCorrectorParameters* ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrParameters_
private

◆ jetCorrPayloadName_

std::string ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrPayloadName_
private

◆ jetCorrUncertaintyTag_

std::string ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrUncertaintyTag_
private

◆ minJetPt_

double ShiftedPFCandidateProducerForPFNoPUMEt::minJetPt_
private

◆ moduleLabel_

std::string ShiftedPFCandidateProducerForPFNoPUMEt::moduleLabel_
private

◆ shiftBy_

double ShiftedPFCandidateProducerForPFNoPUMEt::shiftBy_
private

◆ srcJetsToken_

edm::EDGetTokenT<reco::PFJetCollection> ShiftedPFCandidateProducerForPFNoPUMEt::srcJetsToken_
private

Definition at line 53 of file ShiftedPFCandidateProducerForPFNoPUMEt.h.

Referenced by produce().

◆ srcPFCandidatesToken_

edm::EDGetTokenT<reco::PFCandidateCollection> ShiftedPFCandidateProducerForPFNoPUMEt::srcPFCandidatesToken_
private

Definition at line 52 of file ShiftedPFCandidateProducerForPFNoPUMEt.h.

Referenced by produce().

◆ unclEnUncertainty_

double ShiftedPFCandidateProducerForPFNoPUMEt::unclEnUncertainty_
private
ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrInputFileName_
edm::FileInPath jetCorrInputFileName_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:55
edm::LogInfo
Definition: MessageLogger.h:254
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
ShiftedPFCandidateProducerForPFNoPUMEt::shiftBy_
double shiftBy_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:65
dR2Match
const double dR2Match
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:8
edm::Handle
Definition: AssociativeIterator.h:50
ShiftedPFCandidateProducerForPFNoPUMEt::jecUncertainty_
JetCorrectionUncertainty * jecUncertainty_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:59
JetCorrectionUncertainty::setJetEta
void setJetEta(float fEta)
Definition: JetCorrectionUncertainty.cc:204
edm::FileInPath
Definition: FileInPath.h:64
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle
Definition: DTSurvey.h:22
ShiftedPFCandidateProducerForPFNoPUMEt::srcPFCandidatesToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:52
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
JetCorrectionsRecord
Definition: JetCorrectionsRecord.h:11
JetCorrectionUncertainty::setJetPt
void setJetPt(float fPt)
Definition: JetCorrectionUncertainty.cc:209
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::FileInPath::location
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:161
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrParameters_
JetCorrectorParameters * jetCorrParameters_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:58
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
ShiftedPFCandidateProducerForPFNoPUMEt::unclEnUncertainty_
double unclEnUncertainty_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:67
ShiftedPFCandidateProducerForPFNoPUMEt::minJetPt_
double minJetPt_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:63
get
#define get
JetCorrectionUncertainty
Definition: JetCorrectionUncertainty.h:11
looper.cfg
cfg
Definition: looper.py:297
ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrUncertaintyTag_
std::string jetCorrUncertaintyTag_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:57
JetCorrectionUncertainty::getUncertainty
float getUncertainty(bool fDirection)
Definition: JetCorrectionUncertainty.cc:83
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::FileInPath::Unknown
Definition: FileInPath.h:66
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
metsig::jet
Definition: SignAlgoResolutions.h:47
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
JetCorrectorParameters
Definition: JetCorrectorParameters.h:25
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
objectSelection_cff.selectedJets
selectedJets
Definition: objectSelection_cff.py:99
cms::Exception
Definition: Exception.h:70
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrPayloadName_
std::string jetCorrPayloadName_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:56
edm::InputTag
Definition: InputTag.h:15
ShiftedPFCandidateProducerForPFNoPUMEt::srcJetsToken_
edm::EDGetTokenT< reco::PFJetCollection > srcJetsToken_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:53
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
ShiftedPFCandidateProducerForPFNoPUMEt::jecValidFileName_
bool jecValidFileName_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.h:61