Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-31 02:19:53

0001 #include <limits>
0002 
0003 #include "DataFormats/BTauReco/interface/CandSoftLeptonTagInfo.h"
0004 #include "RecoBTag/SoftLepton/interface/LeptonTaggerByIP.h"
0005 #include "RecoBTag/SoftLepton/interface/LeptonSelector.h"
0006 
0007 LeptonTaggerByIP::LeptonTaggerByIP(const edm::ParameterSet& configuration)
0008     : m_use3d(configuration.getParameter<bool>("use3d")), m_selector(configuration) {
0009   uses("slTagInfos");
0010 }
0011 
0012 /// b-tag a jet based on track-to-jet parameters in the extened info collection
0013 float LeptonTaggerByIP::discriminator(const TagInfoHelper& tagInfo) const {
0014   // default value, used if there are no leptons associated to this jet
0015   float bestTag = -std::numeric_limits<float>::infinity();
0016   const reco::CandSoftLeptonTagInfo& info = tagInfo.get<reco::CandSoftLeptonTagInfo>();
0017   // if there are multiple leptons, look for the one with the highest pT_rel
0018   for (unsigned int i = 0; i < info.leptons(); i++) {
0019     const reco::SoftLeptonProperties& properties = info.properties(i);
0020     float sipsig = m_use3d ? properties.sip3dsig : properties.sip2dsig;
0021     if (m_selector.isNegative())
0022       sipsig = -sipsig;
0023     if (m_selector(properties, m_use3d)) {
0024       float tag = sipsig;
0025       if (tag > bestTag)
0026         bestTag = tag;
0027     }
0028   }
0029   return bestTag;
0030 }
0031 
0032 void LeptonTaggerByIP::fillPSetDescription(edm::ParameterSetDescription& desc) {
0033   btag::LeptonSelector::fillPSetDescription(desc);
0034   desc.add<bool>("use3d", false);
0035 }