CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

double calcDeltaPhi ( double  phi1,
double  phi2 
)

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  px1,
double  py1,
double  px2,
double  py2 
)

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 p1,
const reco::Candidate::LorentzVector p2,
double  pxMEt,
double  pyMEt 
)

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
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, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

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 electrons,
double  electronEtaCut,
double  electronPtCut 
)

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 }
virtual double pt() const
transverse momentum
T Abs(T a)
Definition: MathUtil.h:49
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1074
const reco::Muon* getTheMuon ( const reco::MuonCollection muons,
double  muonEtaCut,
double  muonPtCut 
)

Definition at line 1121 of file EwkTauDQM.cc.

References Abs(), digitizers_cfi::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 }
virtual double pt() const
transverse momentum
T Abs(T a)
Definition: MathUtil.h:49
tuple muons
Definition: patZpeak.py:38
const reco::PFTau* getTheTauJet ( const reco::PFTauCollection tauJets,
double  tauJetEtaCut,
double  tauJetPtCut,
int &  theTauJetIndex 
)

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
momentum pseudorapidity
virtual double pt() const
transverse momentum
double getVertexD0 ( const reco::Vertex vertex,
const reco::BeamSpot 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 }
double y() const
y coordinate
Definition: Vertex.h:110
double x() const
x coordinate
Definition: Vertex.h:108
double y0() const
y coordinate
Definition: BeamSpot.h:66
double x0() const
x coordinate
Definition: BeamSpot.h:64
bool passesElectronId ( const reco::GsfElectron electron)

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  {
1087  if (passesElectronPreId(electron) &&
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 }
virtual double eta() const
momentum pseudorapidity
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:247
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:250
T Abs(T a)
Definition: MathUtil.h:49
float hcalOverEcal() const
Definition: GsfElectron.h:410
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1074
float sigmaEtaEta() const
Definition: GsfElectron.h:401
bool passesElectronPreId ( const reco::GsfElectron electron)

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 }
virtual double eta() const
momentum pseudorapidity
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:247
float sigmaIetaIeta() const
Definition: GsfElectron.h:402
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:250
T Abs(T a)
Definition: MathUtil.h:49

Variable Documentation

const std::string dqmSeparator = "/"