Go to the documentation of this file.00001
00002
00003
00004
00005 #include "PhysicsTools/PatUtils/interface/bJetSelector.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007
00008 bJetSelector::bJetSelector(const edm::ParameterSet& cfg) :
00009 discriminantCutsLoose_(cfg.getParameter<std::vector<double> >("discCutLoose")),
00010 discriminantCutsMedium_(cfg.getParameter<std::vector<double> >("discCutMedium")),
00011 discriminantCutsTight_(cfg.getParameter<std::vector<double> >("discCutTight")),
00012 BTagdiscriminator_(cfg.getParameter<std::vector<std::string> >("bdiscriminators")),
00013 DefaultOp_(cfg.getParameter<std::string>("DefaultOp")),
00014 DefaultTg_(cfg.getParameter<std::string>("DefaultBdisc"))
00015
00016 {
00017
00018 for (unsigned int i=0; i<BTagdiscriminator_.size(); i++){
00019 discCut["Loose"][BTagdiscriminator_[i]] = discriminantCutsLoose_[i];
00020 discCut["Medium"][BTagdiscriminator_[i]] = discriminantCutsMedium_[i];
00021 discCut["Tight"][BTagdiscriminator_[i]] = discriminantCutsTight_[i];
00022 }
00023 }
00024
00025 bool
00026 bJetSelector::IsbTag(const pat::Jet& JetCand,
00027 const std::string& operpoint,
00028 const std::string& tagger) const {
00029
00030 std::map<std::string,std::map<std::string,double> >::const_iterator ioperpoint = discCut.find(operpoint);
00031 if ( ioperpoint == discCut.end() ) throw cms::Exception("UnknownOperatingPoint") << "Unknown or undefined operative point" << std::endl;
00032 std::map<std::string,double>::const_iterator itagger = ioperpoint->second.find(tagger);
00033 if ( itagger == ioperpoint->second.end() ) throw cms::Exception("UnknownTagger") << "Unknown or undefined tagger" << std::endl;
00034
00035 return JetCand.bDiscriminator(tagger) > itagger->second;
00036 }
00037 bool
00038 bJetSelector::IsbTag(const pat::Jet& JetCand,
00039 const std::string& operpoint) const {
00040
00041
00042 return IsbTag(JetCand,operpoint,DefaultTg_);
00043 }
00044 bool
00045 bJetSelector::IsbTag(const pat::Jet& JetCand) const{
00046 return IsbTag(JetCand,DefaultOp_,DefaultTg_);
00047 }
00048
00049