CMS 3D CMS Logo

Classes | Enumerations | Functions
EwkTauDQM.h File Reference
#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include <string>
#include <Math/VectorUtil.h>
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Candidate/interface/Candidate.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"
#include "DataFormats/TauReco/interface/PFTau.h"
#include "DataFormats/TauReco/interface/PFTauFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"

Go to the source code of this file.

Classes

class  EwkElecTauHistManager
 
class  EwkMuTauHistManager
 
class  EwkTauDQM
 

Enumerations

enum  { kAbsoluteIso, kRelativeIso, kUndefinedIso }
 

Functions

double calcDeltaPhi (double, double)
 
double calcMt (double, double, double, double)
 
double calcPzeta (const reco::Candidate::LorentzVector &, const reco::Candidate::LorentzVector &, double, double)
 
int getIsoMode (const std::string &, int &)
 
const reco::GsfElectrongetTheElectron (const reco::GsfElectronCollection &, double, double)
 
const reco::MuongetTheMuon (const reco::MuonCollection &, double, double)
 
const reco::PFTaugetTheTauJet (const reco::PFTauCollection &, double, double, int &)
 
double getVertexD0 (const reco::Vertex &, const reco::BeamSpot &)
 
bool passesElectronId (const reco::GsfElectron &)
 
bool passesElectronPreId (const reco::GsfElectron &)
 
template<typename T >
void readEventData (const edm::Event &evt, const edm::InputTag &src, edm::Handle< T > &handle, long &numWarnings, int maxNumWarnings, bool &error, const char *errorMessage)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Auxiliary functions to compute quantities used by EWK Tau DQM (shared by different channels)

Author
Joshua Swanson
Enumerator
kAbsoluteIso 
kRelativeIso 
kUndefinedIso 

Definition at line 371 of file EwkTauDQM.h.

Function Documentation

◆ calcDeltaPhi()

double calcDeltaPhi ( double  ,
double   
)

Definition at line 1002 of file EwkTauDQM.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, and Pi.

Referenced by EwkDQM::analyze(), EwkElecTauHistManager::fillHistograms(), and EwkMuTauHistManager::fillHistograms().

1002  {
1003  double deltaPhi = phi1 - phi2;
1004 
1005  if (deltaPhi < 0.)
1006  deltaPhi = -deltaPhi;
1007 
1008  if (deltaPhi > TMath::Pi())
1009  deltaPhi = 2 * TMath::Pi() - deltaPhi;
1010 
1011  return deltaPhi;
1012 }
const double Pi

◆ calcMt()

double calcMt ( double  ,
double  ,
double  ,
double   
)

Definition at line 1014 of file EwkTauDQM.cc.

References HLT_2023v12_cff::pt1, and HLT_2023v12_cff::pt2.

Referenced by EwkElecTauHistManager::fillHistograms(), and EwkMuTauHistManager::fillHistograms().

1014  {
1015  double pt1 = TMath::Sqrt(px1 * px1 + py1 * py1);
1016  double pt2 = TMath::Sqrt(px2 * px2 + py2 * py2);
1017 
1018  double p1Dotp2 = px1 * px2 + py1 * py2;
1019  double cosAlpha = p1Dotp2 / (pt1 * pt2);
1020 
1021  return TMath::Sqrt(2 * pt1 * pt2 * (1 - cosAlpha));
1022 }

◆ calcPzeta()

double calcPzeta ( const reco::Candidate::LorentzVector ,
const reco::Candidate::LorentzVector ,
double  ,
double   
)

Definition at line 1024 of file EwkTauDQM.cc.

References funct::cos(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, and funct::sin().

1027  {
1028  double cosPhi1 = cos(p1.phi());
1029  double sinPhi1 = sin(p1.phi());
1030  double cosPhi2 = cos(p2.phi());
1031  double sinPhi2 = sin(p2.phi());
1032  double zetaX = cosPhi1 + cosPhi2;
1033  double zetaY = sinPhi1 + sinPhi2;
1034  double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1035  if (zetaR > 0.) {
1036  zetaX /= zetaR;
1037  zetaY /= zetaR;
1038  }
1039 
1040  double pxVis = p1.px() + p2.px();
1041  double pyVis = p1.py() + p2.py();
1042  double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1043 
1044  double px = pxVis + pxMEt;
1045  double py = pyVis + pyMEt;
1046  double pZeta = px * zetaX + py * zetaY;
1047 
1048  return pZeta - 1.5 * pZetaVis;
1049 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22

◆ getIsoMode()

int getIsoMode ( const std::string &  ,
int &   
)

Definition at line 988 of file EwkTauDQM.cc.

References relativeConstraints::error, kAbsoluteIso, kRelativeIso, and kUndefinedIso.

Referenced by EwkElecTauHistManager::EwkElecTauHistManager(), and EwkMuTauHistManager::EwkMuTauHistManager().

988  {
989  int isoMode_int;
990  if (isoMode_string == "absoluteIso") {
991  isoMode_int = kAbsoluteIso;
992  } else if (isoMode_string == "relativeIso") {
993  isoMode_int = kRelativeIso;
994  } else {
995  edm::LogError("getIsoMode") << " Failed to decode isoMode string = " << isoMode_string << " !!";
996  isoMode_int = kUndefinedIso;
997  error = 1;
998  }
999  return isoMode_int;
1000 }
Log< level::Error, false > LogError

◆ getTheElectron()

const reco::GsfElectron* getTheElectron ( const reco::GsfElectronCollection ,
double  ,
double   
)

Definition at line 1078 of file EwkTauDQM.cc.

References HPSPFTauProducerPuppi_cfi::electron, ewkTauDQM_cfi::electronEtaCut, ewkTauDQM_cfi::electronPtCut, pwdgSkimBPark_cfi::electrons, passesElectronPreId(), and reco::LeafCandidate::pt().

Referenced by EwkElecTauHistManager::fillHistograms().

1080  {
1081  const reco::GsfElectron* theElectron = nullptr;
1082 
1083  for (reco::GsfElectronCollection::const_iterator electron = electrons.begin(); electron != electrons.end();
1084  ++electron) {
1085  if (TMath::Abs(electron->eta()) < electronEtaCut && electron->pt() > electronPtCut &&
1087  if (theElectron == nullptr || electron->pt() > theElectron->pt())
1088  theElectron = &(*electron);
1089  }
1090  }
1091 
1092  return theElectron;
1093 }
double pt() const final
transverse momentum
electronEtaCut
"HLT_Ele10_LW_L1R"
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1051

◆ getTheMuon()

const reco::Muon* getTheMuon ( const reco::MuonCollection ,
double  ,
double   
)

Definition at line 1095 of file EwkTauDQM.cc.

References HLT_2023v12_cff::muon, ewkTauDQM_cfi::muonEtaCut, L1TObjectsTiming_cfi::muonPtCut, DiMuonV_cfg::muons, and reco::LeafCandidate::pt().

Referenced by EwkMuTauHistManager::fillHistograms().

1095  {
1096  const reco::Muon* theMuon = nullptr;
1097 
1098  for (reco::MuonCollection::const_iterator muon = muons.begin(); muon != muons.end(); ++muon) {
1099  if (TMath::Abs(muon->eta()) < muonEtaCut && muon->pt() > muonPtCut) {
1100  if (theMuon == nullptr || muon->pt() > theMuon->pt())
1101  theMuon = &(*muon);
1102  }
1103  }
1104 
1105  return theMuon;
1106 }
double pt() const final
transverse momentum
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:212

◆ getTheTauJet()

const reco::PFTau* getTheTauJet ( const reco::PFTauCollection ,
double  ,
double  ,
int &   
)

Definition at line 1108 of file EwkTauDQM.cc.

References reco::LeafCandidate::eta(), reco::LeafCandidate::pt(), reco::Candidate::size, ewkTauDQM_cfi::tauJetEtaCut, and ewkTauDQM_cfi::tauJetPtCut.

Referenced by EwkElecTauHistManager::fillHistograms(), and EwkMuTauHistManager::fillHistograms().

1111  {
1112  const reco::PFTau* theTauJet = nullptr;
1113  theTauJetIndex = -1;
1114 
1115  int numTauJets = tauJets.size();
1116  for (int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1117  const reco::PFTau& tauJet = tauJets.at(iTauJet);
1118 
1119  if (fabs(tauJet.eta()) < tauJetEtaCut && tauJet.pt() > tauJetPtCut) {
1120  if (theTauJet == nullptr || tauJet.pt() > theTauJet->pt()) {
1121  theTauJet = &tauJet;
1122  theTauJetIndex = iTauJet;
1123  }
1124  }
1125  }
1126 
1127  return theTauJet;
1128 }
double pt() const final
transverse momentum
double eta() const final
momentum pseudorapidity

◆ getVertexD0()

double getVertexD0 ( const reco::Vertex ,
const reco::BeamSpot  
)

Definition at line 1130 of file EwkTauDQM.cc.

References pwdgSkimBPark_cfi::beamSpot, dX(), dY(), and bphysicsOniaDQM_cfi::vertex.

1130  {
1131  double dX = vertex.x() - beamSpot.x0();
1132  double dY = vertex.y() - beamSpot.y0();
1133  return TMath::Sqrt(dX * dX + dY * dY);
1134 }
float dX(const MatchPair &match)
float dY(const MatchPair &match)

◆ passesElectronId()

bool passesElectronId ( const reco::GsfElectron )

Definition at line 1061 of file EwkTauDQM.cc.

References HPSPFTauProducerPuppi_cfi::electron, and passesElectronPreId().

Referenced by EwkElecTauHistManager::fillHistograms().

1061  {
1062  if (passesElectronPreId(electron) && ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL
1063  // endcap
1064  electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 &&
1065  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 &&
1066  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7) ||
1067  (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL
1068  // barrel
1069  electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 &&
1070  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 &&
1071  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8))) {
1072  return true;
1073  } else {
1074  return false;
1075  }
1076 }
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1051

◆ passesElectronPreId()

bool passesElectronPreId ( const reco::GsfElectron )

Definition at line 1051 of file EwkTauDQM.cc.

References HPSPFTauProducerPuppi_cfi::electron.

Referenced by getTheElectron(), and passesElectronId().

1051  {
1052  if ((TMath::Abs(electron.eta()) < 1.479 || TMath::Abs(electron.eta()) > 1.566) && // cut ECAL barrel/endcap crack
1053  electron.deltaPhiSuperClusterTrackAtVtx() < 0.8 && electron.deltaEtaSuperClusterTrackAtVtx() < 0.01 &&
1054  electron.sigmaIetaIeta() < 0.03) {
1055  return true;
1056  } else {
1057  return false;
1058  }
1059 }

◆ readEventData()

template<typename T >
void readEventData ( const edm::Event evt,
const edm::InputTag src,
edm::Handle< T > &  handle,
long &  numWarnings,
int  maxNumWarnings,
bool &  error,
const char *  errorMessage 
)

Definition at line 374 of file EwkTauDQM.h.

References relativeConstraints::error, edm::Event::getByLabel(), patZpeak::handle, ewkTauDQM_cfi::maxNumWarnings, and TrackRefitter_38T_cff::src.

Referenced by EwkElecTauHistManager::fillHistograms(), and EwkMuTauHistManager::fillHistograms().

380  {
381  if (!evt.getByLabel(src, handle)) {
382  if (numWarnings < maxNumWarnings || maxNumWarnings == -1)
383  edm::LogWarning("readEventData") << errorMessage << " !!";
384  ++numWarnings;
385  error = true;
386  }
387 }
Log< level::Warning, false > LogWarning
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:498