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 "FWCore/Framework/interface/EDAnalyzer.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 378 of file EwkTauDQM.h.

Function Documentation

double calcDeltaPhi ( double  ,
double   
)

Definition at line 1120 of file EwkTauDQM.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, and Pi.

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

1120  {
1121  double deltaPhi = phi1 - phi2;
1122 
1123  if (deltaPhi < 0.) deltaPhi = -deltaPhi;
1124 
1125  if (deltaPhi > TMath::Pi()) deltaPhi = 2 * TMath::Pi() - deltaPhi;
1126 
1127  return deltaPhi;
1128 }
const double Pi
double calcMt ( double  ,
double  ,
double  ,
double   
)

Definition at line 1130 of file EwkTauDQM.cc.

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

1130  {
1131  double pt1 = TMath::Sqrt(px1 * px1 + py1 * py1);
1132  double pt2 = TMath::Sqrt(px2 * px2 + py2 * py2);
1133 
1134  double p1Dotp2 = px1 * px2 + py1 * py2;
1135  double cosAlpha = p1Dotp2 / (pt1 * pt2);
1136 
1137  return TMath::Sqrt(2 * pt1 * pt2 * (1 - cosAlpha));
1138 }
double calcPzeta ( const reco::Candidate::LorentzVector ,
const reco::Candidate::LorentzVector ,
double  ,
double   
)

Definition at line 1140 of file EwkTauDQM.cc.

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

1142  {
1143  double cosPhi1 = cos(p1.phi());
1144  double sinPhi1 = sin(p1.phi());
1145  double cosPhi2 = cos(p2.phi());
1146  double sinPhi2 = sin(p2.phi());
1147  double zetaX = cosPhi1 + cosPhi2;
1148  double zetaY = sinPhi1 + sinPhi2;
1149  double zetaR = TMath::Sqrt(zetaX * zetaX + zetaY * zetaY);
1150  if (zetaR > 0.) {
1151  zetaX /= zetaR;
1152  zetaY /= zetaR;
1153  }
1154 
1155  double pxVis = p1.px() + p2.px();
1156  double pyVis = p1.py() + p2.py();
1157  double pZetaVis = pxVis * zetaX + pyVis * zetaY;
1158 
1159  double px = pxVis + pxMEt;
1160  double py = pyVis + pyMEt;
1161  double pZeta = px * zetaX + py * zetaY;
1162 
1163  return pZeta - 1.5 * pZetaVis;
1164 }
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 1101 of file EwkTauDQM.cc.

References kAbsoluteIso, kRelativeIso, and kUndefinedIso.

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

1101  {
1102  int isoMode_int;
1103  if (isoMode_string == "absoluteIso") {
1104  isoMode_int = kAbsoluteIso;
1105  } else if (isoMode_string == "relativeIso") {
1106  isoMode_int = kRelativeIso;
1107  } else {
1108  edm::LogError("getIsoMode") << " Failed to decode isoMode string = "
1109  << isoMode_string << " !!";
1110  isoMode_int = kUndefinedIso;
1111  error = 1;
1112  }
1113  return isoMode_int;
1114 }
const reco::GsfElectron* getTheElectron ( const reco::GsfElectronCollection ,
double  ,
double   
)

Definition at line 1204 of file EwkTauDQM.cc.

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

Referenced by EwkElecTauHistManager::fillHistograms().

1206  {
1207  const reco::GsfElectron* theElectron = 0;
1208 
1209  for (reco::GsfElectronCollection::const_iterator electron = electrons.begin();
1210  electron != electrons.end(); ++electron) {
1211  if (TMath::Abs(electron->eta()) < electronEtaCut &&
1212  electron->pt() > electronPtCut && passesElectronPreId(*electron)) {
1213  if (theElectron == 0 || electron->pt() > theElectron->pt())
1214  theElectron = &(*electron);
1215  }
1216  }
1217 
1218  return theElectron;
1219 }
virtual float pt() const
transverse momentum
T Abs(T a)
Definition: MathUtil.h:49
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1170
const reco::Muon* getTheMuon ( const reco::MuonCollection ,
double  ,
double   
)

Definition at line 1221 of file EwkTauDQM.cc.

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

Referenced by EwkMuTauHistManager::fillHistograms().

1222  {
1223  const reco::Muon* theMuon = 0;
1224 
1225  for (reco::MuonCollection::const_iterator muon = muons.begin();
1226  muon != muons.end(); ++muon) {
1227  if (TMath::Abs(muon->eta()) < muonEtaCut && muon->pt() > muonPtCut) {
1228  if (theMuon == 0 || muon->pt() > theMuon->pt()) theMuon = &(*muon);
1229  }
1230  }
1231 
1232  return theMuon;
1233 }
virtual float 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 ,
double  ,
double  ,
int &   
)

Definition at line 1235 of file EwkTauDQM.cc.

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

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

1237  {
1238  const reco::PFTau* theTauJet = 0;
1239  theTauJetIndex = -1;
1240 
1241  int numTauJets = tauJets.size();
1242  for (int iTauJet = 0; iTauJet < numTauJets; ++iTauJet) {
1243  const reco::PFTau& tauJet = tauJets.at(iTauJet);
1244 
1245  if (fabs(tauJet.eta()) < tauJetEtaCut && tauJet.pt() > tauJetPtCut) {
1246  if (theTauJet == 0 || tauJet.pt() > theTauJet->pt()) {
1247  theTauJet = &tauJet;
1248  theTauJetIndex = iTauJet;
1249  }
1250  }
1251  }
1252 
1253  return theTauJet;
1254 }
virtual float pt() const
transverse momentum
virtual float eta() const
momentum pseudorapidity
double getVertexD0 ( const reco::Vertex ,
const reco::BeamSpot  
)

Definition at line 1260 of file EwkTauDQM.cc.

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

1260  {
1261  double dX = vertex.x() - beamSpot.x0();
1262  double dY = vertex.y() - beamSpot.y0();
1263  return TMath::Sqrt(dX * dX + dY * dY);
1264 }
bool passesElectronId ( const reco::GsfElectron )

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

1182  {
1184  ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL
1185  // endcap
1186  electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 &&
1187  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 &&
1188  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7) ||
1189  (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL
1190  // barrel
1191  electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 &&
1192  TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 &&
1193  TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8))) {
1194  return true;
1195  } else {
1196  return false;
1197  }
1198 }
T Abs(T a)
Definition: MathUtil.h:49
bool passesElectronPreId(const reco::GsfElectron &electron)
Definition: EwkTauDQM.cc:1170
bool passesElectronPreId ( const reco::GsfElectron )

Definition at line 1170 of file EwkTauDQM.cc.

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

Referenced by getTheElectron(), and passesElectronId().

1170  {
1171  if ((TMath::Abs(electron.eta()) < 1.479 ||
1172  TMath::Abs(electron.eta()) > 1.566) && // cut ECAL barrel/endcap crack
1173  electron.deltaPhiSuperClusterTrackAtVtx() < 0.8 &&
1174  electron.deltaEtaSuperClusterTrackAtVtx() < 0.01 &&
1175  electron.sigmaIetaIeta() < 0.03) {
1176  return true;
1177  } else {
1178  return false;
1179  }
1180 }
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 385 of file EwkTauDQM.h.

References edm::Event::getByLabel().

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

387  {
388  if (!evt.getByLabel(src, handle)) {
389  if (numWarnings < maxNumWarnings || maxNumWarnings == -1)
390  edm::LogWarning("readEventData") << errorMessage << " !!";
391  ++numWarnings;
392  error = true;
393  }
394 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:402