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/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 370 of file EwkTauDQM.h.

Function Documentation

◆ calcDeltaPhi()

double calcDeltaPhi ( double  ,
double   
)

Definition at line 1026 of file EwkTauDQM.cc.

1026  {
1027  double deltaPhi = phi1 - phi2;
1028 
1029  if (deltaPhi < 0.)
1030  deltaPhi = -deltaPhi;
1031 
1032  if (deltaPhi > TMath::Pi())
1033  deltaPhi = 2 * TMath::Pi() - deltaPhi;
1034 
1035  return deltaPhi;
1036 }

References SiPixelRawToDigiRegional_cfi::deltaPhi, and Pi.

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

◆ calcMt()

double calcMt ( double  ,
double  ,
double  ,
double   
)

Definition at line 1038 of file EwkTauDQM.cc.

1038  {
1039  double pt1 = TMath::Sqrt(px1 * px1 + py1 * py1);
1040  double pt2 = TMath::Sqrt(px2 * px2 + py2 * py2);
1041 
1042  double p1Dotp2 = px1 * px2 + py1 * py2;
1043  double cosAlpha = p1Dotp2 / (pt1 * pt2);
1044 
1045  return TMath::Sqrt(2 * pt1 * pt2 * (1 - cosAlpha));
1046 }

References HLT_FULL_cff::pt1, and HLT_FULL_cff::pt2.

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

◆ calcPzeta()

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

Definition at line 1048 of file EwkTauDQM.cc.

1051  {
1052  double cosPhi1 = cos(p1.phi());
1053  double sinPhi1 = sin(p1.phi());
1054  double cosPhi2 = cos(p2.phi());
1055  double sinPhi2 = sin(p2.phi());
1056  double zetaX = cosPhi1 + cosPhi2;
1057  double zetaY = sinPhi1 + sinPhi2;
1058  double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1059  if (zetaR > 0.) {
1060  zetaX /= zetaR;
1061  zetaY /= zetaR;
1062  }
1063 
1064  double pxVis = p1.px() + p2.px();
1065  double pyVis = p1.py() + p2.py();
1066  double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1067 
1068  double px = pxVis + pxMEt;
1069  double py = pyVis + pyMEt;
1070  double pZeta = px * zetaX + py * zetaY;
1071 
1072  return pZeta - 1.5 * pZetaVis;
1073 }

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

◆ getIsoMode()

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

Definition at line 1012 of file EwkTauDQM.cc.

1012  {
1013  int isoMode_int;
1014  if (isoMode_string == "absoluteIso") {
1015  isoMode_int = kAbsoluteIso;
1016  } else if (isoMode_string == "relativeIso") {
1017  isoMode_int = kRelativeIso;
1018  } else {
1019  edm::LogError("getIsoMode") << " Failed to decode isoMode string = " << isoMode_string << " !!";
1020  isoMode_int = kUndefinedIso;
1021  error = 1;
1022  }
1023  return isoMode_int;
1024 }

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

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

◆ getTheElectron()

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

Definition at line 1102 of file EwkTauDQM.cc.

1104  {
1105  const reco::GsfElectron* theElectron = nullptr;
1106 
1107  for (reco::GsfElectronCollection::const_iterator electron = electrons.begin(); electron != electrons.end();
1108  ++electron) {
1109  if (TMath::Abs(electron->eta()) < electronEtaCut && electron->pt() > electronPtCut &&
1111  if (theElectron == nullptr || electron->pt() > theElectron->pt())
1112  theElectron = &(*electron);
1113  }
1114  }
1115 
1116  return theElectron;
1117 }

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

Referenced by EwkElecTauHistManager::fillHistograms().

◆ getTheMuon()

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

Definition at line 1119 of file EwkTauDQM.cc.

1119  {
1120  const reco::Muon* theMuon = nullptr;
1121 
1122  for (reco::MuonCollection::const_iterator muon = muons.begin(); muon != muons.end(); ++muon) {
1123  if (TMath::Abs(muon->eta()) < muonEtaCut && muon->pt() > muonPtCut) {
1124  if (theMuon == nullptr || muon->pt() > theMuon->pt())
1125  theMuon = &(*muon);
1126  }
1127  }
1128 
1129  return theMuon;
1130 }

References Abs(), HLT_FULL_cff::muon, ewkTauDQM_cfi::muonEtaCut, L1TObjectsTiming_cfi::muonPtCut, PDWG_BPHSkim_cff::muons, and reco::LeafCandidate::pt().

Referenced by EwkMuTauHistManager::fillHistograms().

◆ getTheTauJet()

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

Definition at line 1132 of file EwkTauDQM.cc.

1135  {
1136  const reco::PFTau* theTauJet = nullptr;
1137  theTauJetIndex = -1;
1138 
1139  int numTauJets = tauJets.size();
1140  for (int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1141  const reco::PFTau& tauJet = tauJets.at(iTauJet);
1142 
1143  if (fabs(tauJet.eta()) < tauJetEtaCut && tauJet.pt() > tauJetPtCut) {
1144  if (theTauJet == nullptr || tauJet.pt() > theTauJet->pt()) {
1145  theTauJet = &tauJet;
1146  theTauJetIndex = iTauJet;
1147  }
1148  }
1149  }
1150 
1151  return theTauJet;
1152 }

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

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

◆ getVertexD0()

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

Definition at line 1154 of file EwkTauDQM.cc.

1154  {
1155  double dX = vertex.x() - beamSpot.x0();
1156  double dY = vertex.y() - beamSpot.y0();
1157  return TMath::Sqrt(dX * dX + dY * dY);
1158 }

References pwdgSkimBPark_cfi::beamSpot, and bphysicsOniaDQM_cfi::vertex.

◆ passesElectronId()

bool passesElectronId ( const reco::GsfElectron )

Definition at line 1085 of file EwkTauDQM.cc.

1085  {
1086  if (passesElectronPreId(electron) && ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL
1087  // endcap
1088  electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 &&
1089  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 &&
1090  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7) ||
1091  (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL
1092  // barrel
1093  electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 &&
1094  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 &&
1095  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8))) {
1096  return true;
1097  } else {
1098  return false;
1099  }
1100 }

References Abs(), metsig::electron, and passesElectronPreId().

Referenced by EwkElecTauHistManager::fillHistograms().

◆ passesElectronPreId()

bool passesElectronPreId ( const reco::GsfElectron )

Definition at line 1075 of file EwkTauDQM.cc.

1075  {
1076  if ((TMath::Abs(electron.eta()) < 1.479 || TMath::Abs(electron.eta()) > 1.566) && // cut ECAL barrel/endcap crack
1077  electron.deltaPhiSuperClusterTrackAtVtx() < 0.8 && electron.deltaEtaSuperClusterTrackAtVtx() < 0.01 &&
1078  electron.sigmaIetaIeta() < 0.03) {
1079  return true;
1080  } else {
1081  return false;
1082  }
1083 }

References Abs(), and metsig::electron.

Referenced by getTheElectron(), and passesElectronId().

◆ 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 373 of file EwkTauDQM.h.

379  {
380  if (!evt.getByLabel(src, handle)) {
381  if (numWarnings < maxNumWarnings || maxNumWarnings == -1)
382  edm::LogWarning("readEventData") << errorMessage << " !!";
383  ++numWarnings;
384  error = true;
385  }
386 }

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

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

reco::Candidate::size
Definition: Candidate.h:48
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
ewkTauDQM_cfi.tauJetPtCut
tauJetPtCut
Definition: ewkTauDQM_cfi.py:50
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
ewkTauDQM_cfi.electronEtaCut
electronEtaCut
"HLT_Ele10_LW_L1R"
Definition: ewkTauDQM_cfi.py:83
muon
Definition: MuonCocktails.h:17
patZpeak.handle
handle
Definition: patZpeak.py:23
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
reco::PFTau
Definition: PFTau.h:36
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
kAbsoluteIso
Definition: EwkTauDQM.h:370
relativeConstraints.error
error
Definition: relativeConstraints.py:53
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
reco::Muon
Definition: Muon.h:27
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs
T Abs(T a)
Definition: MathUtil.h:49
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11773
metsig::electron
Definition: SignAlgoResolutions.h:48
p2
double p2[4]
Definition: TauolaWrapper.h:90
HLT_FULL_cff.pt1
pt1
Definition: HLT_FULL_cff.py:9933
reco::GsfElectron
Definition: GsfElectron.h:35
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:492
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
kRelativeIso
Definition: EwkTauDQM.h:370
p1
double p1[4]
Definition: TauolaWrapper.h:89
HLT_FULL_cff.pt2
pt2
Definition: HLT_FULL_cff.py:9935
ewkTauDQM_cfi.maxNumWarnings
maxNumWarnings
Definition: ewkTauDQM_cfi.py:11
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
ewkTauDQM_cfi.muonEtaCut
muonEtaCut
Definition: ewkTauDQM_cfi.py:41
passesElectronPreId
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1075
kUndefinedIso
Definition: EwkTauDQM.h:370
ewkTauDQM_cfi.tauJetEtaCut
tauJetEtaCut
Definition: ewkTauDQM_cfi.py:49
ewkTauDQM_cfi.electronPtCut
electronPtCut
Definition: ewkTauDQM_cfi.py:84
L1TObjectsTiming_cfi.muonPtCut
muonPtCut
Definition: L1TObjectsTiming_cfi.py:23