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::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Classes

struct  DecayModeCuts

Public Member Functions

double discriminate (const reco::PFTauRef &)
 PFRecoTauDiscriminationByHPSSelection (const edm::ParameterSet &)
 ~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 44 of file PFRecoTauDiscriminationByHPSSelection.cc.

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

Definition at line 43 of file PFRecoTauDiscriminationByHPSSelection.cc.

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

Definition at line 42 of file PFRecoTauDiscriminationByHPSSelection.cc.

Definition at line 27 of file PFRecoTauDiscriminationByHPSSelection.cc.


Constructor & Destructor Documentation

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

Definition at line 52 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_, minPt_, and AlCaHLTBitMon_QueryRunRegistry::string.

  : 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_ = new TauFunc(dm.getParameter<std::string>("maxMass"));
    if (dm.exists("minPi0Mass")) {
      cuts.minPi0Mass_ = dm.getParameter<double>("minPi0Mass");
      cuts.maxPi0Mass_ = dm.getParameter<double>("maxPi0Mass");
    } else {
      cuts.minPi0Mass_ = -1.e3;
      cuts.maxPi0Mass_ = 1.e9;
    }
    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 ( )

Definition at line 89 of file PFRecoTauDiscriminationByHPSSelection.cc.

References decayModeCuts_.

{
  for ( DecayModeCutMap::iterator it = decayModeCuts_.begin();
        it != decayModeCuts_.end(); ++it ) {
    delete it->second.maxMass_;
  }
}

Member Function Documentation

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

Definition at line 98 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_.

{
  //std::cout << "<PFRecoTauDiscriminationByHPSSelection::discriminate>:" << std::endl;

  // 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();
  //std::cout << "tau: Pt = " << tauP4.pt() << ", eta = " << tauP4.eta() << ", phi = " << tauP4.phi() << ", mass = " << tauP4.mass() << std::endl;
  // 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;
    }
  }
  //std::cout << "strips: Pt = " << stripsP4.pt() << ", eta = " << stripsP4.eta() << ", phi = " << stripsP4.phi() << ", mass = " << stripsP4.mass() << std::endl;

  // Check if tau fails mass cut
  double maxMass_value = (*massWindow.maxMass_)(*tau);
  if (tauP4.M() > maxMass_value || 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
  //std::cout << "dR(tau, jet) = " << deltaR(tauP4, tau->jetRef()->p4()) << std::endl;
  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()) {
    //std::cout << "dR(tau, signalPFChargedHadr) = " << deltaR(cand->p4(), tauP4) << std::endl;
    if (deltaR(cand->p4(), tauP4) > cone_size)
      return 0.0;
  }
  // Now check the pizeros
  BOOST_FOREACH(const reco::RecoTauPiZero& cand,
                tau->signalPiZeroCandidates()) {
    //std::cout << "dR(tau, signalPiZero) = " << deltaR(cand.p4(), tauP4) << std::endl;
    if (deltaR(cand.p4(), tauP4) > cone_size)
      return 0.0;
  }

  // Otherwise, we pass!
  return 1.0;
}

Member Data Documentation

Definition at line 46 of file PFRecoTauDiscriminationByHPSSelection.cc.

Referenced by discriminate().