1 #ifndef JetMETCorrections_Type1MET_CaloJetMETcorrInputProducer_h
2 #define JetMETCorrections_Type1MET_CaloJetMETcorrInputProducer_h
36 namespace CaloJetMETcorrInputProducer_namespace
59 template <
typename T,
typename Textractor>
65 :
moduleLabel_(cfg.getParameter<std::string>(
"@module_label"))
83 if ( cfg.
exists(
"srcMET") ) {
87 produces<CorrMETData>(
"type1");
88 produces<CorrMETData>(
"type2");
89 produces<CorrMETData>(
"offset");
97 std::auto_ptr<CorrMETData> type1Correction(
new CorrMETData());
98 std::auto_ptr<CorrMETData> unclEnergySum(
new CorrMETData());
99 std::auto_ptr<CorrMETData> offsetEnergySum(
new CorrMETData());
109 if ( met->size() != 1 )
111 <<
"Failed to find unique MET in the event, src = " <<
srcMET_.
label() <<
" !!\n";
121 unclEnergySum->mex = -met->front().px();
122 unclEnergySum->mey = -met->front().py();
123 unclEnergySum->sumet = met->front().sumEt();
126 int numJets = jets->size();
127 for (
int jetIndex = 0; jetIndex < numJets; ++jetIndex ) {
128 const T& rawJet = jets->at(jetIndex);
131 checkInputType(rawJet);
140 unclEnergySum->mex -= rawJetP4.px();
141 unclEnergySum->mey -= rawJetP4.py();
142 unclEnergySum->sumet -= rawJetP4.Et();
150 offsetEnergySum->mex += (rawJetP4.px() - rawJetP4offsetCorr.px());
151 offsetEnergySum->mey += (rawJetP4.py() - rawJetP4offsetCorr.py());
152 offsetEnergySum->sumet += (rawJetP4.Et() - rawJetP4offsetCorr.Et());
157 type1Correction->mex -= (corrJetP4.px() - rawJetP4offsetCorr.px());
158 type1Correction->mey -= (corrJetP4.py() - rawJetP4offsetCorr.py());
159 type1Correction->sumet += (corrJetP4.Et() - rawJetP4offsetCorr.Et());
168 evt.
put(type1Correction,
"type1");
169 evt.
put(unclEnergySum,
"type2");
170 evt.
put(offsetEnergySum,
"offset");
T getParameter(std::string const &) const
std::vector< Jet > JetCollection
bool exists(std::string const ¶meterName) const
checks if a parameter exists
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.