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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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_
 
std::string moduleLabel_
 
std::string offsetCorrLabel_
 
bool skipEM_
 
double skipEMfractionThreshold_
 
edm::InputTag src_
 
edm::InputTag srcMET_
 
double type1JetPtThreshold_
 

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
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 60 of file CaloJetMETcorrInputProducerT.h.

Constructor & Destructor Documentation

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

Definition at line 64 of file CaloJetMETcorrInputProducerT.h.

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

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

Definition at line 91 of file CaloJetMETcorrInputProducerT.h.

91 {}

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 95 of file CaloJetMETcorrInputProducerT.h.

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

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