CMS 3D CMS Logo

Functions | Variables

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/Physics/src/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(), EwkMuTauHistManager::fillHistograms(), and EwkElecTauHistManager::fillHistograms().

{
  double deltaPhi = phi1 - phi2;

  if ( deltaPhi < 0. ) deltaPhi = -deltaPhi;

  if ( deltaPhi > TMath::Pi() ) deltaPhi = 2*TMath::Pi() - deltaPhi;

  return deltaPhi;
}
double calcMt ( double  px1,
double  py1,
double  px2,
double  py2 
)

Definition at line 983 of file EwkTauDQM.cc.

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

{
  double pt1 = TMath::Sqrt(px1*px1 + py1*py1);
  double pt2 = TMath::Sqrt(px2*px2 + py2*py2);

  double p1Dotp2 = px1*px2 + py1*py2;
  double cosAlpha = p1Dotp2/(pt1*pt2);

  return TMath::Sqrt(2*pt1*pt2*(1 - cosAlpha));
}
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().

{
  double cosPhi1 = cos(p1.phi());
  double sinPhi1 = sin(p1.phi());
  double cosPhi2 = cos(p2.phi());
  double sinPhi2 = sin(p2.phi());
  double zetaX = cosPhi1 + cosPhi2;
  double zetaY = sinPhi1 + sinPhi2;
  double zetaR = TMath::Sqrt(zetaX*zetaX + zetaY*zetaY);
  if ( zetaR > 0. ) {
    zetaX /= zetaR;
    zetaY /= zetaR;
  }

  double pxVis = p1.px() + p2.px();
  double pyVis = p1.py() + p2.py();
  double pZetaVis = pxVis*zetaX + pyVis*zetaY;

  double px = pxVis + pxMEt;
  double py = pyVis + pyMEt;
  double pZeta = px*zetaX + py*zetaY;

  return pZeta - 1.5*pZetaVis;
}
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, and dqmSeparator.

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

{
//--- concatenate names of dqmRootDirectory and dqmSubDirectory;
//    add "/" separator inbetween if necessary
  std::string dirName = dqmRootDirectory;
  if ( dirName != "" && dirName.find_last_of(dqmSeparator) != (dirName.length() - 1) )  dirName.append(dqmSeparator);
  dirName.append(dqmSubDirectory);
  return dirName;
}
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().

{
  int isoMode_int;
  if ( isoMode_string == "absoluteIso" ) {
    isoMode_int = kAbsoluteIso;
  } else if ( isoMode_string == "relativeIso" ) {
    isoMode_int = kRelativeIso;
  } else { 
    edm::LogError ("getIsoMode") << " Failed to decode isoMode string = " << isoMode_string << " !!";
    isoMode_int = kUndefinedIso;
    error = 1;
  }
  return isoMode_int;
}
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().

{
  const reco::GsfElectron* theElectron = 0;
  
  for ( reco::GsfElectronCollection::const_iterator electron = electrons.begin();
        electron != electrons.end(); ++electron ) {
    if ( TMath::Abs(electron->eta()) < electronEtaCut && electron->pt() > electronPtCut && passesElectronPreId(*electron) ) {
      if ( theElectron == 0 || electron->pt() > theElectron->pt() ) theElectron = &(*electron);
    }
  }
  
  return theElectron;
}
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().

{
  const reco::Muon* theMuon = 0;

  for ( reco::MuonCollection::const_iterator muon = muons.begin();
        muon != muons.end(); ++muon ) {
    if ( TMath::Abs(muon->eta()) < muonEtaCut && muon->pt() > muonPtCut ) {
      if ( theMuon == 0 || muon->pt() > theMuon->pt() ) theMuon = &(*muon);
    }
  }

  return theMuon;
}
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 EwkMuTauHistManager::fillHistograms(), and EwkElecTauHistManager::fillHistograms().

{
  const reco::PFTau* theTauJet = 0;
  theTauJetIndex = -1;

  int numTauJets = tauJets.size();
  for ( int iTauJet = 0; iTauJet < numTauJets; ++iTauJet ) {
    const reco::PFTau& tauJet = tauJets.at(iTauJet);

    if ( fabs(tauJet.eta()) < tauJetEtaCut && tauJet.pt() > tauJetPtCut ) {
      if ( theTauJet == 0 || tauJet.pt() > theTauJet->pt() ) {
        theTauJet = &tauJet;
        theTauJetIndex = iTauJet;
      }
    }
  }

  return theTauJet;
}
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().

{
  double dX = vertex.x() - beamSpot.x0();
  double dY = vertex.y() - beamSpot.y0();
  return TMath::Sqrt(dX*dX + dY*dY);
}
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().

{
  if ( passesElectronPreId(electron) &&
       ((TMath::Abs(electron.eta()) > 1.566 && // electron reconstructed in ECAL endcap
         electron.sigmaEtaEta() < 0.03 && electron.hcalOverEcal() < 0.05 && 
         TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.009 && 
         TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.7 ) ||
        (TMath::Abs(electron.eta()) < 1.479 && // electron reconstructed in ECAL barrel
         electron.sigmaEtaEta() < 0.01 && electron.hcalOverEcal() < 0.12 && 
         TMath::Abs(electron.deltaEtaSuperClusterTrackAtVtx()) < 0.007 && 
         TMath::Abs(electron.deltaPhiSuperClusterTrackAtVtx()) < 0.8)) ) {
    return true;
  } else {
    return false;
  }
}
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().

{
  if ( (TMath::Abs(electron.eta()) < 1.479 || TMath::Abs(electron.eta()) > 1.566) && // cut ECAL barrel/endcap crack
       electron.deltaPhiSuperClusterTrackAtVtx() < 0.8 &&
       electron.deltaEtaSuperClusterTrackAtVtx() < 0.01 &&
       electron.sigmaIetaIeta() < 0.03 ) {
    return true;
  } else {
    return false;
  }
}

Variable Documentation

const std::string dqmSeparator = "/"