51 produces<pat::MHTCollection>();
58 while (!physobjvector_.empty()) {
59 physobjvector_.erase(physobjvector_.begin(), physobjvector_.end());
63 s_clusteredTowers.clear();
65 double number_of_jets = getJets(
iEvent, iSetup);
67 double number_of_electrons = getElectrons(
iEvent, iSetup);
69 double number_of_muons = getMuons(
iEvent, iSetup);
72 std::cout <<
">>>---> Number of jets: " << number_of_jets << std::endl;
73 std::cout <<
">>>---> Number of electrons: " << number_of_jets << std::endl;
74 std::cout <<
">>>---> Number of muons: " << number_of_muons << std::endl;
83 auto themetsigcoll = std::make_unique<pat::MHTCollection>();
85 if (!physobjvector_.empty()) {
93 met_x = met_et *
cos(met_phi);
94 met_y = met_et *
sin(met_phi);
107 themetsigcoll->push_back(themetsigobj);
120 double number_of_jets_ = 0.0;
123 iEvent.getByToken(jetToken_, jetHandle);
128 if ((jet_iter->pt() < jetPtMin_) || (
TMath::Abs(jet_iter->eta()) > jetEtaMax_) ||
129 (jet_iter->emEnergyFraction() > jetEMfracMax_))
132 double jet_et = jet_iter->et();
133 double jet_phi = jet_iter->phi();
135 if (verbose_ == 3.) {
136 std::cout <<
"jet pt : " << jet_iter->pt() <<
" eta : " << jet_iter->eta()
137 <<
" EMF: " << jet_iter->emEnergyFraction() << std::endl;
140 double sigma_et, sigma_phi;
142 if (controlledUncertainty_) {
143 sigma_et = jetUncertainty.etUncertainty->Eval(jet_et);
144 sigma_phi = jetUncertainty.phiUncertainty->Eval(jet_et);
150 if (verbose_ == 3.) {
151 std::cout <<
"jet sigma_et : " << sigma_et <<
", jet sigma_phi : " << sigma_phi << std::endl;
154 if (sigma_et <= 0 || sigma_phi <= 0)
155 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
","
156 << sigma_phi <<
" (et,phi): " << jet_et <<
"," << jet_phi;
160 if (uncertaintyScaleFactor_ != 1.0) {
161 sigma_et = sigma_et * uncertaintyScaleFactor_;
162 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
167 if (verbose_ == 101.) {
169 std::cout <<
"v101> " << number_of_jets_ <<
" " << jet_et <<
" " << sigma_et <<
" " << jet_phi <<
" "
170 << sigma_phi << std::endl;
174 physobjvector_.push_back(tmp_jet);
178 std::vector<CaloTowerPtr> v_towers = jet_iter->getCaloConstituents();
181 for (
unsigned int ii = 0;
ii < v_towers.size();
ii++) {
182 s_clusteredTowers.insert((*v_towers.at(
ii)).
id());
187 if (verbose_ == 101.) {
188 std::cout <<
"v101> --------------------------------------------" << std::endl;
191 return number_of_jets_;
200 double number_of_electrons_ = 0.0;
207 iEvent.getByToken(eleToken_, electronHandle);
214 if (electron_iter->et() < elePtMin_ ||
TMath::Abs(electron_iter->eta()) > eleEtaMax_)
217 if (verbose_ == 3.) {
218 std::cout <<
"electron pt = " << electron_iter->pt() <<
" eta : " << electron_iter->eta() << std::endl;
221 double electron_et = electron_iter->et();
222 double electron_phi = electron_iter->phi();
224 double sigma_et, sigma_phi;
226 if (controlledUncertainty_) {
227 sigma_et = eleUncertainty.etUncertainty->Eval(electron_et);
228 sigma_phi = eleUncertainty.phiUncertainty->Eval(electron_et);
234 if (verbose_ == 3.) {
235 std::cout <<
"electron sigma_et : " << sigma_et <<
", electron sigma_phi : " << sigma_phi << std::endl;
238 if (sigma_et < 0 || sigma_phi < 0)
239 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
","
240 << sigma_phi <<
" (et,phi): " << electron_et <<
"," << electron_phi;
242 if (uncertaintyScaleFactor_ != 1.0) {
243 sigma_et = sigma_et * uncertaintyScaleFactor_;
244 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
247 metsig::SigInputObj tmp_electron(objectname, electron_et, electron_phi, sigma_et, sigma_phi);
248 physobjvector_.push_back(tmp_electron);
249 number_of_electrons_++;
274 return number_of_electrons_;
284 iEvent.getByToken(muoToken_, muonHandle);
288 std::cout <<
">>> PATMHTSelector not valid muon Handle!" << std::endl;
292 double number_of_muons_ = 0.0;
295 if (muon_iter->pt() < muonPtMin_ ||
TMath::Abs(muon_iter->eta()) > muonEtaMax_)
298 if (verbose_ == 3.) {
299 std::cout <<
"muon pt = " << muon_iter->pt() <<
" eta : " << muon_iter->eta() << std::endl;
302 double muon_pt = muon_iter->pt();
303 double muon_phi = muon_iter->phi();
305 double sigma_et, sigma_phi;
307 if (controlledUncertainty_) {
308 sigma_et = muonUncertainty.etUncertainty->Eval(muon_pt);
309 sigma_phi = muonUncertainty.phiUncertainty->Eval(muon_pt);
315 if (verbose_ == 3.) {
316 std::cout <<
"muon sigma_et : " << sigma_et <<
", muon sigma_phi : " << sigma_phi << std::endl;
319 if (sigma_et < 0 || sigma_phi < 0)
320 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
","
321 << sigma_phi <<
" (pt,phi): " << muon_pt <<
"," << muon_phi;
323 if (uncertaintyScaleFactor_ != 1.0) {
324 sigma_et = sigma_et * uncertaintyScaleFactor_;
325 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
329 physobjvector_.push_back(tmp_muon);
334 return number_of_muons_;
345 ecalEBUncertainty.etUncertainty =
346 std::make_unique<TF1>(
"ecalEBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
347 ecalEBUncertainty.etUncertainty->SetParameter(0, 0.2);
348 ecalEBUncertainty.etUncertainty->SetParameter(1, 0.03);
349 ecalEBUncertainty.etUncertainty->SetParameter(2, 0.005);
351 ecalEBUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalEBphiFunc",
"[0]*x", 1);
352 ecalEBUncertainty.phiUncertainty->SetParameter(0, 0.0174);
355 ecalEEUncertainty.etUncertainty =
356 std::make_unique<TF1>(
"ecalEEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
357 ecalEEUncertainty.etUncertainty->SetParameter(0, 0.2);
358 ecalEEUncertainty.etUncertainty->SetParameter(1, 0.03);
359 ecalEEUncertainty.etUncertainty->SetParameter(2, 0.005);
361 ecalEEUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalEEphiFunc",
"[0]*x", 1);
362 ecalEEUncertainty.phiUncertainty->SetParameter(0, 0.087);
367 hcalHBUncertainty.etUncertainty =
368 std::make_unique<TF1>(
"hcalHBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
369 hcalHBUncertainty.etUncertainty->SetParameter(0, 0.);
370 hcalHBUncertainty.etUncertainty->SetParameter(1, 1.22);
371 hcalHBUncertainty.etUncertainty->SetParameter(2, 0.05);
373 hcalHBUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHBphiFunc",
"[0]*x", 1);
374 hcalHBUncertainty.phiUncertainty->SetParameter(0, 0.087);
377 hcalHEUncertainty.etUncertainty =
378 std::make_unique<TF1>(
"hcalHEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
379 hcalHEUncertainty.etUncertainty->SetParameter(0, 0.);
380 hcalHEUncertainty.etUncertainty->SetParameter(1, 1.3);
381 hcalHEUncertainty.etUncertainty->SetParameter(2, 0.05);
383 hcalHEUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHEphiFunc",
"[0]*x", 1);
384 hcalHEUncertainty.phiUncertainty->SetParameter(0, 0.087);
387 hcalHOUncertainty.etUncertainty =
388 std::make_unique<TF1>(
"hcalHOEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
389 hcalHOUncertainty.etUncertainty->SetParameter(0, 0.);
390 hcalHOUncertainty.etUncertainty->SetParameter(1, 1.82);
391 hcalHOUncertainty.etUncertainty->SetParameter(2, 0.09);
393 hcalHOUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHOphiFunc",
"[0]*x", 1);
394 hcalHOUncertainty.phiUncertainty->SetParameter(0, 0.087);
397 hcalHFUncertainty.etUncertainty =
398 std::make_unique<TF1>(
"hcalHFEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
399 hcalHFUncertainty.etUncertainty->SetParameter(0, 0.);
400 hcalHFUncertainty.etUncertainty->SetParameter(1, 1.82);
401 hcalHFUncertainty.etUncertainty->SetParameter(2, 0.09);
403 hcalHFUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHFphiFunc",
"[0]*x", 1);
404 hcalHFUncertainty.phiUncertainty->SetParameter(0, 0.174);
407 jetUncertainty.etUncertainty = std::make_unique<TF1>(
"jetEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
409 jetUncertainty.etUncertainty->SetParameter(0, jetEtUncertaintyParameter0_);
410 jetUncertainty.etUncertainty->SetParameter(1, jetEtUncertaintyParameter1_);
411 jetUncertainty.etUncertainty->SetParameter(2, jetEtUncertaintyParameter2_);
419 jetUncertainty.phiUncertainty =
420 std::make_unique<TF1>(
"jetPhiFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
421 jetUncertainty.phiUncertainty->SetParameter(0, jetPhiUncertaintyParameter0_);
422 jetUncertainty.phiUncertainty->SetParameter(1, jetPhiUncertaintyParameter1_);
423 jetUncertainty.phiUncertainty->SetParameter(2, jetPhiUncertaintyParameter2_);
437 eleUncertainty.etUncertainty = std::make_unique<TF1>(
"eleEtFunc",
"[0] * x", 1);
439 eleUncertainty.etUncertainty->SetParameter(0, eleEtUncertaintyParameter0_);
441 eleUncertainty.phiUncertainty = std::make_unique<TF1>(
"elePhiFunc",
"[0] * x", 1);
443 eleUncertainty.phiUncertainty->SetParameter(0, elePhiUncertaintyParameter0_);
448 muonUncertainty.etUncertainty = std::make_unique<TF1>(
"muonEtFunc",
"[0] * x", 1);
450 muonUncertainty.etUncertainty->SetParameter(0, muonEtUncertaintyParameter0_);
451 muonUncertainty.phiUncertainty = std::make_unique<TF1>(
"muonPhiFunc",
"[0] * x", 1);
453 muonUncertainty.phiUncertainty->SetParameter(0, muonPhiUncertaintyParameter0_);