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 Types | Private Member Functions | Private Attributes
ShiftedPFCandidateProducerForPFMEtMVA Class Reference

#include <ShiftedPFCandidateProducerForPFMEtMVA.h>

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

Classes

struct  objectEntryType
 

Public Member Functions

 ShiftedPFCandidateProducerForPFMEtMVA (const edm::ParameterSet &)
 
 ~ShiftedPFCandidateProducerForPFMEtMVA ()
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef edm::View
< reco::Candidate
CandidateView
 

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::EDGetTokenT
< reco::PFCandidateCollection
srcPFCandidatesToken_
 
edm::EDGetTokenT< CandidateViewsrcShiftedObjectsToken_
 
edm::EDGetTokenT< CandidateViewsrcUnshiftedObjectsToken_
 

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

Definition at line 33 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Member Typedef Documentation

Definition at line 41 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file ShiftedPFCandidateProducerForPFMEtMVA.cc.

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

6  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
7  , srcPFCandidatesToken_(consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates")))
8  , srcUnshiftedObjectsToken_(consumes<CandidateView>(cfg.getParameter<edm::InputTag>("srcUnshiftedObjects")))
9  , srcShiftedObjectsToken_(consumes<CandidateView>(cfg.getParameter<edm::InputTag>("srcShiftedObjects")))
10 {
11  dRmatch_PFCandidate_ = cfg.getParameter<double>("dRmatch_PFCandidate");
12  dRmatch_Object_ = cfg.exists("dRmatch_Object") ?
13  cfg.getParameter<double>("dRmatch_Object") : 0.1;
14 
15  produces<reco::PFCandidateCollection>();
16 }
T getParameter(std::string const &) const
edm::EDGetTokenT< CandidateView > srcUnshiftedObjectsToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
ShiftedPFCandidateProducerForPFMEtMVA::~ShiftedPFCandidateProducerForPFMEtMVA ( )

Definition at line 18 of file ShiftedPFCandidateProducerForPFMEtMVA.cc.

19 {
20 // nothing to be done yet...
21 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 23 of file ShiftedPFCandidateProducerForPFMEtMVA.cc.

References deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, dRmatch_Object_, dRmatch_PFCandidate_, edm::Event::getByToken(), dbtoconf::object, objects_, edm::Event::put(), reco::LeafCandidate::setP4(), edm::shift, srcPFCandidatesToken_, srcShiftedObjectsToken_, and srcUnshiftedObjectsToken_.

24 {
25  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
26  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
27 
28  edm::Handle<CandidateView> unshiftedObjects;
29  evt.getByToken(srcUnshiftedObjectsToken_, unshiftedObjects);
30 
31  edm::Handle<CandidateView> shiftedObjects;
32  evt.getByToken(srcShiftedObjectsToken_, shiftedObjects);
33 
34  objects_.clear();
35 
36  for ( CandidateView::const_iterator unshiftedObject = unshiftedObjects->begin();
37  unshiftedObject != unshiftedObjects->end(); ++unshiftedObject ) {
38  bool isMatched_Object = false;
39  double dRbestMatch_Object = 1.e+3;
40  reco::Candidate::LorentzVector shiftedObjectP4_matched;
41  for ( CandidateView::const_iterator shiftedObject = shiftedObjects->begin();
42  shiftedObject != shiftedObjects->end(); ++shiftedObject ) {
43  double dR = deltaR(unshiftedObject->p4(), shiftedObject->p4());
44  if ( dR < dRmatch_Object_ && dR < dRbestMatch_Object ) {
45  shiftedObjectP4_matched = shiftedObject->p4();
46  isMatched_Object = true;
47  dRbestMatch_Object = dR;
48  }
49  }
50  if ( isMatched_Object ) {
51  objects_.push_back(objectEntryType(shiftedObjectP4_matched, unshiftedObject->p4(), dRbestMatch_Object));
52  }
53  }
54 
55  std::auto_ptr<reco::PFCandidateCollection> shiftedPFCandidates(new reco::PFCandidateCollection);
56 
57  for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
58  originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
59 
60  double shift = 0.;
61  bool applyShift = false;
62  double dRbestMatch_PFCandidate = 1.e+3;
63  for ( std::vector<objectEntryType>::const_iterator object = objects_.begin();
64  object != objects_.end(); ++object ) {
65  if ( !object->isValidMatch_ ) continue;
66  double dR = deltaR(originalPFCandidate->p4(), object->unshiftedObjectP4_);
67  if ( dR < dRmatch_PFCandidate_ && dR < dRbestMatch_PFCandidate ) {
68  shift = object->shift_;
69  applyShift = true;
70  dRbestMatch_PFCandidate = dR;
71  }
72  }
73 
74  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
75  if ( applyShift ) shiftedPFCandidateP4 *= (1. + shift);
76 
77  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
78  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
79 
80  shiftedPFCandidates->push_back(shiftedPFCandidate);
81  }
82 
83  evt.put(shiftedPFCandidates);
84 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< CandidateView > srcUnshiftedObjectsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
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:41
list object
Definition: dbtoconf.py:77
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
static unsigned int const shift
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_

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 76 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Referenced by produce().

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

Definition at line 47 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Referenced by produce().

edm::EDGetTokenT<CandidateView> ShiftedPFCandidateProducerForPFMEtMVA::srcShiftedObjectsToken_
private

Definition at line 49 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Referenced by produce().

edm::EDGetTokenT<CandidateView> ShiftedPFCandidateProducerForPFMEtMVA::srcUnshiftedObjectsToken_
private

Definition at line 48 of file ShiftedPFCandidateProducerForPFMEtMVA.h.

Referenced by produce().