CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

PFRecoTauDiscriminationByHPSSelection Class Reference

Inheritance diagram for PFRecoTauDiscriminationByHPSSelection:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Classes

struct  DecayModeCuts

Public Member Functions

double discriminate (const reco::PFTauRef &)
 PFRecoTauDiscriminationByHPSSelection (const edm::ParameterSet &pset)
 ~PFRecoTauDiscriminationByHPSSelection ()

Private Types

typedef std::map< IntPair,
DecayModeCuts
DecayModeCutMap
typedef std::pair< double, double > DoublePair
typedef std::pair< unsigned
int, unsigned int > 
IntPair
typedef StringObjectFunction
< reco::PFTau
TauFunc

Private Attributes

DecayModeCutMap decayModeCuts_
double matchingCone_
double minPt_
TauFunc signalConeFun_

Detailed Description

Definition at line 19 of file PFRecoTauDiscriminationByHPSSelection.cc.


Member Typedef Documentation

Definition at line 40 of file PFRecoTauDiscriminationByHPSSelection.cc.

typedef std::pair<double, double> PFRecoTauDiscriminationByHPSSelection::DoublePair [private]

Definition at line 39 of file PFRecoTauDiscriminationByHPSSelection.cc.

typedef std::pair<unsigned int, unsigned int> PFRecoTauDiscriminationByHPSSelection::IntPair [private]

Definition at line 38 of file PFRecoTauDiscriminationByHPSSelection.cc.

Definition at line 37 of file PFRecoTauDiscriminationByHPSSelection.cc.


Constructor & Destructor Documentation

PFRecoTauDiscriminationByHPSSelection::PFRecoTauDiscriminationByHPSSelection ( const edm::ParameterSet pset) [explicit]

Definition at line 48 of file PFRecoTauDiscriminationByHPSSelection.cc.

References PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::assumeStripMass_, hpstanc_transforms::cuts, decayModeCuts_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), matchingCone_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxPi0Mass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minPi0Mass_, and minPt_.

                                :PFTauDiscriminationProducerBase(pset),
    signalConeFun_(pset.getParameter<std::string>("coneSizeFormula")) {
  // Get the matchign cut
  matchingCone_ = pset.getParameter<double>("matchingCone");
  minPt_ = pset.getParameter<double>("minTauPt");
  // Get the mass cuts for each decay mode
  typedef std::vector<edm::ParameterSet> VPSet;
  const VPSet& decayModes = pset.getParameter<VPSet>("decayModes");
  BOOST_FOREACH(const edm::ParameterSet &dm, decayModes) {
    // The mass window(s)
    DecayModeCuts cuts;
    cuts.minMass_ = dm.getParameter<double>("minMass");
    cuts.maxMass_ = dm.getParameter<double>("maxMass");
    if (dm.exists("minPi0Mass")) {
      cuts.minPi0Mass_ = dm.getParameter<double>("minPi0Mass");
      cuts.maxPi0Mass_ = dm.getParameter<double>("maxPi0Mass");
    } else {
      cuts.minPi0Mass_ = -1.0;
      cuts.maxPi0Mass_ = 1e9;
    }
    if (dm.exists("assumeStripMass")) {
      cuts.assumeStripMass_ = dm.getParameter<double>("assumeStripMass");
    } else {
      cuts.assumeStripMass_ = -1.0;
    }
    decayModeCuts_.insert(std::make_pair(
            // The decay mode as a key
            std::make_pair(
                dm.getParameter<uint32_t>("nCharged"),
                dm.getParameter<uint32_t>("nPiZeros")),
            cuts
          ));
  }
}
PFRecoTauDiscriminationByHPSSelection::~PFRecoTauDiscriminationByHPSSelection ( ) [inline]

Definition at line 25 of file PFRecoTauDiscriminationByHPSSelection.cc.

{}

Member Function Documentation

double PFRecoTauDiscriminationByHPSSelection::discriminate ( const reco::PFTauRef tau)

Definition at line 85 of file PFRecoTauDiscriminationByHPSSelection.cc.

References PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::assumeStripMass_, decayModeCuts_, deltaR(), matchingCone_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::maxPi0Mass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minMass_, PFRecoTauDiscriminationByHPSSelection::DecayModeCuts::minPi0Mass_, minPt_, reco::LeafCandidate::p4(), and signalConeFun_.

                                                                           {
  // Check if we pass the min pt
  if (tau->pt() < minPt_)
    return 0.0;

  // See if we select this decay mode
  DecayModeCutMap::const_iterator massWindowIter =
      decayModeCuts_.find(std::make_pair(tau->signalPFChargedHadrCands().size(),
                                         tau->signalPiZeroCandidates().size()));
  // Check if decay mode is supported
  if (massWindowIter == decayModeCuts_.end()) {
    return 0.0;
  }
  const DecayModeCuts &massWindow = massWindowIter->second;

  math::XYZTLorentzVector tauP4 = tau->p4();
  // Find the total pizero p4
  reco::Candidate::LorentzVector stripsP4;
  BOOST_FOREACH(const reco::RecoTauPiZero& cand, 
      tau->signalPiZeroCandidates()){
    math::XYZTLorentzVector candP4 = cand.p4();
    stripsP4 += candP4;
  }

  // Apply strip mass assumption corrections
  if (massWindow.assumeStripMass_ >= 0) {
    BOOST_FOREACH(const reco::RecoTauPiZero& cand, 
        tau->signalPiZeroCandidates()){
      math::XYZTLorentzVector uncorrected = cand.p4();
      math::XYZTLorentzVector corrected = 
        applyMassConstraint(uncorrected, massWindow.assumeStripMass_);
      math::XYZTLorentzVector correction = corrected - uncorrected;
      tauP4 += correction;
      stripsP4 += correction;
    }
  }

  // Check if tau fails mass cut
  if (tauP4.M() > massWindow.maxMass_ || tauP4.M() < massWindow.minMass_) {
    return 0.0;
  }

  // Check if it fails the pi 0 IM cut
  if (stripsP4.M() > massWindow.maxPi0Mass_ ||
      stripsP4.M() < massWindow.minPi0Mass_) {
    return 0.0;
  }

  // Check if tau passes matching cone cut
  if (deltaR(tauP4, tau->jetRef()->p4()) > matchingCone_) {
    return 0.0;
  }

  // Check if tau passes cone cut
  double cone_size = signalConeFun_(*tau);
  // Check if any charged objects fail the signal cone cut
  BOOST_FOREACH(const reco::PFCandidateRef& cand,
                tau->signalPFChargedHadrCands()) {
    if (deltaR(cand->p4(), tauP4) > cone_size)
      return 0.0;
  }
  // Now check the pizeros
  BOOST_FOREACH(const reco::RecoTauPiZero& cand,
                tau->signalPiZeroCandidates()) {
    if (deltaR(cand.p4(), tauP4) > cone_size)
      return 0.0;
  }

  // Otherwise, we pass!
  return 1.0;
}

Member Data Documentation

Definition at line 42 of file PFRecoTauDiscriminationByHPSSelection.cc.

Referenced by discriminate().