CMS 3D CMS Logo

Functions | Variables
EwkTauDQM.cc File Reference
#include "DQM/Physics/src/EwkTauDQM.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/View.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "FWCore/Common/interface/TriggerNames.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "DataFormats/TauReco/interface/PFTau.h"
#include "DataFormats/TauReco/interface/PFTauFwd.h"
#include "DataFormats/TauReco/interface/PFTauDiscriminator.h"
#include "DataFormats/METReco/interface/CaloMET.h"
#include "DataFormats/METReco/interface/CaloMETFwd.h"
#include "DataFormats/METReco/interface/PFMET.h"
#include "DataFormats/METReco/interface/PFMETFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "TMath.h"
#include <iostream>
#include <iomanip>
#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"

Go to the source code of this file.

Functions

double calcDeltaPhi (double phi1, double phi2)
 
double calcMt (double px1, double py1, double px2, double py2)
 
double calcPzeta (const reco::Candidate::LorentzVector &p1, const reco::Candidate::LorentzVector &p2, double pxMEt, double pyMEt)
 
std::string dqmDirectoryName (const std::string &dqmRootDirectory, const std::string &dqmSubDirectory)
 
int getIsoMode (const std::string &isoMode_string, int &error)
 
const reco::GsfElectrongetTheElectron (const reco::GsfElectronCollection &electrons, double electronEtaCut, double electronPtCut)
 
const reco::MuongetTheMuon (const reco::MuonCollection &muons, double muonEtaCut, double muonPtCut)
 
const reco::PFTaugetTheTauJet (const reco::PFTauCollection &tauJets, double tauJetEtaCut, double tauJetPtCut, int &theTauJetIndex)
 
double getVertexD0 (const reco::Vertex &vertex, const reco::BeamSpot &beamSpot)
 
bool passesElectronId (const reco::GsfElectron &electron)
 
bool passesElectronPreId (const reco::GsfElectron &electron)
 

Variables

const std::string dqmSeparator = "/"
 

Function Documentation

◆ calcDeltaPhi()

double calcDeltaPhi ( double  phi1,
double  phi2 
)

Definition at line 1023 of file EwkTauDQM.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, and Pi.

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

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

◆ calcMt()

double calcMt ( double  px1,
double  py1,
double  px2,
double  py2 
)

Definition at line 1035 of file EwkTauDQM.cc.

References HLT_2022v15_cff::pt1, and HLT_2022v15_cff::pt2.

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

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

◆ calcPzeta()

double calcPzeta ( const reco::Candidate::LorentzVector p1,
const reco::Candidate::LorentzVector p2,
double  pxMEt,
double  pyMEt 
)

Definition at line 1045 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().

1048  {
1049  double cosPhi1 = cos(p1.phi());
1050  double sinPhi1 = sin(p1.phi());
1051  double cosPhi2 = cos(p2.phi());
1052  double sinPhi2 = sin(p2.phi());
1053  double zetaX = cosPhi1 + cosPhi2;
1054  double zetaY = sinPhi1 + sinPhi2;
1055  double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1056  if (zetaR > 0.) {
1057  zetaX /= zetaR;
1058  zetaY /= zetaR;
1059  }
1060 
1061  double pxVis = p1.px() + p2.px();
1062  double pyVis = p1.py() + p2.py();
1063  double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1064 
1065  double px = pxVis + pxMEt;
1066  double py = pyVis + pyMEt;
1067  double pZeta = px * zetaX + py * zetaY;
1068 
1069  return pZeta - 1.5 * pZetaVis;
1070 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22

◆ dqmDirectoryName()

std::string dqmDirectoryName ( const std::string &  dqmRootDirectory,
const std::string &  dqmSubDirectory 
)

Definition at line 10 of file EwkTauDQM.cc.

References TrackerOfflineValidation_Dqm_cff::dirName, dqmRootDirectory, dqmSeparator, ewkTauDQM_cfi::dqmSubDirectory, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by TauDQMFileLoader::endRun(), TauDQMHistPlotter::endRun(), EwkTauDQM::EwkTauDQM(), and mapSubDirectoryStructure().

10  {
11  //--- concatenate names of dqmRootDirectory and dqmSubDirectory;
12  // add "/" separator inbetween if necessary
14  if (!dirName.empty() && dirName.find_last_of(dqmSeparator) != (dirName.length() - 1))
15  dirName.append(dqmSeparator);
16  dirName.append(dqmSubDirectory);
17  return dirName;
18 }
const std::string dqmRootDirectory
const std::string dqmSeparator
Definition: EwkTauDQM.cc:8

◆ getIsoMode()

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

Definition at line 1009 of file EwkTauDQM.cc.

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

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

1009  {
1010  int isoMode_int;
1011  if (isoMode_string == "absoluteIso") {
1012  isoMode_int = kAbsoluteIso;
1013  } else if (isoMode_string == "relativeIso") {
1014  isoMode_int = kRelativeIso;
1015  } else {
1016  edm::LogError("getIsoMode") << " Failed to decode isoMode string = " << isoMode_string << " !!";
1017  isoMode_int = kUndefinedIso;
1018  error = 1;
1019  }
1020  return isoMode_int;
1021 }
Log< level::Error, false > LogError

◆ getTheElectron()

const reco::GsfElectron* getTheElectron ( const reco::GsfElectronCollection electrons,
double  electronEtaCut,
double  electronPtCut 
)

Definition at line 1099 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().

1101  {
1102  const reco::GsfElectron* theElectron = nullptr;
1103 
1104  for (reco::GsfElectronCollection::const_iterator electron = electrons.begin(); electron != electrons.end();
1105  ++electron) {
1106  if (TMath::Abs(electron->eta()) < electronEtaCut && electron->pt() > electronPtCut &&
1108  if (theElectron == nullptr || electron->pt() > theElectron->pt())
1109  theElectron = &(*electron);
1110  }
1111  }
1112 
1113  return theElectron;
1114 }
double pt() const final
transverse momentum
electronEtaCut
"HLT_Ele10_LW_L1R"
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1072

◆ getTheMuon()

const reco::Muon* getTheMuon ( const reco::MuonCollection muons,
double  muonEtaCut,
double  muonPtCut 
)

Definition at line 1116 of file EwkTauDQM.cc.

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

Referenced by EwkMuTauHistManager::fillHistograms().

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

◆ getTheTauJet()

const reco::PFTau* getTheTauJet ( const reco::PFTauCollection tauJets,
double  tauJetEtaCut,
double  tauJetPtCut,
int &  theTauJetIndex 
)

Definition at line 1129 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().

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

◆ getVertexD0()

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

Definition at line 1151 of file EwkTauDQM.cc.

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

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

◆ passesElectronId()

bool passesElectronId ( const reco::GsfElectron electron)

Definition at line 1082 of file EwkTauDQM.cc.

References HPSPFTauProducerPuppi_cfi::electron, and passesElectronPreId().

Referenced by EwkElecTauHistManager::fillHistograms().

1082  {
1083  if (passesElectronPreId(electron) && ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL
1084  // endcap
1085  electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 &&
1086  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 &&
1087  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7) ||
1088  (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL
1089  // barrel
1090  electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 &&
1091  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 &&
1092  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8))) {
1093  return true;
1094  } else {
1095  return false;
1096  }
1097 }
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1072

◆ passesElectronPreId()

bool passesElectronPreId ( const reco::GsfElectron electron)

Definition at line 1072 of file EwkTauDQM.cc.

References HPSPFTauProducerPuppi_cfi::electron.

Referenced by getTheElectron(), and passesElectronId().

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

Variable Documentation

◆ dqmSeparator

const std::string dqmSeparator = "/"