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

Constructor & Destructor Documentation

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

Definition at line 62 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_.

63  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
64  {
65  token_ = consumes<std::vector<T> >(cfg.getParameter<edm::InputTag>("src"));
66 
67  offsetCorrLabel_ = ( cfg.exists("offsetCorrLabel") ) ?
68  cfg.getParameter<std::string>("offsetCorrLabel") : "";
69  jetCorrLabel_ = cfg.getParameter<std::string>("jetCorrLabel");
70 
71  jetCorrEtaMax_ = ( cfg.exists("jetCorrEtaMax") ) ?
72  cfg.getParameter<double>("jetCorrEtaMax") : 9.9;
73 
74  type1JetPtThreshold_ = cfg.getParameter<double>("type1JetPtThreshold");
75 
76  skipEM_ = cfg.getParameter<bool>("skipEM");
77  if ( skipEM_ ) {
78  skipEMfractionThreshold_ = cfg.getParameter<double>("skipEMfractionThreshold");
79  }
80 
81  if(cfg.exists("srcMET"))
82  {
83  srcMET_ = cfg.getParameter<edm::InputTag>("srcMET");
84  metToken_ = consumes<edm::View<reco::MET> >(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
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 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::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_.

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.getByToken(token_, jets);
104 
107  if ( srcMET_.label() != "" ) {
108  evt.getByToken(metToken_, 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  }
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:7
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