CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Enumerations | Functions
EwkTauDQM.h File Reference
#include "DQMServices/Core/interface/DQMEDAnalyzer.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 "DQMServices/Core/interface/MonitorElement.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

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

Author
Joshua Swanson
Enumerator
kAbsoluteIso 
kRelativeIso 
kUndefinedIso 

Definition at line 369 of file EwkTauDQM.h.

Function Documentation

double calcDeltaPhi ( double  ,
double   
)

Definition at line 1028 of file EwkTauDQM.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, and Pi.

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

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

Definition at line 1038 of file EwkTauDQM.cc.

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

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 }
double calcPzeta ( const reco::Candidate::LorentzVector ,
const reco::Candidate::LorentzVector ,
double  ,
double   
)

Definition at line 1048 of file EwkTauDQM.cc.

References funct::cos(), and funct::sin().

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

Definition at line 1013 of file EwkTauDQM.cc.

References kAbsoluteIso, kRelativeIso, and kUndefinedIso.

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

1013  {
1014  int isoMode_int;
1015  if (isoMode_string == "absoluteIso") {
1016  isoMode_int = kAbsoluteIso;
1017  } else if (isoMode_string == "relativeIso") {
1018  isoMode_int = kRelativeIso;
1019  } else {
1020  edm::LogError("getIsoMode")
1021  << " Failed to decode isoMode string = " << isoMode_string << " !!";
1022  isoMode_int = kUndefinedIso;
1023  error = 1;
1024  }
1025  return isoMode_int;
1026 }
const reco::GsfElectron* getTheElectron ( const reco::GsfElectronCollection ,
double  ,
double   
)

Definition at line 1104 of file EwkTauDQM.cc.

References Abs(), metsig::electron, passesElectronPreId(), and reco::LeafCandidate::pt().

Referenced by EwkElecTauHistManager::fillHistograms().

1106  {
1107  const reco::GsfElectron* theElectron = 0;
1108 
1109  for (reco::GsfElectronCollection::const_iterator electron = electrons.begin();
1110  electron != electrons.end(); ++electron) {
1111  if (TMath::Abs(electron->eta()) < electronEtaCut &&
1112  electron->pt() > electronPtCut && passesElectronPreId(*electron)) {
1113  if (theElectron == 0 || electron->pt() > theElectron->pt())
1114  theElectron = &(*electron);
1115  }
1116  }
1117 
1118  return theElectron;
1119 }
T Abs(T a)
Definition: MathUtil.h:49
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1074
virtual double pt() const final
transverse momentum
const reco::Muon* getTheMuon ( const reco::MuonCollection ,
double  ,
double   
)

Definition at line 1121 of file EwkTauDQM.cc.

References Abs(), metsig::muon, and reco::LeafCandidate::pt().

Referenced by EwkMuTauHistManager::fillHistograms().

1122  {
1123  const reco::Muon* theMuon = 0;
1124 
1125  for (reco::MuonCollection::const_iterator muon = muons.begin();
1126  muon != muons.end(); ++muon) {
1127  if (TMath::Abs(muon->eta()) < muonEtaCut && muon->pt() > muonPtCut) {
1128  if (theMuon == 0 || muon->pt() > theMuon->pt()) theMuon = &(*muon);
1129  }
1130  }
1131 
1132  return theMuon;
1133 }
T Abs(T a)
Definition: MathUtil.h:49
tuple muons
Definition: patZpeak.py:38
virtual double pt() const final
transverse momentum
const reco::PFTau* getTheTauJet ( const reco::PFTauCollection ,
double  ,
double  ,
int &   
)

Definition at line 1135 of file EwkTauDQM.cc.

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

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

1137  {
1138  const reco::PFTau* theTauJet = 0;
1139  theTauJetIndex = -1;
1140 
1141  int numTauJets = tauJets.size();
1142  for (int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1143  const reco::PFTau& tauJet = tauJets.at(iTauJet);
1144 
1145  if (fabs(tauJet.eta()) < tauJetEtaCut && tauJet.pt() > tauJetPtCut) {
1146  if (theTauJet == 0 || tauJet.pt() > theTauJet->pt()) {
1147  theTauJet = &tauJet;
1148  theTauJetIndex = iTauJet;
1149  }
1150  }
1151  }
1152 
1153  return theTauJet;
1154 }
virtual double eta() const final
momentum pseudorapidity
virtual double pt() const final
transverse momentum
double getVertexD0 ( const reco::Vertex ,
const reco::BeamSpot  
)

Definition at line 1156 of file EwkTauDQM.cc.

References reco::Vertex::x(), reco::BeamSpot::x0(), reco::Vertex::y(), and reco::BeamSpot::y0().

1156  {
1157  double dX = vertex.x() - beamSpot.x0();
1158  double dY = vertex.y() - beamSpot.y0();
1159  return TMath::Sqrt(dX * dX + dY * dY);
1160 }
bool passesElectronId ( const reco::GsfElectron )

Definition at line 1086 of file EwkTauDQM.cc.

References Abs(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::LeafCandidate::eta(), reco::GsfElectron::hcalOverEcal(), passesElectronPreId(), and reco::GsfElectron::sigmaEtaEta().

Referenced by EwkElecTauHistManager::fillHistograms().

1086  {
1088  ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL
1089  // endcap
1090  electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 &&
1091  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 &&
1092  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7) ||
1093  (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL
1094  // barrel
1095  electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 &&
1096  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 &&
1097  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8))) {
1098  return true;
1099  } else {
1100  return false;
1101  }
1102 }
T Abs(T a)
Definition: MathUtil.h:49
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1074
bool passesElectronPreId ( const reco::GsfElectron )

Definition at line 1074 of file EwkTauDQM.cc.

References Abs(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::LeafCandidate::eta(), and reco::GsfElectron::sigmaIetaIeta().

Referenced by getTheElectron(), and passesElectronId().

1074  {
1075  if ((TMath::Abs(electron.eta()) < 1.479 ||
1076  TMath::Abs(electron.eta()) > 1.566) && // cut ECAL barrel/endcap crack
1077  electron.deltaPhiSuperClusterTrackAtVtx() < 0.8 &&
1078  electron.deltaEtaSuperClusterTrackAtVtx() < 0.01 &&
1079  electron.sigmaIetaIeta() < 0.03) {
1080  return true;
1081  } else {
1082  return false;
1083  }
1084 }
T Abs(T a)
Definition: MathUtil.h:49
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 372 of file EwkTauDQM.h.

References edm::Event::getByLabel().

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

374  {
375  if (!evt.getByLabel(src, handle)) {
376  if (numWarnings < maxNumWarnings || maxNumWarnings == -1)
377  edm::LogWarning("readEventData") << errorMessage << " !!";
378  ++numWarnings;
379  error = true;
380  }
381 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413