Public Member Functions | |
void | beginEvent (const edm::Event &, const edm::EventSetup &) |
double | discriminate (const reco::PFTauRef &) |
PFRecoTauDiscriminationAgainstMuon2 (const edm::ParameterSet &cfg) | |
~PFRecoTauDiscriminationAgainstMuon2 () | |
Private Types | |
enum | { kLoose, kMedium, kTight, kCustom } |
Private Attributes | |
int | discriminatorOption_ |
bool | doCaloMuonVeto_ |
double | dRmuonMatch_ |
double | hop_ |
int | maxNumberOfHitsLast2Stations_ |
int | maxNumberOfMatches_ |
std::string | moduleLabel_ |
edm::Handle< reco::MuonCollection > | muons_ |
edm::InputTag | srcMuons_ |
int | verbosity_ |
Compute tau Id. discriminator against muons.
Definition at line 31 of file PFRecoTauDiscriminationAgainstMuon2.cc.
anonymous enum [private] |
PFRecoTauDiscriminationAgainstMuon2::PFRecoTauDiscriminationAgainstMuon2 | ( | const edm::ParameterSet & | cfg | ) | [inline, explicit] |
Definition at line 35 of file PFRecoTauDiscriminationAgainstMuon2.cc.
References discriminatorOption_, doCaloMuonVeto_, dRmuonMatch_, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), hop_, kCustom, kLoose, kMedium, kTight, maxNumberOfHitsLast2Stations_, maxNumberOfMatches_, srcMuons_, AlCaHLTBitMon_QueryRunRegistry::string, edm::errors::UnimplementedFeature, and verbosity_.
: PFTauDiscriminationProducerBase(cfg), moduleLabel_(cfg.getParameter<std::string>("@module_label")) { std::string discriminatorOption_string = cfg.getParameter<std::string>("discriminatorOption"); if ( discriminatorOption_string == "loose" ) discriminatorOption_ = kLoose; else if ( discriminatorOption_string == "medium" ) discriminatorOption_ = kMedium; else if ( discriminatorOption_string == "tight" ) discriminatorOption_ = kTight; else if ( discriminatorOption_string == "custom" ) discriminatorOption_ = kCustom; else throw edm::Exception(edm::errors::UnimplementedFeature) << " Invalid Configuration parameter 'discriminatorOption' = " << discriminatorOption_string << " !!\n"; hop_ = cfg.getParameter<double>("HoPMin"); maxNumberOfMatches_ = cfg.exists("maxNumberOfMatches") ? cfg.getParameter<int>("maxNumberOfMatches"): 0; doCaloMuonVeto_ = cfg.exists("doCaloMuonVeto") ? cfg.getParameter<bool>("doCaloMuonVeto"): false; maxNumberOfHitsLast2Stations_ = cfg.exists("maxNumberOfHitsLast2Stations") ? cfg.getParameter<int>("maxNumberOfHitsLast2Stations"): 0; if ( cfg.exists("srcMuons") ) { srcMuons_ = cfg.getParameter<edm::InputTag>("srcMuons"); dRmuonMatch_ = cfg.getParameter<double>("dRmuonMatch"); } verbosity_ = cfg.exists("verbosity") ? cfg.getParameter<int>("verbosity") : 0; }
PFRecoTauDiscriminationAgainstMuon2::~PFRecoTauDiscriminationAgainstMuon2 | ( | ) | [inline] |
Definition at line 56 of file PFRecoTauDiscriminationAgainstMuon2.cc.
{}
void PFRecoTauDiscriminationAgainstMuon2::beginEvent | ( | const edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.
Definition at line 75 of file PFRecoTauDiscriminationAgainstMuon2.cc.
References edm::Event::getByLabel(), edm::InputTag::label(), muons_, and srcMuons_.
{ if ( srcMuons_.label() != "" ) { evt.getByLabel(srcMuons_, muons_); } }
double PFRecoTauDiscriminationAgainstMuon2::discriminate | ( | const reco::PFTauRef & | pfTau | ) |
Definition at line 117 of file PFRecoTauDiscriminationAgainstMuon2.cc.
References gather_cfg::cout, deltaR(), discriminatorOption_, doCaloMuonVeto_, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, dRmuonMatch_, edm::Ref< C, T, F >::get(), hop_, edm::Ref< C, T, F >::isNonnull(), kCustom, edm::Ref< C, T, F >::key(), kLoose, kMedium, kTight, edm::InputTag::label(), singlePfTauSkim_cff::leadTrack, maxNumberOfHitsLast2Stations_, maxNumberOfMatches_, moduleLabel_, metsig::muon, muons_, reco::Muon::NoArbitration, patZpeak::numMuons, reco::TrackBase::p(), srcMuons_, and verbosity_.
{ if ( verbosity_ ) { std::cout << "<PFRecoTauDiscriminationAgainstMuon2::discriminate>:" << std::endl; std::cout << " moduleLabel = " << moduleLabel_ << std::endl; std::cout << "tau #" << pfTau.key() << ": Pt = " << pfTau->pt() << ", eta = " << pfTau->eta() << ", phi = " << pfTau->phi() << std::endl; } int numMatches = 0; std::vector<int> numHitsDT(4); std::vector<int> numHitsCSC(4); std::vector<int> numHitsRPC(4); for ( int iStation = 0; iStation < 4; ++iStation ) { numHitsDT[iStation] = 0; numHitsCSC[iStation] = 0; numHitsRPC[iStation] = 0; } const reco::PFCandidateRef& pfLeadChargedHadron = pfTau->leadPFChargedHadrCand(); if ( pfLeadChargedHadron.isNonnull() ) { reco::MuonRef muonRef = pfLeadChargedHadron->muonRef(); if ( muonRef.isNonnull() ) { if ( verbosity_ ) std::cout << " has muonRef." << std::endl; numMatches = muonRef->numberOfMatches(reco::Muon::NoArbitration); countHits(*muonRef, numHitsDT, numHitsCSC, numHitsRPC); } } if ( srcMuons_.label() != "" ) { size_t numMuons = muons_->size(); for ( size_t idxMuon = 0; idxMuon < numMuons; ++idxMuon ) { reco::MuonRef muon(muons_, idxMuon); if ( verbosity_ ) std::cout << "muon #" << muon.key() << ": Pt = " << muon->pt() << ", eta = " << muon->eta() << ", phi = " << muon->phi() << std::endl; if ( pfLeadChargedHadron.isNonnull() && pfLeadChargedHadron->muonRef().isNonnull() && muon == pfLeadChargedHadron->muonRef() ) { if ( verbosity_ ) std::cout << " matches muonRef of tau --> skipping it." << std::endl; continue; } double dR = deltaR(muon->p4(), pfTau->p4()); if ( dR < dRmuonMatch_ ) { if ( verbosity_ ) std::cout << " overlaps with tau, dR = " << dR << std::endl; numMatches += muon->numberOfMatches(reco::Muon::NoArbitration); countHits(*muon, numHitsDT, numHitsCSC, numHitsRPC); } } } if ( verbosity_ ) { std::cout << "numMatches = " << numMatches << std::endl; std::cout << "numHitsDT = " << format_vint(numHitsDT) << std::endl; std::cout << "numHitsCSC = " << format_vint(numHitsCSC) << std::endl; std::cout << "numHitsRPC = " << format_vint(numHitsRPC) << std::endl; } int numLast2StationsWithHits = 0; for ( int iStation = 2; iStation < 4; ++iStation ) { if ( numHitsDT[iStation] > 0 ) ++numLast2StationsWithHits; if ( numHitsCSC[iStation] > 0 ) ++numLast2StationsWithHits; if ( numHitsRPC[iStation] > 0 ) ++numLast2StationsWithHits; } bool passesCaloMuonVeto = true; if ( pfLeadChargedHadron.isNonnull() ) { double energyECALplusHCAL = pfLeadChargedHadron->ecalEnergy() + pfLeadChargedHadron->hcalEnergy(); if ( verbosity_ ) { if ( pfLeadChargedHadron->trackRef().isNonnull() ) std::cout << "decayMode = " << pfTau->decayMode() << ", energy(ECAL+HCAL) = " << energyECALplusHCAL << ", leadPFChargedHadronP = " << pfLeadChargedHadron->trackRef()->p() << std::endl; else if ( pfLeadChargedHadron->gsfTrackRef().isNonnull() ) std::cout << "decayMode = " << pfTau->decayMode() << ", energy(ECAL+HCAL) = " << energyECALplusHCAL << ", leadPFChargedHadronP = " << pfLeadChargedHadron->gsfTrackRef()->p() << std::endl; } const reco::Track* leadTrack = 0; if ( pfLeadChargedHadron->trackRef().isNonnull() ) leadTrack = pfLeadChargedHadron->trackRef().get(); else if ( pfLeadChargedHadron->gsfTrackRef().isNonnull() ) leadTrack = pfLeadChargedHadron->gsfTrackRef().get(); if ( pfTau->decayMode() == 0 && leadTrack && energyECALplusHCAL < (hop_*leadTrack->p()) ) passesCaloMuonVeto = false; } double discriminatorValue = 0.; if ( discriminatorOption_ == kLoose && numMatches <= maxNumberOfMatches_ ) discriminatorValue = 1.; else if ( discriminatorOption_ == kMedium && numMatches <= maxNumberOfMatches_ && numLast2StationsWithHits <= maxNumberOfHitsLast2Stations_ ) discriminatorValue = 1.; else if ( discriminatorOption_ == kTight && numMatches <= maxNumberOfMatches_ && numLast2StationsWithHits <= maxNumberOfHitsLast2Stations_ && passesCaloMuonVeto ) discriminatorValue = 1.; else if ( discriminatorOption_ == kCustom ) { bool pass = true; if ( maxNumberOfMatches_ >= 0 && numMatches > maxNumberOfMatches_ ) pass = false; if ( maxNumberOfHitsLast2Stations_ >= 0 && numLast2StationsWithHits > maxNumberOfHitsLast2Stations_ ) pass = false; if ( doCaloMuonVeto_ && !passesCaloMuonVeto ) pass = false; discriminatorValue = pass ? 1.: 0.; } if ( verbosity_ ) std::cout << "--> returning discriminatorValue = " << discriminatorValue << std::endl; return discriminatorValue; }
Definition at line 64 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate(), and PFRecoTauDiscriminationAgainstMuon2().
bool PFRecoTauDiscriminationAgainstMuon2::doCaloMuonVeto_ [private] |
Definition at line 67 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate(), and PFRecoTauDiscriminationAgainstMuon2().
double PFRecoTauDiscriminationAgainstMuon2::dRmuonMatch_ [private] |
Definition at line 71 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate(), and PFRecoTauDiscriminationAgainstMuon2().
double PFRecoTauDiscriminationAgainstMuon2::hop_ [private] |
Definition at line 65 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate(), and PFRecoTauDiscriminationAgainstMuon2().
Definition at line 68 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate(), and PFRecoTauDiscriminationAgainstMuon2().
int PFRecoTauDiscriminationAgainstMuon2::maxNumberOfMatches_ [private] |
Definition at line 66 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate(), and PFRecoTauDiscriminationAgainstMuon2().
std::string PFRecoTauDiscriminationAgainstMuon2::moduleLabel_ [private] |
Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.
Definition at line 63 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate().
Definition at line 70 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by beginEvent(), and discriminate().
Definition at line 69 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by beginEvent(), discriminate(), and PFRecoTauDiscriminationAgainstMuon2().
int PFRecoTauDiscriminationAgainstMuon2::verbosity_ [private] |
Definition at line 72 of file PFRecoTauDiscriminationAgainstMuon2.cc.
Referenced by discriminate(), and PFRecoTauDiscriminationAgainstMuon2().