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
CaloJetMETcorrInputProducerT< T, Textractor > Class Template Reference

#include <CaloJetMETcorrInputProducerT.h>

Inheritance diagram for CaloJetMETcorrInputProducerT< T, Textractor >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CaloJetMETcorrInputProducerT (const edm::ParameterSet &cfg)
 
 ~CaloJetMETcorrInputProducerT ()
 
- 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 &evt, const edm::EventSetup &es)
 

Private Attributes

double jetCorrEtaMax_
 
Textractor jetCorrExtractor_
 
std::string jetCorrLabel_
 
edm::EDGetTokenT< edm::View
< reco::MET > > 
metToken_
 
std::string moduleLabel_
 
std::string offsetCorrLabel_
 
bool skipEM_
 
double skipEMfractionThreshold_
 
edm::InputTag srcMET_
 
edm::EDGetTokenT< std::vector
< T > > 
token_
 
double type1JetPtThreshold_
 

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

template<typename T, typename Textractor>
class CaloJetMETcorrInputProducerT< T, Textractor >

Definition at line 59 of file CaloJetMETcorrInputProducerT.h.

Constructor & Destructor Documentation

template<typename T , typename Textractor >
CaloJetMETcorrInputProducerT< T, Textractor >::CaloJetMETcorrInputProducerT ( const edm::ParameterSet cfg)
inlineexplicit

Definition at line 63 of file CaloJetMETcorrInputProducerT.h.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrEtaMax_, CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrLabel_, CaloJetMETcorrInputProducerT< T, Textractor >::metToken_, CaloJetMETcorrInputProducerT< T, Textractor >::offsetCorrLabel_, CaloJetMETcorrInputProducerT< T, Textractor >::skipEM_, CaloJetMETcorrInputProducerT< T, Textractor >::skipEMfractionThreshold_, CaloJetMETcorrInputProducerT< T, Textractor >::srcMET_, AlCaHLTBitMon_QueryRunRegistry::string, CaloJetMETcorrInputProducerT< T, Textractor >::token_, and CaloJetMETcorrInputProducerT< T, Textractor >::type1JetPtThreshold_.

64  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
65  {
66  token_ = consumes<std::vector<T> >(cfg.getParameter<edm::InputTag>("src"));
67 
68  offsetCorrLabel_ = ( cfg.exists("offsetCorrLabel") ) ?
69  cfg.getParameter<std::string>("offsetCorrLabel") : "";
70  jetCorrLabel_ = cfg.getParameter<std::string>("jetCorrLabel");
71 
72  jetCorrEtaMax_ = ( cfg.exists("jetCorrEtaMax") ) ?
73  cfg.getParameter<double>("jetCorrEtaMax") : 9.9;
74 
75  type1JetPtThreshold_ = cfg.getParameter<double>("type1JetPtThreshold");
76 
77  skipEM_ = cfg.getParameter<bool>("skipEM");
78  if ( skipEM_ ) {
79  skipEMfractionThreshold_ = cfg.getParameter<double>("skipEMfractionThreshold");
80  }
81 
82  if(cfg.exists("srcMET"))
83  {
84  srcMET_ = cfg.getParameter<edm::InputTag>("srcMET");
85  metToken_ = consumes<edm::View<reco::MET> >(cfg.getParameter<edm::InputTag>("srcMET"));
86  }
87 
88  produces<CorrMETData>("type1");
89  produces<CorrMETData>("type2");
90  produces<CorrMETData>("offset");
91  }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< std::vector< T > > token_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
template<typename T , typename Textractor >
CaloJetMETcorrInputProducerT< T, Textractor >::~CaloJetMETcorrInputProducerT ( )
inline

Definition at line 92 of file CaloJetMETcorrInputProducerT.h.

92 {}

Member Function Documentation

template<typename T , typename Textractor >
void CaloJetMETcorrInputProducerT< T, Textractor >::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlineprivatevirtual

Implements edm::EDProducer.

Definition at line 96 of file CaloJetMETcorrInputProducerT.h.

References edm::Event::getByToken(), CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrEtaMax_, CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrExtractor_, CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrLabel_, fwrapper::jets, edm::InputTag::label(), CaloMET_cfi::met, CaloJetMETcorrInputProducerT< T, Textractor >::metToken_, CaloJetMETcorrInputProducerT< T, Textractor >::offsetCorrLabel_, edm::Event::put(), CaloJetMETcorrInputProducerT< T, Textractor >::skipEM_, CaloJetMETcorrInputProducerT< T, Textractor >::skipEMfractionThreshold_, CaloJetMETcorrInputProducerT< T, Textractor >::srcMET_, CaloJetMETcorrInputProducerT< T, Textractor >::token_, and CaloJetMETcorrInputProducerT< T, Textractor >::type1JetPtThreshold_.

97  {
98  std::auto_ptr<CorrMETData> type1Correction(new CorrMETData());
99  std::auto_ptr<CorrMETData> unclEnergySum(new CorrMETData());
100  std::auto_ptr<CorrMETData> offsetEnergySum(new CorrMETData());
101 
102  typedef std::vector<T> JetCollection;
104  evt.getByToken(token_, jets);
105 
108  if ( srcMET_.label() != "" ) {
109  evt.getByToken(metToken_, met);
110  if ( met->size() != 1 )
111  throw cms::Exception("CaloJetMETcorrInputProducer::produce")
112  << "Failed to find unique MET in the event, src = " << srcMET_.label() << " !!\n";
113 
114 //--- compute "unclustered energy" by sutracting from the reconstructed MET
115 // (i.e. from the negative vectorial sum of all particles reconstructed in the event)
116 // the momenta of (high Pt) jets which enter Type 1 MET corrections
117 //
118 // NOTE: MET = -(jets + muons + "unclustered energy"),
119 // so "unclustered energy" = -(MET + jets + muons),
120 // i.e. (high Pt) jets enter the sum of "unclustered energy" with negative sign.
121 //
122  unclEnergySum->mex = -met->front().px();
123  unclEnergySum->mey = -met->front().py();
124  unclEnergySum->sumet = met->front().sumEt();
125  }
126 
127  int numJets = jets->size();
128  for ( int jetIndex = 0; jetIndex < numJets; ++jetIndex ) {
129  const T& rawJet = jets->at(jetIndex);
130 
132  checkInputType(rawJet);
133 
135  reco::Candidate::LorentzVector rawJetP4 = rawJetExtractor(rawJet);
136 
138 
139  if ( corrJetP4.pt() > type1JetPtThreshold_ ) {
140 
141  unclEnergySum->mex -= rawJetP4.px();
142  unclEnergySum->mey -= rawJetP4.py();
143  unclEnergySum->sumet -= rawJetP4.Et();
144 
145  if ( skipEM_ && rawJet.emEnergyFraction() > skipEMfractionThreshold_ ) continue;
146 
147  reco::Candidate::LorentzVector rawJetP4offsetCorr = rawJetP4;
148  if ( offsetCorrLabel_ != "" ) {
149  rawJetP4offsetCorr = jetCorrExtractor_(rawJet, offsetCorrLabel_, &evt, &es, jetCorrEtaMax_);
150 
151  offsetEnergySum->mex += (rawJetP4.px() - rawJetP4offsetCorr.px());
152  offsetEnergySum->mey += (rawJetP4.py() - rawJetP4offsetCorr.py());
153  offsetEnergySum->sumet += (rawJetP4.Et() - rawJetP4offsetCorr.Et());
154  }
155 
156 //--- MET balances momentum of reconstructed particles,
157 // hence correction to jets and corresponding Type 1 MET correction are of opposite sign
158  type1Correction->mex -= (corrJetP4.px() - rawJetP4offsetCorr.px());
159  type1Correction->mey -= (corrJetP4.py() - rawJetP4offsetCorr.py());
160  type1Correction->sumet += (corrJetP4.Et() - rawJetP4offsetCorr.Et());
161  }
162  }
163 
164 //--- add
165 // o Type 1 MET correction (difference corrected-uncorrected jet energy for jets of (corrected) Pt > 20 GeV)
166 // o momentum sum of "unclustered energy" (jets of (corrected) Pt < 20 GeV)
167 // o momentum sum of "offset energy" (sum of energy attributed to pile-up/underlying event)
168 // to the event
169  evt.put(type1Correction, "type1");
170  evt.put(unclEnergySum, "type2");
171  evt.put(offsetEnergySum, "offset");
172  }
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:4
std::vector< Jet > JetCollection
Definition: Jet.h:49
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
vector< PseudoJet > jets
edm::View< reco::MET > METView
edm::EDGetTokenT< std::vector< T > > token_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
std::string const & label() const
Definition: InputTag.h:42
a MET correction term
Definition: CorrMETData.h:14
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
long double T

Member Data Documentation

template<typename T , typename Textractor >
double CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrEtaMax_
private
template<typename T , typename Textractor >
Textractor CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrExtractor_
private
template<typename T , typename Textractor >
std::string CaloJetMETcorrInputProducerT< T, Textractor >::jetCorrLabel_
private
template<typename T , typename Textractor >
edm::EDGetTokenT<edm::View<reco::MET> > CaloJetMETcorrInputProducerT< T, Textractor >::metToken_
private
template<typename T , typename Textractor >
std::string CaloJetMETcorrInputProducerT< T, Textractor >::moduleLabel_
private
template<typename T , typename Textractor >
std::string CaloJetMETcorrInputProducerT< T, Textractor >::offsetCorrLabel_
private
template<typename T , typename Textractor >
bool CaloJetMETcorrInputProducerT< T, Textractor >::skipEM_
private
template<typename T , typename Textractor >
double CaloJetMETcorrInputProducerT< T, Textractor >::skipEMfractionThreshold_
private
template<typename T , typename Textractor >
edm::InputTag CaloJetMETcorrInputProducerT< T, Textractor >::srcMET_
private
template<typename T , typename Textractor >
edm::EDGetTokenT<std::vector<T> > CaloJetMETcorrInputProducerT< T, Textractor >::token_
private
template<typename T , typename Textractor >
double CaloJetMETcorrInputProducerT< T, Textractor >::type1JetPtThreshold_
private