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 972 of file EwkTauDQM.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, and Pi.

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

973 {
974  double deltaPhi = phi1 - phi2;
975 
976  if ( deltaPhi < 0. ) deltaPhi = -deltaPhi;
977 
978  if ( deltaPhi > TMath::Pi() ) deltaPhi = 2*TMath::Pi() - deltaPhi;
979 
980  return deltaPhi;
981 }
const double Pi
double calcMt ( double  px1,
double  py1,
double  px2,
double  py2 
)

Definition at line 983 of file EwkTauDQM.cc.

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

984 {
985  double pt1 = TMath::Sqrt(px1*px1 + py1*py1);
986  double pt2 = TMath::Sqrt(px2*px2 + py2*py2);
987 
988  double p1Dotp2 = px1*px2 + py1*py2;
989  double cosAlpha = p1Dotp2/(pt1*pt2);
990 
991  return TMath::Sqrt(2*pt1*pt2*(1 - cosAlpha));
992 }
double calcPzeta ( const reco::Candidate::LorentzVector p1,
const reco::Candidate::LorentzVector p2,
double  pxMEt,
double  pyMEt 
)

Definition at line 994 of file EwkTauDQM.cc.

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

995 {
996  double cosPhi1 = cos(p1.phi());
997  double sinPhi1 = sin(p1.phi());
998  double cosPhi2 = cos(p2.phi());
999  double sinPhi2 = sin(p2.phi());
1000  double zetaX = cosPhi1 + cosPhi2;
1001  double zetaY = sinPhi1 + sinPhi2;
1002  double zetaR = TMath::Sqrt(zetaX*zetaX + zetaY*zetaY);
1003  if ( zetaR > 0. ) {
1004  zetaX /= zetaR;
1005  zetaY /= zetaR;
1006  }
1007 
1008  double pxVis = p1.px() + p2.px();
1009  double pyVis = p1.py() + p2.py();
1010  double pZetaVis = pxVis*zetaX + pyVis*zetaY;
1011 
1012  double px = pxVis + pxMEt;
1013  double py = pyVis + pyMEt;
1014  double pZeta = px*zetaX + py*zetaY;
1015 
1016  return pZeta - 1.5*pZetaVis;
1017 }
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 != "" && dirName.find_last_of(dqmSeparator) != (dirName.length() - 1) ) dirName.append(dqmSeparator);
16  dirName.append(dqmSubDirectory);
17  return dirName;
18 }
const std::string dqmRootDirectory
const std::string dqmSeparator
Definition: EwkTauDQM.cc:8
int getIsoMode ( const std::string &  isoMode_string,
int &  error 
)

Definition at line 953 of file EwkTauDQM.cc.

References kAbsoluteIso, kRelativeIso, and kUndefinedIso.

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

954 {
955  int isoMode_int;
956  if ( isoMode_string == "absoluteIso" ) {
957  isoMode_int = kAbsoluteIso;
958  } else if ( isoMode_string == "relativeIso" ) {
959  isoMode_int = kRelativeIso;
960  } else {
961  edm::LogError ("getIsoMode") << " Failed to decode isoMode string = " << isoMode_string << " !!";
962  isoMode_int = kUndefinedIso;
963  error = 1;
964  }
965  return isoMode_int;
966 }
const reco::GsfElectron* getTheElectron ( const reco::GsfElectronCollection electrons,
double  electronEtaCut,
double  electronPtCut 
)

Definition at line 1056 of file EwkTauDQM.cc.

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

Referenced by EwkElecTauHistManager::fillHistograms().

1057 {
1058  const reco::GsfElectron* theElectron = 0;
1059 
1060  for ( reco::GsfElectronCollection::const_iterator electron = electrons.begin();
1061  electron != electrons.end(); ++electron ) {
1062  if ( TMath::Abs(electron->eta()) < electronEtaCut && electron->pt() > electronPtCut && passesElectronPreId(*electron) ) {
1063  if ( theElectron == 0 || electron->pt() > theElectron->pt() ) theElectron = &(*electron);
1064  }
1065  }
1066 
1067  return theElectron;
1068 }
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1023
virtual float pt() const GCC11_FINAL
transverse momentum
const reco::Muon* getTheMuon ( const reco::MuonCollection muons,
double  muonEtaCut,
double  muonPtCut 
)

Definition at line 1073 of file EwkTauDQM.cc.

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

Referenced by EwkMuTauHistManager::fillHistograms().

1074 {
1075  const reco::Muon* theMuon = 0;
1076 
1077  for ( reco::MuonCollection::const_iterator muon = muons.begin();
1078  muon != muons.end(); ++muon ) {
1079  if ( TMath::Abs(muon->eta()) < muonEtaCut && muon->pt() > muonPtCut ) {
1080  if ( theMuon == 0 || muon->pt() > theMuon->pt() ) theMuon = &(*muon);
1081  }
1082  }
1083 
1084  return theMuon;
1085 }
tuple muons
Definition: patZpeak.py:38
virtual float pt() const GCC11_FINAL
transverse momentum
const reco::PFTau* getTheTauJet ( const reco::PFTauCollection tauJets,
double  tauJetEtaCut,
double  tauJetPtCut,
int &  theTauJetIndex 
)

Definition at line 1087 of file EwkTauDQM.cc.

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

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

1088 {
1089  const reco::PFTau* theTauJet = 0;
1090  theTauJetIndex = -1;
1091 
1092  int numTauJets = tauJets.size();
1093  for ( int iTauJet = 0; iTauJet < numTauJets; ++iTauJet ) {
1094  const reco::PFTau& tauJet = tauJets.at(iTauJet);
1095 
1096  if ( fabs(tauJet.eta()) < tauJetEtaCut && tauJet.pt() > tauJetPtCut ) {
1097  if ( theTauJet == 0 || tauJet.pt() > theTauJet->pt() ) {
1098  theTauJet = &tauJet;
1099  theTauJetIndex = iTauJet;
1100  }
1101  }
1102  }
1103 
1104  return theTauJet;
1105 }
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
virtual float pt() const GCC11_FINAL
transverse momentum
double getVertexD0 ( const reco::Vertex vertex,
const reco::BeamSpot beamSpot 
)

Definition at line 1111 of file EwkTauDQM.cc.

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

1112 {
1113  double dX = vertex.x() - beamSpot.x0();
1114  double dY = vertex.y() - beamSpot.y0();
1115  return TMath::Sqrt(dX*dX + dY*dY);
1116 }
double y() const
y coordinate
Definition: Vertex.h:97
double x() const
x coordinate
Definition: Vertex.h:95
double y0() const
y coordinate
Definition: BeamSpot.h:67
double x0() const
x coordinate
Definition: BeamSpot.h:65
bool passesElectronId ( const reco::GsfElectron electron)

Definition at line 1035 of file EwkTauDQM.cc.

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

Referenced by EwkElecTauHistManager::fillHistograms().

1036 {
1037  if ( passesElectronPreId(electron) &&
1038  ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL endcap
1039  electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 &&
1040  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 &&
1041  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7 ) ||
1042  (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL barrel
1043  electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 &&
1044  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 &&
1045  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8)) ) {
1046  return true;
1047  } else {
1048  return false;
1049  }
1050 }
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
float hcalOverEcal() const
Definition: GsfElectron.h:390
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1023
float sigmaEtaEta() const
Definition: GsfElectron.h:381
bool passesElectronPreId ( const reco::GsfElectron electron)

Definition at line 1023 of file EwkTauDQM.cc.

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

Referenced by getTheElectron(), and passesElectronId().

1024 {
1025  if ( (TMath::Abs(electron.eta()) < 1.479 || TMath::Abs(electron.eta()) > 1.566) && // cut ECAL barrel/endcap crack
1026  electron.deltaPhiSuperClusterTrackAtVtx() < 0.8 &&
1027  electron.deltaEtaSuperClusterTrackAtVtx() < 0.01 &&
1028  electron.sigmaIetaIeta() < 0.03 ) {
1029  return true;
1030  } else {
1031  return false;
1032  }
1033 }
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
float sigmaIetaIeta() const
Definition: GsfElectron.h:382
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
virtual float eta() const GCC11_FINAL
momentum pseudorapidity

Variable Documentation

const std::string dqmSeparator = "/"