CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
TemplatedJetProbabilityComputer< Container, Base > Class Template Reference

#include <TemplatedJetProbabilityComputer.h>

Inheritance diagram for TemplatedJetProbabilityComputer< Container, Base >:
JetTagComputer

Public Types

typedef reco::IPTagInfo< Container, Base > TagInfo
 
using Tokens = void
 

Public Member Functions

float discriminator (const TagInfoHelper &ti) const override
 
double jetProbability (const std::vector< float > &v) const
 
 TemplatedJetProbabilityComputer (const edm::ParameterSet &parameters)
 
- Public Member Functions inherited from JetTagComputer
const std::vector< std::string > & getInputLabels () const
 
virtual void initialize (const JetTagComputerRecord &)
 
 JetTagComputer ()
 
 JetTagComputer (const edm::ParameterSet &configuration)
 
float operator() (const reco::BaseTagInfo &info) const
 
float operator() (const TagInfoHelper &helper) const
 
void setupDone ()
 
virtual ~JetTagComputer ()
 

Private Attributes

double m_cutMaxDecayLen
 
double m_cutMaxDistToAxis
 
double m_deltaR
 
int m_ipType
 
double m_minTrackProb
 
reco::TrackBase::TrackQuality m_trackQuality
 
int m_trackSign
 
bool m_useAllQualities
 
bool useVariableJTA_
 
reco::btag::variableJTAParameters varJTApars
 

Additional Inherited Members

- Protected Member Functions inherited from JetTagComputer
virtual float discriminator (const reco::BaseTagInfo &) const
 
void uses (unsigned int id, const std::string &label)
 
void uses (const std::string &label)
 

Detailed Description

template<class Container, class Base>
class TemplatedJetProbabilityComputer< Container, Base >

Definition at line 15 of file TemplatedJetProbabilityComputer.h.

Member Typedef Documentation

◆ TagInfo

template<class Container , class Base >
typedef reco::IPTagInfo<Container, Base> TemplatedJetProbabilityComputer< Container, Base >::TagInfo

Definition at line 19 of file TemplatedJetProbabilityComputer.h.

◆ Tokens

template<class Container , class Base >
using TemplatedJetProbabilityComputer< Container, Base >::Tokens = void

Definition at line 17 of file TemplatedJetProbabilityComputer.h.

Constructor & Destructor Documentation

◆ TemplatedJetProbabilityComputer()

template<class Container , class Base >
TemplatedJetProbabilityComputer< Container, Base >::TemplatedJetProbabilityComputer ( const edm::ParameterSet parameters)
inline

Definition at line 21 of file TemplatedJetProbabilityComputer.h.

References TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDecayLen, TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDistToAxis, TemplatedJetProbabilityComputer< Container, Base >::m_deltaR, TemplatedJetProbabilityComputer< Container, Base >::m_ipType, TemplatedJetProbabilityComputer< Container, Base >::m_minTrackProb, TemplatedJetProbabilityComputer< Container, Base >::m_trackQuality, TemplatedJetProbabilityComputer< Container, Base >::m_trackSign, TemplatedJetProbabilityComputer< Container, Base >::m_useAllQualities, reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, JetTagComputer::uses(), TemplatedJetProbabilityComputer< Container, Base >::useVariableJTA_, and TemplatedJetProbabilityComputer< Container, Base >::varJTApars.

21  {
22  m_ipType = parameters.getParameter<int>("impactParameterType");
23  m_minTrackProb = parameters.getParameter<double>("minimumProbability");
24  m_deltaR = parameters.getParameter<double>("deltaR");
25  m_trackSign = parameters.getParameter<int>("trackIpSign");
26  m_cutMaxDecayLen = parameters.getParameter<double>("maximumDecayLength");
27  m_cutMaxDistToAxis = parameters.getParameter<double>("maximumDistanceToJetAxis");
28  //
29  // access track quality class; "any" takes everything
30  //
31  std::string trackQualityType = parameters.getParameter<std::string>("trackQualityClass"); //used
33  m_useAllQualities = false;
34  if (trackQualityType == "any" || trackQualityType == "Any" || trackQualityType == "ANY")
35  m_useAllQualities = true;
36 
37  useVariableJTA_ = parameters.getParameter<bool>("useVariableJTA");
38  if (useVariableJTA_)
39  varJTApars = {parameters.getParameter<double>("a_dR"),
40  parameters.getParameter<double>("b_dR"),
41  parameters.getParameter<double>("a_pT"),
42  parameters.getParameter<double>("b_pT"),
43  parameters.getParameter<double>("min_pT"),
44  parameters.getParameter<double>("max_pT"),
45  parameters.getParameter<double>("min_pT_dRcut"),
46  parameters.getParameter<double>("max_pT_dRcut"),
47  parameters.getParameter<double>("max_pT_trackPTcut")};
48 
49  uses("ipTagInfos");
50  }
reco::TrackBase::TrackQuality m_trackQuality
void uses(unsigned int id, const std::string &label)
reco::btag::variableJTAParameters varJTApars
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126

Member Function Documentation

◆ discriminator()

template<class Container , class Base >
float TemplatedJetProbabilityComputer< Container, Base >::discriminator ( const TagInfoHelper ti) const
inlineoverridevirtual

Reimplemented from JetTagComputer.

Definition at line 52 of file TemplatedJetProbabilityComputer.h.

References electronAnalyzer_cfi::DeltaR, JetTagComputer::TagInfoHelper::get(), mps_fire::i, reco::IPTagInfo< Container, Base >::impactParameterData(), edm::Ref< C, T, F >::isNull(), TemplatedJetProbabilityComputer< Container, Base >::jetProbability(), TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDecayLen, TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDistToAxis, TemplatedJetProbabilityComputer< Container, Base >::m_deltaR, TemplatedJetProbabilityComputer< Container, Base >::m_ipType, TemplatedJetProbabilityComputer< Container, Base >::m_trackQuality, TemplatedJetProbabilityComputer< Container, Base >::m_trackSign, TemplatedJetProbabilityComputer< Container, Base >::m_useAllQualities, AlCaHLTBitMon_ParallelJobs::p, reco::IPTagInfo< Container, Base >::primaryVertex(), reco::IPTagInfo< Container, Base >::probabilities(), MetAnalyzer::pv(), reco::TrackBase::quality(), reco::IPTagInfo< Container, Base >::selectedTracks(), reco::btag::toTrack(), tracks, TemplatedJetProbabilityComputer< Container, Base >::useVariableJTA_, reco::IPTagInfo< Container, Base >::variableJTA(), and TemplatedJetProbabilityComputer< Container, Base >::varJTApars.

52  {
53  const TagInfo& tkip = ti.get<TagInfo>();
54  const Container& tracks(tkip.selectedTracks());
55  const std::vector<float>& allProbabilities((tkip.probabilities(m_ipType)));
56  const std::vector<reco::btag::TrackIPData>& impactParameters((tkip.impactParameterData()));
57 
58  if (tkip.primaryVertex().isNull())
59  return 0;
60 
61  GlobalPoint pv(tkip.primaryVertex()->position().x(),
62  tkip.primaryVertex()->position().y(),
63  tkip.primaryVertex()->position().z());
64 
65  std::vector<float> probabilities;
66  int i = 0;
67  for (std::vector<float>::const_iterator it = allProbabilities.begin(); it != allProbabilities.end(); ++it, i++) {
68  if (fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis && // distance to JetAxis
69  (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen && // max decay len
70  (m_useAllQualities == true ||
71  reco::btag::toTrack(tracks[i])->quality(m_trackQuality)) // use selected track qualities
72  ) {
73  float p;
74  if (m_trackSign == 0) {
75  if (*it >= 0) {
76  p = *it / 2.;
77  } else {
78  p = 1. + *it / 2.;
79  }
80  } else if (m_trackSign > 0) {
81  if (*it >= 0)
82  p = *it;
83  else
84  continue;
85  } else {
86  if (*it <= 0)
87  p = -*it;
88  else
89  continue;
90  }
91  if (useVariableJTA_) {
92  if (tkip.variableJTA(varJTApars)[i])
93  probabilities.push_back(p);
94  } else {
95  if (m_deltaR <= 0 ||
96  ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR)
97  probabilities.push_back(p);
98  }
99  }
100  }
101  return jetProbability(probabilities);
102  }
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
reco::TrackBase::TrackQuality m_trackQuality
const reco::Track * toTrack(const reco::TrackBaseRef &t)
Definition: IPTagInfo.h:24
reco::IPTagInfo< Container, Base > TagInfo
def pv(vc)
Definition: MetAnalyzer.py:7
double jetProbability(const std::vector< float > &v) const
reco::btag::variableJTAParameters varJTApars
auto const & tracks
cannot be loose
edm::AssociationVector< reco::JetRefBaseProd, Values > Container

◆ jetProbability()

template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::jetProbability ( const std::vector< float > &  v) const
inline

Definition at line 104 of file TemplatedJetProbabilityComputer.h.

References gather_cfg::cout, JetChargeProducer_cfi::exp, MainPageGenerator::l, dqm-mbProfile::log, TemplatedJetProbabilityComputer< Container, Base >::m_minTrackProb, SiStripPI::max, SiStripPI::min, submitPVResolutionJobs::q, and findQualityFiles::v.

Referenced by TemplatedJetProbabilityComputer< Container, Base >::discriminator().

104  {
105  int ngoodtracks = v.size();
106  double SumJet = 0.;
107 
108  for (std::vector<float>::const_iterator q = v.begin(); q != v.end(); q++) {
109  SumJet += (*q > m_minTrackProb) ? log(*q) : log(m_minTrackProb);
110  }
111 
112  double ProbJet;
113  double Loginvlog = 0;
114 
115  if (SumJet < 0.) {
116  if (ngoodtracks >= 2) {
117  Loginvlog = log(-SumJet);
118  }
119  double Prob = 1.;
120  double lfact = 1.;
121  for (int l = 1; l != ngoodtracks; l++) {
122  lfact *= l;
123  Prob += exp(l * Loginvlog - log(1. * lfact));
124  }
125  double LogProb = log(Prob);
126  ProbJet = std::min(exp(std::max(LogProb + SumJet, -30.)), 1.);
127  } else {
128  ProbJet = 1.;
129  }
130  if (ProbJet > 1)
131  std::cout << "ProbJet too high: " << ProbJet << std::endl;
132 
133  //double LogProbJet=-log(ProbJet);
134  // //return 1.-ProbJet;
135  return -log10(ProbJet) / 4.;
136  }

Member Data Documentation

◆ m_cutMaxDecayLen

template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDecayLen
private

◆ m_cutMaxDistToAxis

template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDistToAxis
private

◆ m_deltaR

template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_deltaR
private

◆ m_ipType

template<class Container , class Base >
int TemplatedJetProbabilityComputer< Container, Base >::m_ipType
private

◆ m_minTrackProb

template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_minTrackProb
private

◆ m_trackQuality

template<class Container , class Base >
reco::TrackBase::TrackQuality TemplatedJetProbabilityComputer< Container, Base >::m_trackQuality
private

◆ m_trackSign

template<class Container , class Base >
int TemplatedJetProbabilityComputer< Container, Base >::m_trackSign
private

◆ m_useAllQualities

template<class Container , class Base >
bool TemplatedJetProbabilityComputer< Container, Base >::m_useAllQualities
private

◆ useVariableJTA_

template<class Container , class Base >
bool TemplatedJetProbabilityComputer< Container, Base >::useVariableJTA_
private

◆ varJTApars

template<class Container , class Base >
reco::btag::variableJTAParameters TemplatedJetProbabilityComputer< Container, Base >::varJTApars
private