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::ProductRegistryHelper

Public Member Functions

 ShiftedPFCandidateProducerForNoPileUpPFMEt (const edm::ParameterSet &)
 
 ~ShiftedPFCandidateProducerForNoPileUpPFMEt ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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::InputTag srcJets_
 
edm::InputTag srcPFCandidates_
 
double unclEnUncertainty_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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
Version
Revision:
1.1
Id:
ShiftedPFCandidateProducerForNoPileUpPFMEt.h,v 1.1 2012/08/31 10:06:13 veelken Exp

Definition at line 40 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.

Constructor & Destructor Documentation

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

Definition at line 14 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_, srcJets_, srcPFCandidates_, unclEnUncertainty_, and edm::FileInPath::Unknown.

15  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
16 {
17  srcPFCandidates_ = cfg.getParameter<edm::InputTag>("srcPFCandidates");
18  srcJets_ = cfg.getParameter<edm::InputTag>("srcJets");
19 
20  jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag");
21  if ( cfg.exists("jetCorrInputFileName") ) {
22  jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName");
23  if ( jetCorrInputFileName_.location() == edm::FileInPath::Unknown) throw cms::Exception("ShiftedJetProducerT")
24  << " Failed to find JEC parameter file = " << jetCorrInputFileName_ << " !!\n";
25  std::cout << "Reading JEC parameters = " << jetCorrUncertaintyTag_
26  << " from file = " << jetCorrInputFileName_.fullPath() << "." << std::endl;
29  } else {
30  std::cout << "Reading JEC parameters = " << jetCorrUncertaintyTag_
31  << " from DB/SQLlite file." << std::endl;
32  jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName");
33  }
34 
35  minJetPt_ = cfg.getParameter<double>("minJetPt");
36 
37  shiftBy_ = cfg.getParameter<double>("shiftBy");
38 
39  unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty");
40 
41  produces<reco::PFCandidateCollection>();
42 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
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:171
ShiftedPFCandidateProducerForNoPileUpPFMEt::~ShiftedPFCandidateProducerForNoPileUpPFMEt ( )

Definition at line 44 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

45 {
46 // nothing to be done yet...
47 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 49 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References deltaR(), alignCSCRings::e, reco::LeafCandidate::eta(), edm::EventSetup::get(), edm::Event::getByLabel(), 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_, srcJets_, srcPFCandidates_, and unclEnUncertainty_.

50 {
51  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
52  evt.getByLabel(srcPFCandidates_, originalPFCandidates);
53 
55  evt.getByLabel(srcJets_, jets);
56 
57  std::vector<const reco::PFJet*> selectedJets;
58  for ( reco::PFJetCollection::const_iterator jet = jets->begin();
59  jet != jets->end(); ++jet ) {
60  if ( jet->pt() > minJetPt_ ) selectedJets.push_back(&(*jet));
61  }
62 
63  if ( jetCorrPayloadName_ != "" ) {
65  es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet);
66  const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_];
67  delete jecUncertainty_;
68  jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters);
69  }
70 
71  std::auto_ptr<reco::PFCandidateCollection> shiftedPFCandidates(new reco::PFCandidateCollection);
72 
73  for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
74  originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
75 
76  const reco::PFJet* jet_matched = 0;
77  for ( std::vector<const reco::PFJet*>::iterator jet = selectedJets.begin();
78  jet != selectedJets.end(); ++jet ) {
79  std::vector<reco::PFCandidatePtr> jetConstituents = (*jet)->getPFConstituents();
80  for ( std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin();
81  jetConstituent != jetConstituents.end() && !jet_matched; ++jetConstituent ) {
82  if ( deltaR(originalPFCandidate->p4(), (*jetConstituent)->p4()) < 1.e-2 ) jet_matched = (*jet);
83  }
84  }
85 
86  double shift = 0.;
87  if ( jet_matched ) {
88  jecUncertainty_->setJetEta(jet_matched->eta());
89  jecUncertainty_->setJetPt(jet_matched->pt());
90 
91  shift = jecUncertainty_->getUncertainty(true);
92  } else {
93  shift = unclEnUncertainty_;
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(shiftedPFCandidates);
108 }
Jets made from PFObjects.
Definition: PFJet.h:22
virtual double eta() const
momentum pseudorapidity
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
virtual double pt() const
transverse momentum
const T & get() const
Definition: EventSetup.h:55
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:38
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
static unsigned int const shift
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:53
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::InputTag ShiftedPFCandidateProducerForNoPileUpPFMEt::srcJets_
private
edm::InputTag ShiftedPFCandidateProducerForNoPileUpPFMEt::srcPFCandidates_
private
double ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_
private