CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
JetProbabilityComputer Class Reference

#include <JetProbabilityComputer.h>

Inheritance diagram for JetProbabilityComputer:
JetTagComputer

Public Member Functions

float discriminator (const TagInfoHelper &ti) const
 
double jetProbability (const std::vector< float > &v) const
 
 JetProbabilityComputer (const edm::ParameterSet &parameters)
 
- Public Member Functions inherited from JetTagComputer
const std::vector< std::string > & getInputLabels () const
 
 JetTagComputer ()
 
 JetTagComputer (const edm::ParameterSet &configuration)
 
float operator() (const reco::BaseTagInfo &info) const
 
float operator() (const TagInfoHelper &helper) const
 
virtual void setEventSetup (const edm::EventSetup &) const
 
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
 

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

Definition at line 14 of file JetProbabilityComputer.h.

Constructor & Destructor Documentation

JetProbabilityComputer::JetProbabilityComputer ( const edm::ParameterSet parameters)
inline

Definition at line 17 of file JetProbabilityComputer.h.

References edm::ParameterSet::getParameter(), m_cutMaxDecayLen, m_cutMaxDistToAxis, m_deltaR, m_ipType, m_minTrackProb, m_trackQuality, m_trackSign, m_useAllQualities, reco::TrackBase::qualityByName(), and JetTagComputer::uses().

18  {
19  m_ipType = parameters.getParameter<int>("impactParameterType");
20  m_minTrackProb = parameters.getParameter<double>("minimumProbability");
21  m_deltaR = parameters.getParameter<double>("deltaR");
22  m_trackSign = parameters.getParameter<int>("trackIpSign");
23  m_cutMaxDecayLen = parameters.getParameter<double>("maximumDecayLength");
24  m_cutMaxDistToAxis = parameters.getParameter<double>("maximumDistanceToJetAxis");
25  //
26  // access track quality class; "any" takes everything
27  //
28  std::string trackQualityType = parameters.getParameter<std::string>("trackQualityClass"); //used
30  m_useAllQualities = false;
31  if (trackQualityType == "any" ||
32  trackQualityType == "Any" ||
33  trackQualityType == "ANY" ) m_useAllQualities = true;
34 
35  uses("ipTagInfos");
36  }
T getParameter(std::string const &) const
void uses(unsigned int id, const std::string &label)
reco::TrackBase::TrackQuality m_trackQuality
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:46

Member Function Documentation

float JetProbabilityComputer::discriminator ( const TagInfoHelper ti) const
inlinevirtual

Reimplemented from JetTagComputer.

Definition at line 38 of file JetProbabilityComputer.h.

References JetTagComputer::TagInfoHelper::get(), i, reco::TrackIPTagInfo::impactParameterData(), PyquenDefaultSettings_cff::impactParameters, edm::Ref< C, T, F >::isNull(), reco::JTATagInfo::jet(), jetProbability(), m_cutMaxDecayLen, m_cutMaxDistToAxis, m_deltaR, m_ipType, m_trackQuality, m_trackSign, m_useAllQualities, AlCaHLTBitMon_ParallelJobs::p, p4, reco::TrackIPTagInfo::primaryVertex(), reco::TrackIPTagInfo::probabilities(), reco::TrackIPTagInfo::selectedTracks(), and testEve_cfg::tracks.

39  {
40  const reco::TrackIPTagInfo & tkip = ti.get<reco::TrackIPTagInfo>();
41 
43  const std::vector<float> & allProbabilities((tkip.probabilities(m_ipType)));
44  const std::vector<reco::TrackIPTagInfo::TrackIPData> & impactParameters((tkip.impactParameterData()));
45 
46  if (tkip.primaryVertex().isNull()) return 0 ;
47 
48  GlobalPoint pv(tkip.primaryVertex()->position().x(),tkip.primaryVertex()->position().y(),tkip.primaryVertex()->position().z());
49 
50  std::vector<float> probabilities;
51  int i=0;
52  for(std::vector<float>::const_iterator it = allProbabilities.begin(); it!=allProbabilities.end(); ++it, i++)
53  {
54  if ( fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis && // distance to JetAxis
55  (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen && // max decay len
56  (m_useAllQualities == true || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
57  )
58  {
59  float p;
60  if(m_trackSign ==0 )
61  {
62  if (*it >=0){p=*it/2.;}else{p=1.+*it/2.;}
63  }
64  else if(m_trackSign > 0)
65  {
66  if(*it >=0 ) p=*it; else continue;
67  } else
68  {
69  if(*it <=0 ) p= -*it; else continue;
70  }
71  if(m_deltaR <= 0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR )
72  probabilities.push_back(p);
73  }
74  }
75  return jetProbability(probabilities);
76  }
int i
Definition: DBlmapReader.cc:9
const edm::Ref< VertexCollection > & primaryVertex() const
double jetProbability(const std::vector< float > &v) const
bool isNull() const
Checks for null.
Definition: Ref.h:247
double p4[4]
Definition: TauolaWrapper.h:92
reco::TrackBase::TrackQuality m_trackQuality
const std::vector< float > & probabilities(int ip) const
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
Definition: JTATagInfo.h:20
tuple tracks
Definition: testEve_cfg.py:39
const std::vector< TrackIPData > & impactParameterData() const
const edm::RefVector< TrackCollection > & selectedTracks() const
double JetProbabilityComputer::jetProbability ( const std::vector< float > &  v) const
inline

Definition at line 78 of file JetProbabilityComputer.h.

References gather_cfg::cout, create_public_lumi_plots::exp, prof2calltree::l, create_public_lumi_plots::log, m_minTrackProb, max(), min, and lumiQueryAPI::q.

Referenced by discriminator().

79 {
80  int ngoodtracks=v.size();
81  double SumJet=0.;
82 
83  for(std::vector<float>::const_iterator q = v.begin(); q != v.end(); q++){
84  SumJet+=(*q>m_minTrackProb)?log(*q):log(m_minTrackProb);
85  }
86 
87  double ProbJet;
88  double Loginvlog=0;
89 
90  if(SumJet<0.){
91  if(ngoodtracks>=2){
92  Loginvlog=log(-SumJet);
93  }
94  double Prob=1.;
95  double lfact=1.;
96  for(int l=1; l!=ngoodtracks; l++){
97  lfact*=l;
98  Prob+=exp(l*Loginvlog-log(1.*lfact));
99  }
100  double LogProb=log(Prob);
101  ProbJet=
102  std::min(exp(std::max(LogProb+SumJet,-30.)),1.);
103  }else{
104  ProbJet=1.;
105  }
106  if(ProbJet>1)
107  std::cout << "ProbJet too high: " << ProbJet << std::endl;
108 
109  //double LogProbJet=-log(ProbJet);
110  // //return 1.-ProbJet;
111  return -log10(ProbJet)/4.;
112  }
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
tuple cout
Definition: gather_cfg.py:121
mathSSE::Vec4< T > v

Member Data Documentation

double JetProbabilityComputer::m_cutMaxDecayLen
private

Definition at line 118 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

double JetProbabilityComputer::m_cutMaxDistToAxis
private

Definition at line 119 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

double JetProbabilityComputer::m_deltaR
private

Definition at line 116 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

int JetProbabilityComputer::m_ipType
private

Definition at line 115 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

double JetProbabilityComputer::m_minTrackProb
private

Definition at line 114 of file JetProbabilityComputer.h.

Referenced by jetProbability(), and JetProbabilityComputer().

reco::TrackBase::TrackQuality JetProbabilityComputer::m_trackQuality
private

Definition at line 120 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

int JetProbabilityComputer::m_trackSign
private

Definition at line 117 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

bool JetProbabilityComputer::m_useAllQualities
private

Definition at line 121 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().