197 produces<pat::MHTCollection>();
204 while (!physobjvector_.empty()) {
205 physobjvector_.erase(physobjvector_.begin(), physobjvector_.end());
209 s_clusteredTowers.clear();
211 double number_of_jets = getJets(iEvent, iSetup);
213 double number_of_electrons = getElectrons(iEvent, iSetup);
215 double number_of_muons = getMuons(iEvent, iSetup);
217 if (verbose_ == 1.) {
218 std::cout <<
">>>---> Number of jets: " << number_of_jets << std::endl;
219 std::cout <<
">>>---> Number of electrons: " << number_of_jets << std::endl;
220 std::cout <<
">>>---> Number of muons: " << number_of_muons << std::endl;
229 auto themetsigcoll = std::make_unique<pat::MHTCollection>();
231 if (!physobjvector_.empty()) {
237 double significance = signifAlgo.
significance(met_et, met_phi, met_set);
239 met_x = met_et *
cos(met_phi);
240 met_y = met_et *
sin(met_phi);
242 if (verbose_ == 1.) {
243 std::cout <<
">>>----> MHT Sgificance = " << significance << std::endl;
253 themetsigcoll->push_back(themetsigobj);
266 double number_of_jets_ = 0.0;
274 if ((jet_iter->pt() < jetPtMin_) || (TMath::Abs(jet_iter->eta()) > jetEtaMax_) ||
275 (jet_iter->emEnergyFraction() > jetEMfracMax_))
278 double jet_et = jet_iter->et();
279 double jet_phi = jet_iter->phi();
281 if (verbose_ == 3.) {
282 std::cout <<
"jet pt : " << jet_iter->pt() <<
" eta : " << jet_iter->eta()
283 <<
" EMF: " << jet_iter->emEnergyFraction() << std::endl;
286 double sigma_et, sigma_phi;
288 if (controlledUncertainty_) {
289 sigma_et = jetUncertainty.etUncertainty->Eval(jet_et);
290 sigma_phi = jetUncertainty.phiUncertainty->Eval(jet_et);
296 if (verbose_ == 3.) {
297 std::cout <<
"jet sigma_et : " << sigma_et <<
", jet sigma_phi : " << sigma_phi << std::endl;
300 if (sigma_et <= 0 || sigma_phi <= 0)
301 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
","
302 << sigma_phi <<
" (et,phi): " << jet_et <<
"," << jet_phi;
306 if (uncertaintyScaleFactor_ != 1.0) {
307 sigma_et = sigma_et * uncertaintyScaleFactor_;
308 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
313 if (verbose_ == 101.) {
315 std::cout <<
"v101> " << number_of_jets_ <<
" " << jet_et <<
" " << sigma_et <<
" " << jet_phi <<
" "
316 << sigma_phi << std::endl;
320 physobjvector_.push_back(tmp_jet);
324 std::vector<CaloTowerPtr> v_towers = jet_iter->getCaloConstituents();
327 for (
unsigned int ii = 0;
ii < v_towers.size();
ii++) {
328 s_clusteredTowers.insert((*v_towers.at(
ii)).
id());
333 if (verbose_ == 101.) {
334 std::cout <<
"v101> --------------------------------------------" << std::endl;
337 return number_of_jets_;
346 double number_of_electrons_ = 0.0;
360 if (electron_iter->et() < elePtMin_ || TMath::Abs(electron_iter->eta()) > eleEtaMax_)
363 if (verbose_ == 3.) {
364 std::cout <<
"electron pt = " << electron_iter->pt() <<
" eta : " << electron_iter->eta() << std::endl;
367 double electron_et = electron_iter->et();
368 double electron_phi = electron_iter->phi();
370 double sigma_et, sigma_phi;
372 if (controlledUncertainty_) {
373 sigma_et = eleUncertainty.etUncertainty->Eval(electron_et);
374 sigma_phi = eleUncertainty.phiUncertainty->Eval(electron_et);
380 if (verbose_ == 3.) {
381 std::cout <<
"electron sigma_et : " << sigma_et <<
", electron sigma_phi : " << sigma_phi << std::endl;
384 if (sigma_et < 0 || sigma_phi < 0)
385 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
","
386 << sigma_phi <<
" (et,phi): " << electron_et <<
"," << electron_phi;
388 if (uncertaintyScaleFactor_ != 1.0) {
389 sigma_et = sigma_et * uncertaintyScaleFactor_;
390 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
393 metsig::SigInputObj tmp_electron(objectname, electron_et, electron_phi, sigma_et, sigma_phi);
394 physobjvector_.push_back(tmp_electron);
395 number_of_electrons_++;
420 return number_of_electrons_;
434 std::cout <<
">>> PATMHTSelector not valid muon Handle!" << std::endl;
438 double number_of_muons_ = 0.0;
441 if (muon_iter->pt() < muonPtMin_ || TMath::Abs(muon_iter->eta()) > muonEtaMax_)
444 if (verbose_ == 3.) {
445 std::cout <<
"muon pt = " << muon_iter->pt() <<
" eta : " << muon_iter->eta() << std::endl;
448 double muon_pt = muon_iter->pt();
449 double muon_phi = muon_iter->phi();
451 double sigma_et, sigma_phi;
453 if (controlledUncertainty_) {
454 sigma_et = muonUncertainty.etUncertainty->Eval(muon_pt);
455 sigma_phi = muonUncertainty.phiUncertainty->Eval(muon_pt);
461 if (verbose_ == 3.) {
462 std::cout <<
"muon sigma_et : " << sigma_et <<
", muon sigma_phi : " << sigma_phi << std::endl;
465 if (sigma_et < 0 || sigma_phi < 0)
466 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
","
467 << sigma_phi <<
" (pt,phi): " << muon_pt <<
"," << muon_phi;
469 if (uncertaintyScaleFactor_ != 1.0) {
470 sigma_et = sigma_et * uncertaintyScaleFactor_;
471 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
475 physobjvector_.push_back(tmp_muon);
480 return number_of_muons_;
491 ecalEBUncertainty.etUncertainty =
492 std::make_unique<TF1>(
"ecalEBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
493 ecalEBUncertainty.etUncertainty->SetParameter(0, 0.2);
494 ecalEBUncertainty.etUncertainty->SetParameter(1, 0.03);
495 ecalEBUncertainty.etUncertainty->SetParameter(2, 0.005);
497 ecalEBUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalEBphiFunc",
"[0]*x", 1);
498 ecalEBUncertainty.phiUncertainty->SetParameter(0, 0.0174);
501 ecalEEUncertainty.etUncertainty =
502 std::make_unique<TF1>(
"ecalEEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
503 ecalEEUncertainty.etUncertainty->SetParameter(0, 0.2);
504 ecalEEUncertainty.etUncertainty->SetParameter(1, 0.03);
505 ecalEEUncertainty.etUncertainty->SetParameter(2, 0.005);
507 ecalEEUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalEEphiFunc",
"[0]*x", 1);
508 ecalEEUncertainty.phiUncertainty->SetParameter(0, 0.087);
513 hcalHBUncertainty.etUncertainty =
514 std::make_unique<TF1>(
"hcalHBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
515 hcalHBUncertainty.etUncertainty->SetParameter(0, 0.);
516 hcalHBUncertainty.etUncertainty->SetParameter(1, 1.22);
517 hcalHBUncertainty.etUncertainty->SetParameter(2, 0.05);
519 hcalHBUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHBphiFunc",
"[0]*x", 1);
520 hcalHBUncertainty.phiUncertainty->SetParameter(0, 0.087);
523 hcalHEUncertainty.etUncertainty =
524 std::make_unique<TF1>(
"hcalHEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
525 hcalHEUncertainty.etUncertainty->SetParameter(0, 0.);
526 hcalHEUncertainty.etUncertainty->SetParameter(1, 1.3);
527 hcalHEUncertainty.etUncertainty->SetParameter(2, 0.05);
529 hcalHEUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHEphiFunc",
"[0]*x", 1);
530 hcalHEUncertainty.phiUncertainty->SetParameter(0, 0.087);
533 hcalHOUncertainty.etUncertainty =
534 std::make_unique<TF1>(
"hcalHOEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
535 hcalHOUncertainty.etUncertainty->SetParameter(0, 0.);
536 hcalHOUncertainty.etUncertainty->SetParameter(1, 1.82);
537 hcalHOUncertainty.etUncertainty->SetParameter(2, 0.09);
539 hcalHOUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHOphiFunc",
"[0]*x", 1);
540 hcalHOUncertainty.phiUncertainty->SetParameter(0, 0.087);
543 hcalHFUncertainty.etUncertainty =
544 std::make_unique<TF1>(
"hcalHFEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
545 hcalHFUncertainty.etUncertainty->SetParameter(0, 0.);
546 hcalHFUncertainty.etUncertainty->SetParameter(1, 1.82);
547 hcalHFUncertainty.etUncertainty->SetParameter(2, 0.09);
549 hcalHFUncertainty.phiUncertainty = std::make_unique<TF1>(
"ecalHFphiFunc",
"[0]*x", 1);
550 hcalHFUncertainty.phiUncertainty->SetParameter(0, 0.174);
553 jetUncertainty.etUncertainty = std::make_unique<TF1>(
"jetEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
555 jetUncertainty.etUncertainty->SetParameter(0, jetEtUncertaintyParameter0_);
556 jetUncertainty.etUncertainty->SetParameter(1, jetEtUncertaintyParameter1_);
557 jetUncertainty.etUncertainty->SetParameter(2, jetEtUncertaintyParameter2_);
565 jetUncertainty.phiUncertainty =
566 std::make_unique<TF1>(
"jetPhiFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))", 3);
567 jetUncertainty.phiUncertainty->SetParameter(0, jetPhiUncertaintyParameter0_);
568 jetUncertainty.phiUncertainty->SetParameter(1, jetPhiUncertaintyParameter1_);
569 jetUncertainty.phiUncertainty->SetParameter(2, jetPhiUncertaintyParameter2_);
583 eleUncertainty.etUncertainty = std::make_unique<TF1>(
"eleEtFunc",
"[0] * x", 1);
585 eleUncertainty.etUncertainty->SetParameter(0, eleEtUncertaintyParameter0_);
587 eleUncertainty.phiUncertainty = std::make_unique<TF1>(
"elePhiFunc",
"[0] * x", 1);
589 eleUncertainty.phiUncertainty->SetParameter(0, elePhiUncertaintyParameter0_);
594 muonUncertainty.etUncertainty = std::make_unique<TF1>(
"muonEtFunc",
"[0] * x", 1);
596 muonUncertainty.etUncertainty->SetParameter(0, muonEtUncertaintyParameter0_);
597 muonUncertainty.phiUncertainty = std::make_unique<TF1>(
"muonPhiFunc",
"[0] * x", 1);
599 muonUncertainty.phiUncertainty->SetParameter(0, muonPhiUncertaintyParameter0_);
const void addObjects(const std::vector< metsig::SigInputObj > &EventVec)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< pat::Photon > > phoToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double eleEtUncertaintyParameter0_
uncertaintyFunctions hcalHEUncertainty
void setNumberOfMuons(const double &numberOfMuons)
edm::InputTag CorJetAlgorithmTag_
~PATMHTProducer() override
double getJets(edm::Event &, const edm::EventSetup &)
bool controlledUncertainty_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double muonPhiUncertaintyParameter0_
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< TF1 > phiUncertainty
const double significance(double &met_r, double &met_phi, double &met_set)
void setNumberOfJets(const double &numberOfJets)
edm::EDGetTokenT< edm::View< pat::Muon > > muoToken_
uncertaintyFunctions muonUncertainty
Sin< T >::type sin(const T &t)
uncertaintyFunctions ecalEEUncertainty
uncertaintyFunctions jetUncertainty
double jetEtUncertaintyParameter1_
double elePhiUncertaintyParameter0_
double jetEtUncertaintyParameter2_
double jetPhiUncertaintyParameter2_
uncertaintyFunctions hcalHBUncertainty
double getMuons(edm::Event &, const edm::EventSetup &)
const_iterator begin() const
edm::EDGetTokenT< edm::View< pat::Tau > > tauToken_
double muonEtUncertaintyParameter0_
PATMHTProducer(const edm::ParameterSet &)
Cos< T >::type cos(const T &t)
std::string metCollectionLabel_
void setUncertaintyParameters()
edm::InputTag CaloJetAlgorithmTag_
uncertaintyFunctions muonCorrUncertainty
double getElectrons(edm::Event &, const edm::EventSetup &)
std::string significanceLabel_
uncertaintyFunctions hcalHFUncertainty
std::vector< metsig::SigInputObj > physobjvector_
void getTowers(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< edm::View< pat::Electron > > eleToken_
std::string JetCorrectionService_
T getParameter(std::string const &) const
edm::InputTag ElectronTag_
double uncertaintyScaleFactor_
edm::InputTag CaloTowerTag_
double jetPhiUncertaintyParameter1_
void produce(edm::Event &, const edm::EventSetup &) override
double jetPhiUncertaintyParameter0_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
uncertaintyFunctions jetCorrUncertainty
const_iterator end() const
uncertaintyFunctions ecalEBUncertainty
double jetEtUncertaintyParameter0_
Log< level::Warning, false > LogWarning
uncertaintyFunctions hcalHOUncertainty
void setNumberOfElectrons(const double &numberOfElectrons)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::unique_ptr< TF1 > etUncertainty
uncertaintyFunctions eleUncertainty
std::set< CaloTowerDetId > s_clusteredTowers