CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ShiftedPFCandidateProducerForPFNoPUMEt Class Reference
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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 40 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

Constructor & Destructor Documentation

◆ ShiftedPFCandidateProducerForPFNoPUMEt()

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

Definition at line 70 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

71  : srcPFCandidatesToken_(consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates"))),
72  srcJetsToken_(consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets"))) {
73  jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag");
74 
75  jecValidFileName_ = cfg.exists("jetCorrInputFileName");
76  if (jecValidFileName_) {
77  jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName");
79  throw cms::Exception("ShiftedJetProducerT")
80  << " Failed to find JEC parameter file = " << jetCorrInputFileName_ << " !!\n";
81  edm::LogInfo("ShiftedPFCandidateProducerForPFNoPUMEt")
82  << "Reading JEC parameters = " << jetCorrUncertaintyTag_ << " from file = " << jetCorrInputFileName_.fullPath()
83  << "." << std::endl;
86  } else {
87  edm::LogInfo("ShiftedPFCandidateProducerForPFNoPUMEt")
88  << "Reading JEC parameters = " << jetCorrUncertaintyTag_ << " from DB/SQLlite file." << std::endl;
89  jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName");
90  }
91 
92  minJetPt_ = cfg.getParameter<double>("minJetPt");
93 
94  shiftBy_ = cfg.getParameter<double>("shiftBy");
95 
96  unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty");
97 
98  produces<reco::PFCandidateCollection>();
99 }

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 101 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

101  {
102  if (jecValidFileName_) {
103  delete jetCorrParameters_;
104  delete jecUncertainty_;
105  }
106 }

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 108 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

108  {
109  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
110  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
111 
114 
115  std::vector<const reco::PFJet*> selectedJets;
116  for (reco::PFJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); ++jet) {
117  if (jet->pt() > minJetPt_)
118  selectedJets.push_back(&(*jet));
119  }
120 
121  if (!jetCorrPayloadName_.empty()) {
123  es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet);
124  const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_];
125  delete jecUncertainty_;
126  jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters);
127  }
128 
129  auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
130 
131  for (reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
132  originalPFCandidate != originalPFCandidates->end();
133  ++originalPFCandidate) {
134  const reco::PFJet* jet_matched = nullptr;
135  for (auto jet : selectedJets) {
136  for (const auto& jetc : jet->getPFConstituents()) {
137  if (deltaR2(originalPFCandidate->p4(), jetc->p4()) < dR2Match) {
138  jet_matched = jet;
139  break;
140  }
141  }
142  if (jet_matched)
143  break;
144  }
145 
146  double shift = 0.;
147  if (jet_matched != nullptr) {
148  jecUncertainty_->setJetEta(jet_matched->eta());
149  jecUncertainty_->setJetPt(jet_matched->pt());
150 
152  } else {
154  }
155 
156  shift *= shiftBy_;
157 
158  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
159  shiftedPFCandidateP4 *= (1. + shift);
160 
161  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
162  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
163 
164  shiftedPFCandidates->push_back(shiftedPFCandidate);
165  }
166 
167  evt.put(std::move(shiftedPFCandidates));
168 }

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 51 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

Referenced by produce().

◆ srcPFCandidatesToken_

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

Definition at line 50 of file ShiftedPFCandidateProducerForPFNoPUMEt.cc.

Referenced by produce().

◆ unclEnUncertainty_

double ShiftedPFCandidateProducerForPFNoPUMEt::unclEnUncertainty_
private
ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrInputFileName_
edm::FileInPath jetCorrInputFileName_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:53
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ShiftedPFCandidateProducerForPFNoPUMEt::shiftBy_
double shiftBy_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:63
dR2Match
const double dR2Match
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:68
edm::Handle
Definition: AssociativeIterator.h:50
ShiftedPFCandidateProducerForPFNoPUMEt::jecUncertainty_
JetCorrectionUncertainty * jecUncertainty_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:57
JetCorrectionUncertainty::setJetEta
void setJetEta(float fEta)
Definition: JetCorrectionUncertainty.cc:204
edm::FileInPath
Definition: FileInPath.h:61
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ESHandle
Definition: DTSurvey.h:22
ShiftedPFCandidateProducerForPFNoPUMEt::srcPFCandidatesToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:50
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
JetCorrectionsRecord
Definition: JetCorrectionsRecord.h:11
JetCorrectionUncertainty::setJetPt
void setJetPt(float fPt)
Definition: JetCorrectionUncertainty.cc:209
edm::FileInPath::location
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:159
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrParameters_
JetCorrectorParameters * jetCorrParameters_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:56
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ShiftedPFCandidateProducerForPFNoPUMEt::unclEnUncertainty_
double unclEnUncertainty_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:65
ShiftedPFCandidateProducerForPFNoPUMEt::minJetPt_
double minJetPt_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:61
get
#define get
JetCorrectionUncertainty
Definition: JetCorrectionUncertainty.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
ShiftedPFCandidateProducerForPFNoPUMEt::jetCorrUncertaintyTag_
std::string jetCorrUncertaintyTag_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:55
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:63
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:41
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.cc:54
edm::InputTag
Definition: InputTag.h:15
ShiftedPFCandidateProducerForPFNoPUMEt::srcJetsToken_
edm::EDGetTokenT< reco::PFJetCollection > srcJetsToken_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:51
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
ShiftedPFCandidateProducerForPFNoPUMEt::jecValidFileName_
bool jecValidFileName_
Definition: ShiftedPFCandidateProducerForPFNoPUMEt.cc:59