CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ShiftedPFCandidateProducerForNoPileUpPFMEt Class Reference

#include <ShiftedPFCandidateProducerForNoPileUpPFMEt.h>

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

Public Member Functions

 ShiftedPFCandidateProducerForNoPileUpPFMEt (const edm::ParameterSet &)
 
 ~ShiftedPFCandidateProducerForNoPileUpPFMEt ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

JetCorrectionUncertaintyjecUncertainty_
 
edm::FileInPath jetCorrInputFileName_
 
JetCorrectorParametersjetCorrParameters_
 
std::string jetCorrPayloadName_
 
std::string jetCorrUncertaintyTag_
 
double minJetPt_
 
std::string moduleLabel_
 
double shiftBy_
 
edm::EDGetTokenT
< reco::PFJetCollection
srcJetsToken_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
srcPFCandidatesToken_
 
double unclEnUncertainty_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, 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/NoPileUpPFMETProducer.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 ShiftedPFCandidateProducerForNoPileUpPFMEt.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References gather_cfg::cout, edm::ParameterSet::exists(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), jecUncertainty_, jetCorrInputFileName_, jetCorrParameters_, jetCorrPayloadName_, jetCorrUncertaintyTag_, edm::FileInPath::location(), minJetPt_, shiftBy_, AlCaHLTBitMon_QueryRunRegistry::string, unclEnUncertainty_, and edm::FileInPath::Unknown.

10  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
11  , srcPFCandidatesToken_(consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates")))
12  , srcJetsToken_(consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets")))
13 {
14 
15  jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag");
16  if ( cfg.exists("jetCorrInputFileName") ) {
17  jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName");
18  if ( jetCorrInputFileName_.location() == edm::FileInPath::Unknown) throw cms::Exception("ShiftedJetProducerT")
19  << " Failed to find JEC parameter file = " << jetCorrInputFileName_ << " !!\n";
20  std::cout << "Reading JEC parameters = " << jetCorrUncertaintyTag_
21  << " from file = " << jetCorrInputFileName_.fullPath() << "." << std::endl;
24  } else {
25  std::cout << "Reading JEC parameters = " << jetCorrUncertaintyTag_
26  << " from DB/SQLlite file." << std::endl;
27  jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName");
28  }
29 
30  minJetPt_ = cfg.getParameter<double>("minJetPt");
31 
32  shiftBy_ = cfg.getParameter<double>("shiftBy");
33 
34  unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty");
35 
36  produces<reco::PFCandidateCollection>();
37 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:159
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:165
ShiftedPFCandidateProducerForNoPileUpPFMEt::~ShiftedPFCandidateProducerForNoPileUpPFMEt ( )

Definition at line 39 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

40 {
41 // nothing to be done yet...
42 }

Member Function Documentation

void ShiftedPFCandidateProducerForNoPileUpPFMEt::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 44 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References deltaR(), alignCSCRings::e, reco::LeafCandidate::eta(), edm::EventSetup::get(), edm::Event::getByToken(), reco::PFJet::getPFConstituents(), JetCorrectionUncertainty::getUncertainty(), jecUncertainty_, metsig::jet, jetCorrPayloadName_, jetCorrUncertaintyTag_, fwrapper::jets, minJetPt_, reco::LeafCandidate::pt(), edm::Event::put(), JetCorrectionUncertainty::setJetEta(), JetCorrectionUncertainty::setJetPt(), reco::LeafCandidate::setP4(), edm::shift, shiftBy_, srcJetsToken_, srcPFCandidatesToken_, and unclEnUncertainty_.

45 {
46  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
47  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
48 
50  evt.getByToken(srcJetsToken_, jets);
51 
52  std::vector<const reco::PFJet*> selectedJets;
53  for ( reco::PFJetCollection::const_iterator jet = jets->begin();
54  jet != jets->end(); ++jet ) {
55  if ( jet->pt() > minJetPt_ ) selectedJets.push_back(&(*jet));
56  }
57 
58  if ( jetCorrPayloadName_ != "" ) {
60  es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet);
61  const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_];
62  delete jecUncertainty_;
63  jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters);
64  }
65 
66  std::auto_ptr<reco::PFCandidateCollection> shiftedPFCandidates(new reco::PFCandidateCollection);
67 
68  for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
69  originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
70 
71  const reco::PFJet* jet_matched = 0;
72  for ( std::vector<const reco::PFJet*>::iterator jet = selectedJets.begin();
73  jet != selectedJets.end(); ++jet ) {
74  std::vector<reco::PFCandidatePtr> jetConstituents = (*jet)->getPFConstituents();
75  for ( std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin();
76  jetConstituent != jetConstituents.end() && !jet_matched; ++jetConstituent ) {
77  if ( deltaR(originalPFCandidate->p4(), (*jetConstituent)->p4()) < 1.e-2 ) jet_matched = (*jet);
78  }
79  }
80 
81  double shift = 0.;
82  if ( jet_matched ) {
83  jecUncertainty_->setJetEta(jet_matched->eta());
84  jecUncertainty_->setJetPt(jet_matched->pt());
85 
86  shift = jecUncertainty_->getUncertainty(true);
87  } else {
88  shift = unclEnUncertainty_;
89  }
90 
91  shift *= shiftBy_;
92 
93  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
94  shiftedPFCandidateP4 *= (1. + shift);
95 
96  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
97  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
98 
99  shiftedPFCandidates->push_back(shiftedPFCandidate);
100  }
101 
102  evt.put(shiftedPFCandidates);
103 }
virtual float pt() const
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
Jets made from PFObjects.
Definition: PFJet.h:21
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual float eta() const
momentum pseudorapidity
vector< PseudoJet > jets
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
const T & get() const
Definition: EventSetup.h:55
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
static unsigned int const shift
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:52
float getUncertainty(bool fDirection)

Member Data Documentation

JetCorrectionUncertainty* ShiftedPFCandidateProducerForNoPileUpPFMEt::jecUncertainty_
private
edm::FileInPath ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrInputFileName_
private
JetCorrectorParameters* ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrParameters_
private
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadName_
private
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrUncertaintyTag_
private
double ShiftedPFCandidateProducerForNoPileUpPFMEt::minJetPt_
private
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::moduleLabel_
private
double ShiftedPFCandidateProducerForNoPileUpPFMEt::shiftBy_
private
edm::EDGetTokenT<reco::PFJetCollection> ShiftedPFCandidateProducerForNoPileUpPFMEt::srcJetsToken_
private

Definition at line 56 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.

Referenced by produce().

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

Definition at line 55 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.

Referenced by produce().

double ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_
private