CMS 3D CMS Logo

L1JetRecoTreeProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1Trigger/L1TNtuples
4 // Class: L1JetRecoTreeProducer
5 //
13 // system include files
14 #include <memory>
15 
16 // framework
25 
26 // cond formats
30 
31 // data formats
43 
44 // ROOT output stuff
47 #include "TH1.h"
48 #include "TTree.h"
49 #include "TF1.h"
50 #include <TVector2.h>
51 
52 //local data formats
55 
56 //
57 // class declaration
58 //
59 
60 class L1JetRecoTreeProducer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
61 public:
63  ~L1JetRecoTreeProducer() override;
64 
65 private:
66  void beginJob(void) override;
67  void analyze(const edm::Event&, const edm::EventSetup&) override;
68  void endJob() override;
69 
73  void doCorrPUPPIJets(edm::Handle<std::vector<pat::Jet> > corrPuppiJets);
78 
82 
84 
85  bool pfJetID(const reco::PFJet& jet);
86  bool puppiJetID(const pat::Jet& jet);
87  bool caloJetID(const reco::CaloJet& jet);
88 
89 public:
92 
93 private:
94  // tree
95  TTree* tree_;
96 
97  // EDM input tags
105 
110 
112 
113  // debug stuff
118  double jetetaMax_;
119  unsigned int maxCl_;
120  unsigned int maxJet_;
121  unsigned int maxVtx_;
122  unsigned int maxTrk_;
123 
132 
134 };
135 
137  : pfJetsMissing_(false),
138  puppiJetsMissing_(false),
139  corrPuppiJetsMissing_(false),
140  pfJetCorrMissing_(false),
141  caloJetCorrMissing_(false),
142  caloJetsMissing_(false),
143  caloJetIDMissing_(false),
144  pfMetMissing_(false),
145  puppiMetMissing_(false),
146  caloMetMissing_(false),
147  caloMetBEMissing_(false),
148  muonsMissing_(false) {
149  caloJetToken_ =
150  consumes<reco::CaloJetCollection>(iConfig.getUntrackedParameter("caloJetToken", edm::InputTag("ak4CaloJets")));
151  pfJetToken_ =
152  consumes<reco::PFJetCollection>(iConfig.getUntrackedParameter("pfJetToken", edm::InputTag("ak4PFJetsCHS")));
153  puppiJetToken_ = consumes<reco::PFJetCollection>(iConfig.getParameter<edm::InputTag>("puppiJetToken"));
154  corrPuppiJetToken_ = consumes<std::vector<pat::Jet> >(
155  iConfig.getUntrackedParameter("corrPuppiJetToken", edm::InputTag("patJetsCorrectedPuppiJets")));
157  consumes<edm::ValueMap<reco::JetID> >(iConfig.getUntrackedParameter("caloJetIDToken", edm::InputTag("ak4JetID")));
158  pfJECToken_ = consumes<reco::JetCorrector>(
159  iConfig.getUntrackedParameter<edm::InputTag>("pfJECToken", edm::InputTag("ak4PFCHSL1FastL2L3ResidualCorrector")));
160  caloJECToken_ = consumes<reco::JetCorrector>(iConfig.getUntrackedParameter<edm::InputTag>(
161  "caloJECToken", edm::InputTag("ak4CaloL1FastL2L3ResidualCorrector")));
162 
163  pfMetToken_ = consumes<reco::PFMETCollection>(iConfig.getUntrackedParameter("pfMetToken", edm::InputTag("pfMetT1")));
165  consumes<reco::PFMETCollection>(iConfig.getUntrackedParameter("puppiMetToken", edm::InputTag("pfMetPuppi")));
166  caloMetToken_ =
167  consumes<reco::CaloMETCollection>(iConfig.getUntrackedParameter("caloMetToken", edm::InputTag("caloMet")));
169  consumes<reco::CaloMETCollection>(iConfig.getUntrackedParameter("caloMetBEToken", edm::InputTag("caloMetBE")));
170 
171  muonToken_ = consumes<reco::MuonCollection>(iConfig.getUntrackedParameter("muonToken", edm::InputTag("muons")));
172 
173  usesResource(TFileService::kSharedResource);
174 
175  jetptThreshold_ = iConfig.getParameter<double>("jetptThreshold");
176  jetetaMax_ = iConfig.getParameter<double>("jetetaMax");
177  maxJet_ = iConfig.getParameter<unsigned int>("maxJet");
178 
181 
182  // set up output
184  tree_ = fs_->make<TTree>("JetRecoTree", "JetRecoTree");
185  tree_->Branch("Jet", "L1Analysis::L1AnalysisRecoJetDataFormat", &jet_data, 32000, 3);
186  tree_->Branch("Sums", "L1Analysis::L1AnalysisRecoMetDataFormat", &met_data, 32000, 3);
187 }
188 
190  // do anything here that needs to be done at desctruction time
191  // (e.g. close files, deallocate resources etc.)
192 }
193 
194 //
195 // member functions
196 //
197 
198 // ------------ method called to for each event ------------
200  jet_data->Reset();
201  met_data->Reset();
202 
203  // get jets
205  iEvent.getByToken(pfJetToken_, pfJets);
206 
207  // get puppi jets
209  iEvent.getByToken(puppiJetToken_, puppiJets);
210 
211  // get corrected puppi jets
212  edm::Handle<std::vector<pat::Jet> > corrPuppiJets;
213  iEvent.getByToken(corrPuppiJetToken_, corrPuppiJets);
214 
215  // get calo jets
217  iEvent.getByToken(caloJetToken_, caloJets);
218 
219  //get sums
221  iEvent.getByToken(pfMetToken_, pfMet);
222 
223  //get sums
225  iEvent.getByToken(puppiMetToken_, puppiMet);
226 
227  // get jet ID
229  iEvent.getByToken(caloJetIDToken_, jetsID);
230 
232  iEvent.getByToken(pfJECToken_, pfJetCorr);
233 
235  iEvent.getByToken(caloJECToken_, caloJetCorr);
236 
238  iEvent.getByToken(caloMetToken_, caloMet);
239 
241  iEvent.getByToken(caloMetBEToken_, caloMetBE);
242 
243  // get muons
245  iEvent.getByToken(muonToken_, muons);
246 
247  if (pfJets.isValid()) {
248  jet_data->nJets = 0;
249 
250  doPFJets(pfJets);
251 
252  } else {
253  if (!pfJetsMissing_) {
254  edm::LogWarning("MissingProduct") << "PFJets not found. Branch will not be filled" << std::endl;
255  }
256  pfJetsMissing_ = true;
257  }
258 
259  if (pfJetCorr.isValid()) {
260  doPFJetCorr(pfJets, pfJetCorr);
261 
262  } else {
263  if (!pfJetCorrMissing_) {
264  edm::LogWarning("MissingProduct") << "PF Jet Corrector not found. Branch will not be filled" << std::endl;
265  }
266  pfJetCorrMissing_ = true;
267  }
268 
269  if (puppiJets.isValid()) {
271 
272  doPUPPIJets(puppiJets);
273 
274  } else {
275  if (!puppiJetsMissing_) {
276  edm::LogWarning("MissingProduct") << "PUPPIJets not found. Branch will not be filled" << std::endl;
277  }
278  puppiJetsMissing_ = true;
279  }
280 
281  if (corrPuppiJets.isValid()) {
282  jet_data->puppi_nJets = 0;
283 
284  doCorrPUPPIJets(corrPuppiJets);
285 
286  } else {
287  if (!corrPuppiJetsMissing_) {
288  edm::LogWarning("MissingProduct") << "Corrected PUPPIJets not found. Branch will not be filled" << std::endl;
289  }
290  corrPuppiJetsMissing_ = true;
291  }
292 
293  if (caloJets.isValid()) {
294  jet_data->nCaloJets = 0;
295 
297 
298  } else {
299  if (!caloJetsMissing_) {
300  edm::LogWarning("MissingProduct") << "Calo Jets not found. Branch will not be filled" << std::endl;
301  }
302  caloJetsMissing_ = true;
303  }
304 
305  if (caloJetCorr.isValid()) {
306  doCaloJetCorr(caloJets, caloJetCorr);
307 
308  } else {
309  if (!caloJetCorrMissing_) {
310  edm::LogWarning("MissingProduct") << "Calo Jet Corrector not found. Branch will not be filled" << std::endl;
311  }
312  caloJetCorrMissing_ = true;
313  }
314 
315  if (!jetsID.isValid()) {
316  if (!caloJetIDMissing_) {
317  edm::LogWarning("MissingProduct") << "Calo Jet ID not found. Branch will not be filled" << std::endl;
318  }
319  caloJetIDMissing_ = true;
320  }
321 
322  if (pfMet.isValid()) {
323  doPFMet(pfMet);
324 
325  if (muons.isValid()) {
327 
328  } else {
329  if (!muonsMissing_) {
330  edm::LogWarning("MissingProduct") << "Muons not found. PFMetNoMu branch will not be filled" << std::endl;
331  }
332  muonsMissing_ = true;
333  }
334  } else {
335  if (!pfMetMissing_) {
336  edm::LogWarning("MissingProduct") << "PFMet not found. Branch will not be filled" << std::endl;
337  }
338  pfMetMissing_ = true;
339  }
340 
341  if (puppiMet.isValid()) {
342  if (muons.isValid()) {
343  doPUPPIMetNoMu(puppiMet, muons);
344 
345  } else {
346  if (!muonsMissing_) {
347  edm::LogWarning("MissingProduct") << "Muons not found. PUPPIMetNoMu branch will not be filled" << std::endl;
348  }
349  muonsMissing_ = true;
350  }
351  } else {
352  if (!puppiMetMissing_) {
353  edm::LogWarning("MissingProduct") << "PUPPIMet not found. Branch will not be filled" << std::endl;
354  }
355  puppiMetMissing_ = true;
356  }
357 
358  if (caloMet.isValid()) {
360 
361  } else {
362  if (!caloMetMissing_) {
363  edm::LogWarning("MissingProduct") << "CaloMet not found. Branch will not be filled" << std::endl;
364  }
365  caloMetMissing_ = true;
366  }
367 
368  if (caloMetBE.isValid()) {
370 
371  } else {
372  if (!caloMetBEMissing_) {
373  edm::LogWarning("MissingProduct") << "CaloMetBE not found. Branch will not be filled" << std::endl;
374  }
375  caloMetBEMissing_ = true;
376  }
377 
378  if (muons.isValid()) {
379  doZPt(muons);
380 
381  } else {
382  if (!muonsMissing_) {
383  edm::LogWarning("MissingProduct") << "Muons not found. ZPt branch will not be filled" << std::endl;
384  }
385  muonsMissing_ = true;
386  }
387 
388  tree_->Fill();
389 }
390 
392  for (auto it = caloJets->begin(); it != caloJets->end() && jet_data->nCaloJets < maxJet_; ++it) {
393  if (!caloJetIDMissing_)
394  if (!caloJetID(*it))
395  continue;
396 
397  jet_data->caloEt.push_back(it->et());
398  jet_data->caloEta.push_back(it->eta());
399  jet_data->caloPhi.push_back(it->phi());
400  jet_data->caloE.push_back(it->energy());
401 
402  jet_data->eEMF.push_back(it->emEnergyFraction());
403  jet_data->eEmEB.push_back(it->emEnergyInEB());
404  jet_data->eEmEE.push_back(it->emEnergyInEE());
405  jet_data->eEmHF.push_back(it->emEnergyInHF());
406  jet_data->eHadHB.push_back(it->hadEnergyInHB());
407  jet_data->eHadHE.push_back(it->hadEnergyInHE());
408  jet_data->eHadHO.push_back(it->hadEnergyInHO());
409  jet_data->eHadHF.push_back(it->hadEnergyInHF());
410  jet_data->eMaxEcalTow.push_back(it->maxEInEmTowers());
411  jet_data->eMaxHcalTow.push_back(it->maxEInHadTowers());
412  jet_data->towerArea.push_back(it->towersArea());
413  jet_data->n60.push_back(it->n60());
414 
415  jet_data->nCaloJets++;
416  }
417 }
418 
420  for (auto it = pfJets->begin(); it != pfJets->end() && jet_data->nJets < maxJet_; ++it) {
421  if (!pfJetID(*it))
422  continue;
423 
424  jet_data->et.push_back(it->et());
425  jet_data->eta.push_back(it->eta());
426  jet_data->phi.push_back(it->phi());
427  jet_data->e.push_back(it->energy());
428 
429  jet_data->chef.push_back(it->chargedHadronEnergyFraction());
430  jet_data->nhef.push_back(it->neutralHadronEnergyFraction());
431  jet_data->pef.push_back(it->photonEnergyFraction());
432  jet_data->eef.push_back(it->electronEnergyFraction());
433  jet_data->mef.push_back(it->muonEnergyFraction());
434  jet_data->hfhef.push_back(it->HFHadronEnergyFraction());
435  jet_data->hfemef.push_back(it->HFEMEnergyFraction());
436  jet_data->chMult.push_back(it->chargedHadronMultiplicity());
437  jet_data->nhMult.push_back(it->neutralHadronMultiplicity());
438  jet_data->phMult.push_back(it->photonMultiplicity());
439  jet_data->elMult.push_back(it->electronMultiplicity());
440  jet_data->muMult.push_back(it->muonMultiplicity());
441  jet_data->hfhMult.push_back(it->HFHadronMultiplicity());
442  jet_data->hfemMult.push_back(it->HFEMMultiplicity());
443 
444  jet_data->cemef.push_back(it->chargedEmEnergyFraction());
445  jet_data->cmef.push_back(it->chargedMuEnergyFraction());
446  jet_data->nemef.push_back(it->neutralEmEnergyFraction());
447  jet_data->cMult.push_back(it->chargedMultiplicity());
448  jet_data->nMult.push_back(it->neutralMultiplicity());
449 
450  jet_data->nJets++;
451  }
452 }
453 
456  float corrFactor = 1.;
457  unsigned int nJets = 0;
458 
459  float mHx = 0;
460  float mHy = 0;
461 
462  met_data->Ht = 0;
463  met_data->mHt = -999.;
464  met_data->mHtPhi = -999.;
465 
466  for (auto it = pfJets->begin(); it != pfJets->end() && nJets < maxJet_; ++it) {
467  if (!pfJetID(*it))
468  continue;
469 
470  corrFactor = pfJetCorr.product()->correction(*it);
471 
472  jet_data->etCorr.push_back(it->et() * corrFactor);
473  jet_data->corrFactor.push_back(corrFactor);
474 
475  nJets++;
476 
477  if (it->pt() * corrFactor > jetptThreshold_ && std::abs(it->eta()) < jetetaMax_) {
478  mHx += -1. * it->px() * corrFactor;
479  mHy += -1. * it->py() * corrFactor;
480  met_data->Ht += it->pt() * corrFactor;
481  }
482  }
483 
484  TVector2 tv2 = TVector2(mHx, mHy);
485  met_data->mHt = tv2.Mod();
486  met_data->mHtPhi = tv2.Phi();
487 }
488 
490  for (auto it = puppiJets->begin(); it != puppiJets->end() && jet_data->puppi_nUncorrJets < maxJet_; ++it) {
491  if (!puppiJetID(*it))
492  continue;
493  jet_data->puppi_et.push_back(it->et());
495  }
496 }
497 
498 void L1JetRecoTreeProducer::doCorrPUPPIJets(edm::Handle<std::vector<pat::Jet> > corrPuppiJets) {
499  float mHx = 0;
500  float mHy = 0;
501 
502  met_data->puppi_Ht = 0;
503  met_data->puppi_mHt = -999.;
504  met_data->puppi_mHtPhi = -999.;
505 
506  for (auto it = corrPuppiJets->begin(); it != corrPuppiJets->end() && jet_data->puppi_nJets < maxJet_; ++it) {
507  if (!puppiJetID(*it))
508  continue;
509 
510  jet_data->puppi_etCorr.push_back(it->et());
511  jet_data->puppi_eta.push_back(it->eta());
512  jet_data->puppi_phi.push_back(it->phi());
513  jet_data->puppi_e.push_back(it->energy());
514 
515  jet_data->puppi_chef.push_back(it->chargedHadronEnergyFraction());
516  jet_data->puppi_nhef.push_back(it->neutralHadronEnergyFraction());
517  jet_data->puppi_pef.push_back(it->photonEnergyFraction());
518  jet_data->puppi_eef.push_back(it->electronEnergyFraction());
519  jet_data->puppi_mef.push_back(it->muonEnergyFraction());
520  jet_data->puppi_hfhef.push_back(it->HFHadronEnergyFraction());
521  jet_data->puppi_hfemef.push_back(it->HFEMEnergyFraction());
522  jet_data->puppi_chMult.push_back(it->chargedHadronMultiplicity());
523  jet_data->puppi_nhMult.push_back(it->neutralHadronMultiplicity());
524  jet_data->puppi_phMult.push_back(it->photonMultiplicity());
525  jet_data->puppi_elMult.push_back(it->electronMultiplicity());
526  jet_data->puppi_muMult.push_back(it->muonMultiplicity());
527  jet_data->puppi_hfhMult.push_back(it->HFHadronMultiplicity());
528  jet_data->puppi_hfemMult.push_back(it->HFEMMultiplicity());
529 
530  jet_data->puppi_cemef.push_back(it->chargedEmEnergyFraction());
531  jet_data->puppi_cmef.push_back(it->chargedMuEnergyFraction());
532  jet_data->puppi_nemef.push_back(it->neutralEmEnergyFraction());
533  jet_data->puppi_cMult.push_back(it->chargedMultiplicity());
534  jet_data->puppi_nMult.push_back(it->neutralMultiplicity());
535 
537 
538  if (it->pt() > jetptThreshold_ && std::abs(it->eta()) < jetetaMax_) {
539  mHx += -1. * it->px();
540  mHy += -1. * it->py();
541  met_data->puppi_Ht += it->pt();
542  }
543  }
544 
545  TVector2 tv2 = TVector2(mHx, mHy);
546  met_data->puppi_mHt = tv2.Mod();
547  met_data->puppi_mHtPhi = tv2.Phi();
548 }
549 
551  edm::Handle<reco::JetCorrector> caloJetCorr) {
552  float caloCorrFactor = 1.;
553  unsigned int nCaloJets = 0;
554 
555  met_data->caloHt = 0;
556 
557  for (auto it = caloJets->begin(); it != caloJets->end() && nCaloJets < maxJet_; ++it) {
558  if (!caloJetIDMissing_)
559  if (!caloJetID(*it))
560  continue;
561 
562  caloCorrFactor = caloJetCorr.product()->correction(*it);
563 
564  jet_data->caloEtCorr.push_back(it->et() * caloCorrFactor);
565  jet_data->caloCorrFactor.push_back(caloCorrFactor);
566 
567  nCaloJets++;
568 
569  if (it->pt() * caloCorrFactor > jetptThreshold_ && std::abs(it->eta()) < jetetaMax_) {
570  met_data->caloHt += it->pt() * caloCorrFactor;
571  }
572  }
573 }
574 
576  const reco::PFMETCollection* metCol = pfMet.product();
577  const reco::PFMET theMet = metCol->front();
578 
579  met_data->met = theMet.et();
580  met_data->metPhi = theMet.phi();
581  met_data->sumEt = theMet.sumEt();
582  met_data->metPx = theMet.px();
583  met_data->metPy = theMet.py();
584 }
585 
588  const reco::PFMETCollection* metCol = pfMet.product();
589  const reco::PFMET theMet = metCol->front();
590  reco::PFMET thePFMetNoMu = metCol->front();
591 
592  double pfMetNoMuPx = theMet.px();
593  double pfMetNoMuPy = theMet.py();
594 
595  double muPx(0.), muPy(0.);
596 
597  for (auto it = muons->begin(); it != muons->end(); ++it) {
598  if (it->isPFMuon()) {
599  muPx += it->px();
600  muPy += it->py();
601  }
602  }
603 
604  pfMetNoMuPx += muPx;
605  pfMetNoMuPy += muPy;
606 
607  math::XYZTLorentzVector pfMetNoMuP4(pfMetNoMuPx, pfMetNoMuPy, 0, hypot(pfMetNoMuPx, pfMetNoMuPy));
608 
609  thePFMetNoMu.setP4(pfMetNoMuP4);
610 
611  met_data->pfMetNoMu = thePFMetNoMu.et();
612  met_data->pfMetNoMuPhi = thePFMetNoMu.phi();
613  met_data->pfMetNoMuPx = thePFMetNoMu.px();
614  met_data->pfMetNoMuPy = thePFMetNoMu.py();
615 }
616 
619  const reco::PFMETCollection* metCol = puppiMet.product();
620  const reco::PFMET theMet = metCol->front();
621  reco::PFMET thePUPPIMetNoMu = metCol->front();
622 
623  double puppiMetNoMuPx = theMet.px();
624  double puppiMetNoMuPy = theMet.py();
625 
626  double muPx(0.), muPy(0.);
627 
628  for (auto it = muons->begin(); it != muons->end(); ++it) {
629  if (it->isPFMuon()) {
630  muPx += it->px();
631  muPy += it->py();
632  }
633  }
634 
635  puppiMetNoMuPx += muPx;
636  puppiMetNoMuPy += muPy;
637 
638  math::XYZTLorentzVector puppiMetNoMuP4(puppiMetNoMuPx, puppiMetNoMuPy, 0, hypot(puppiMetNoMuPx, puppiMetNoMuPy));
639 
640  thePUPPIMetNoMu.setP4(puppiMetNoMuP4);
641 
642  met_data->puppi_metNoMu = thePUPPIMetNoMu.et();
643  met_data->puppi_metNoMuPhi = thePUPPIMetNoMu.phi();
644  met_data->puppi_metNoMuPx = thePUPPIMetNoMu.px();
645  met_data->puppi_metNoMuPy = thePUPPIMetNoMu.py();
646 }
647 
649  const reco::CaloMETCollection* metCol = caloMet.product();
650  const reco::CaloMET theMet = metCol->front();
651 
652  met_data->caloMet = theMet.et();
653  met_data->caloMetPhi = theMet.phi();
654  met_data->caloSumEt = theMet.sumEt();
655 }
656 
658  const reco::CaloMETCollection* metCol = caloMetBE.product();
659  const reco::CaloMET theMet = metCol->front();
660 
661  met_data->caloMetBE = theMet.et();
662  met_data->caloMetPhiBE = theMet.phi();
663  met_data->caloSumEtBE = theMet.sumEt();
664 }
665 
667  if (muons->size() < 2) {
668  met_data->zPt = -999;
669  return;
670  }
671 
672  reco::Muon muon1;
673  reco::Muon muon2;
674 
675  float zMass = 91.2;
676  float diMuMass = 0;
677  float closestDiff = 999.;
678  bool found2PFMuons = false;
679 
680  for (auto it1 = muons->begin(); it1 != muons->end(); ++it1) {
681  if (!it1->isPFMuon())
682  continue;
683  for (auto it2 = std::next(it1); it2 != muons->end(); ++it2) {
684  if (!it2->isPFMuon())
685  continue;
686  if (it1->charge() != (-1 * it2->charge()))
687  continue;
688 
689  found2PFMuons = true;
690  diMuMass = (it1->p4() + it2->p4()).M();
691  float diff = abs(diMuMass - zMass);
692  if (diff < closestDiff) {
693  closestDiff = diff;
694  muon1 = *it1;
695  muon2 = *it2;
696  }
697  }
698  }
699 
700  diMuMass = (muon1.p4() + muon2.p4()).M();
701  if (abs(diMuMass - zMass) > 30 || !found2PFMuons) {
702  met_data->zPt = -999;
703  return;
704  }
705 
706  float zPt = (muon1.p4() + muon2.p4()).pt();
707  met_data->zPt = zPt;
708 }
709 
711  bool tmp = true;
712  if (std::abs(jet.eta()) <= 2.6) {
713  tmp &= jet.neutralHadronEnergyFraction() < 0.9;
714  tmp &= jet.neutralEmEnergyFraction() < 0.9;
715  tmp &= (jet.chargedMultiplicity() + jet.neutralMultiplicity()) > 1;
716  tmp &= jet.muonEnergyFraction() < 0.8;
717  tmp &= jet.chargedHadronEnergyFraction() > 0.01;
718  tmp &= jet.chargedMultiplicity() > 0;
719  tmp &= jet.chargedEmEnergyFraction() < 0.8;
720  }
721  if (std::abs(jet.eta()) > 2.6 && std::abs(jet.eta()) <= 2.7) {
722  tmp &= jet.neutralHadronEnergyFraction() < 0.9;
723  tmp &= jet.neutralEmEnergyFraction() < 0.99;
724  tmp &= jet.muonEnergyFraction() < 0.8;
725  tmp &= jet.chargedMultiplicity() > 0;
726  tmp &= jet.chargedEmEnergyFraction() < 0.8;
727  }
728  if (std::abs(jet.eta()) > 2.7 && std::abs(jet.eta()) < 3.0) {
729  tmp &= jet.neutralEmEnergyFraction() < 0.99;
730  tmp &= jet.neutralMultiplicity() > 1;
731  }
732  if (std::abs(jet.eta()) > 3.0) {
733  tmp &= jet.neutralHadronEnergyFraction() > 0.2;
734  tmp &= jet.neutralEmEnergyFraction() < 0.9;
735  tmp &= jet.neutralMultiplicity() > 10;
736  }
737 
738  // our custom selection
739  //tmp &= jet.muonMultiplicity() == 0;
740  //tmp &= jet.electronMultiplicity() == 0;
741 
742  return tmp;
743 }
744 
745 //https://twiki.cern.ch/twiki/bin/view/CMS/JetID13p6TeV
747  bool tmp = true;
748  if (std::abs(jet.eta()) <= 2.6) {
749  tmp &= jet.neutralHadronEnergyFraction() < 0.9;
750  tmp &= jet.neutralEmEnergyFraction() < 0.9;
751  tmp &= (jet.chargedMultiplicity() + jet.neutralMultiplicity()) > 1;
752  tmp &= jet.muonEnergyFraction() < 0.8;
753  tmp &= jet.chargedHadronEnergyFraction() > 0.01;
754  tmp &= jet.chargedMultiplicity() > 0;
755  tmp &= jet.chargedEmEnergyFraction() < 0.8;
756  }
757  if (std::abs(jet.eta()) > 2.6 && std::abs(jet.eta()) <= 2.7) {
758  tmp &= jet.neutralHadronEnergyFraction() < 0.9;
759  tmp &= jet.neutralEmEnergyFraction() < 0.99;
760  tmp &= jet.muonEnergyFraction() < 0.8;
761  tmp &= jet.chargedEmEnergyFraction() < 0.8;
762  }
763  if (std::abs(jet.eta()) > 2.7 && std::abs(jet.eta()) <= 3.0) {
764  tmp &= jet.neutralHadronEnergyFraction() < 0.9999;
765  }
766  if (std::abs(jet.eta()) > 3.0) {
767  tmp &= jet.neutralEmEnergyFraction() < 0.9;
768  tmp &= jet.neutralMultiplicity() > 2;
769  }
770 
771  return tmp;
772 }
773 
775  bool tmp = true;
776 
777  return tmp;
778 }
779 
780 // ------------ method called once each job just before starting event loop ------------
782 
783 // ------------ method called once each job just after ending the event loop ------------
785 
786 //define this as a plug-in
static const std::string kSharedResource
Definition: TFileService.h:76
void doPFMet(edm::Handle< reco::PFMETCollection > pfMet)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool pfJetID(const reco::PFJet &jet)
edm::EDGetTokenT< reco::PFMETCollection > puppiMetToken_
Jets made from CaloTowers.
Definition: CaloJet.h:27
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
T const * product() const
Definition: Handle.h:70
bool puppiJetID(const pat::Jet &jet)
void doPFJetCorr(edm::Handle< reco::PFJetCollection > pfJets, edm::Handle< reco::JetCorrector > pfJetCorr)
edm::EDGetTokenT< reco::CaloMETCollection > caloMetToken_
void analyze(const edm::Event &, const edm::EventSetup &) override
void doPFJets(edm::Handle< reco::PFJetCollection > pfJets)
caloMetBE
____________________________________________________________________________||
Definition: CaloMET_cfi.py:19
double sumEt() const
Definition: MET.h:56
edm::EDGetTokenT< reco::JetCorrector > pfJECToken_
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:46
void doCaloMetBE(edm::Handle< reco::CaloMETCollection > caloMetBE)
Jets made from PFObjects.
Definition: PFJet.h:20
edm::EDGetTokenT< reco::PFJetCollection > puppiJetToken_
const LorentzVector & p4() const final
four-momentum Lorentz vector
T getUntrackedParameter(std::string const &, T const &) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
L1Analysis::L1AnalysisRecoJetDataFormat * jet_data
double px() const final
x coordinate of momentum vector
int iEvent
Definition: GenABIO.cc:224
void beginJob(void) override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< edm::ValueMap< reco::JetID > > caloJetIDToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< reco::PFJetCollection > pfJetToken_
void doCaloJetCorr(edm::Handle< reco::CaloJetCollection > caloJets, edm::Handle< reco::JetCorrector > caloJetCorr)
double py() const final
y coordinate of momentum vector
void doPFMetNoMu(edm::Handle< reco::PFMETCollection > pfMet, edm::Handle< reco::MuonCollection >)
void doCaloMet(edm::Handle< reco::CaloMETCollection > caloMet)
edm::EDGetTokenT< std::vector< pat::Jet > > corrPuppiJetToken_
edm::EDGetTokenT< reco::PFMETCollection > pfMetToken_
void doPUPPIMetNoMu(edm::Handle< reco::PFMETCollection > puppiMet, edm::Handle< reco::MuonCollection >)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
L1JetRecoTreeProducer(const edm::ParameterSet &)
Analysis-level calorimeter jet class.
Definition: Jet.h:77
void doZPt(edm::Handle< reco::MuonCollection >)
void doCaloJets(edm::Handle< reco::CaloJetCollection > caloJets)
bool caloJetID(const reco::CaloJet &jet)
bool isValid() const
Definition: HandleBase.h:70
void doPUPPIJets(edm::Handle< reco::PFJetCollection > puppiJets)
edm::EDGetTokenT< reco::MuonCollection > muonToken_
edm::EDGetTokenT< reco::JetCorrector > caloJECToken_
double et() const final
transverse energy
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< reco::CaloJetCollection > caloJetToken_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
double phi() const final
momentum azimuthal angle
void setP4(const LorentzVector &p4) final
set 4-momentum
edm::EDGetTokenT< reco::CaloMETCollection > caloMetBEToken_
void doCorrPUPPIJets(edm::Handle< std::vector< pat::Jet > > corrPuppiJets)