CMS 3D CMS Logo

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

#include <ShiftedPFCandidateProducerForPFMEtMVA.h>

Inheritance diagram for ShiftedPFCandidateProducerForPFMEtMVA:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

struct  objectEntryType
 

Public Member Functions

 ShiftedPFCandidateProducerForPFMEtMVA (const edm::ParameterSet &)
 
 ~ShiftedPFCandidateProducerForPFMEtMVA ()
 
- 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

double dRmatch_Object_
 
double dRmatch_PFCandidate_
 
std::string moduleLabel_
 
std::vector< objectEntryTypeobjects_
 
edm::InputTag srcPFCandidates_
 
edm::InputTag srcShiftedObjects_
 
edm::InputTag srcUnshiftedObjects_
 

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 coinciding in eta-phi with selected electrons/muons/tau-jets/jets by electron/muon/tau-jet/jet energy uncertainty.

NOTE: Auxiliary class specific to estimating systematic uncertainty on PFMET reconstructed by MVA-based algorithm (implemented in RecoMET/METProducers/src/PFMETProducerMVA.cc)

Author
Christian Veelken, LLR
Version
Revision:
1.1
Id:
ShiftedPFCandidateProducerForPFMEtMVA.h,v 1.1 2012/08/31 10:06:14 veelken Exp

Definition at line 32 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file ShiftedPFCandidateProducerForPFMEtMVA.cc.

References dRmatch_Object_, dRmatch_PFCandidate_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), srcPFCandidates_, srcShiftedObjects_, and srcUnshiftedObjects_.

10  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
11 {
12  srcPFCandidates_ = cfg.getParameter<edm::InputTag>("srcPFCandidates");
13  srcUnshiftedObjects_ = cfg.getParameter<edm::InputTag>("srcUnshiftedObjects");
14  srcShiftedObjects_ = cfg.getParameter<edm::InputTag>("srcShiftedObjects");
15 
16  dRmatch_PFCandidate_ = cfg.getParameter<double>("dRmatch_PFCandidate");
17  dRmatch_Object_ = cfg.exists("dRmatch_Object") ?
18  cfg.getParameter<double>("dRmatch_Object") : 0.1;
19 
20  produces<reco::PFCandidateCollection>();
21 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
ShiftedPFCandidateProducerForPFMEtMVA::~ShiftedPFCandidateProducerForPFMEtMVA ( )

Definition at line 23 of file ShiftedPFCandidateProducerForPFMEtMVA.cc.

24 {
25 // nothing to be done yet...
26 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 28 of file ShiftedPFCandidateProducerForPFMEtMVA.cc.

References deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, dRmatch_Object_, dRmatch_PFCandidate_, edm::Event::getByLabel(), dbtoconf::object, objects_, edm::Event::put(), reco::LeafCandidate::setP4(), edm::shift, srcPFCandidates_, srcShiftedObjects_, and srcUnshiftedObjects_.

29 {
30  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
31  evt.getByLabel(srcPFCandidates_, originalPFCandidates);
32 
34 
35  edm::Handle<CandidateView> unshiftedObjects;
36  evt.getByLabel(srcUnshiftedObjects_, unshiftedObjects);
37 
38  edm::Handle<CandidateView> shiftedObjects;
39  evt.getByLabel(srcShiftedObjects_, shiftedObjects);
40 
41  objects_.clear();
42 
43  for ( CandidateView::const_iterator unshiftedObject = unshiftedObjects->begin();
44  unshiftedObject != unshiftedObjects->end(); ++unshiftedObject ) {
45  bool isMatched_Object = false;
46  double dRbestMatch_Object = 1.e+3;
47  reco::Candidate::LorentzVector shiftedObjectP4_matched;
48  for ( CandidateView::const_iterator shiftedObject = shiftedObjects->begin();
49  shiftedObject != shiftedObjects->end(); ++shiftedObject ) {
50  double dR = deltaR(unshiftedObject->p4(), shiftedObject->p4());
51  if ( dR < dRmatch_Object_ && dR < dRbestMatch_Object ) {
52  shiftedObjectP4_matched = shiftedObject->p4();
53  isMatched_Object = true;
54  dRbestMatch_Object = dR;
55  }
56  }
57  if ( isMatched_Object ) {
58  objects_.push_back(objectEntryType(shiftedObjectP4_matched, unshiftedObject->p4(), dRbestMatch_Object));
59  }
60  }
61 
62  std::auto_ptr<reco::PFCandidateCollection> shiftedPFCandidates(new reco::PFCandidateCollection);
63 
64  for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
65  originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
66 
67  double shift = 0.;
68  bool applyShift = false;
69  double dRbestMatch_PFCandidate = 1.e+3;
70  for ( std::vector<objectEntryType>::const_iterator object = objects_.begin();
71  object != objects_.end(); ++object ) {
72  if ( !object->isValidMatch_ ) continue;
73  double dR = deltaR(originalPFCandidate->p4(), object->unshiftedObjectP4_);
74  if ( dR < dRmatch_PFCandidate_ && dR < dRbestMatch_PFCandidate ) {
75  shift = object->shift_;
76  applyShift = true;
77  dRbestMatch_PFCandidate = dR;
78  }
79  }
80 
81  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
82  if ( applyShift ) shiftedPFCandidateP4 *= (1. + shift);
83 
84  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
85  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
86 
87  shiftedPFCandidates->push_back(shiftedPFCandidate);
88  }
89 
90  evt.put(shiftedPFCandidates);
91 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
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
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:38
list object
Definition: dbtoconf.py:77
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
static unsigned int const shift
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23

Member Data Documentation

double ShiftedPFCandidateProducerForPFMEtMVA::dRmatch_Object_
private
double ShiftedPFCandidateProducerForPFMEtMVA::dRmatch_PFCandidate_
private
std::string ShiftedPFCandidateProducerForPFMEtMVA::moduleLabel_
private
std::vector<objectEntryType> ShiftedPFCandidateProducerForPFMEtMVA::objects_
private

Definition at line 74 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Referenced by produce().

edm::InputTag ShiftedPFCandidateProducerForPFMEtMVA::srcPFCandidates_
private
edm::InputTag ShiftedPFCandidateProducerForPFMEtMVA::srcShiftedObjects_
private
edm::InputTag ShiftedPFCandidateProducerForPFMEtMVA::srcUnshiftedObjects_
private