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
 
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::TrackIPTagInfo::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

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(), AlCaHLTBitMon_QueryRunRegistry::string, JetTagComputer::uses(), useVariableJTA_, and varJTApars.

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  useVariableJTA_ = parameters.getParameter<bool>("useVariableJTA");
36  if(useVariableJTA_)
37  varJTApars = {
38  parameters.getParameter<double>("a_dR"),
39  parameters.getParameter<double>("b_dR"),
40  parameters.getParameter<double>("a_pT"),
41  parameters.getParameter<double>("b_pT"),
42  parameters.getParameter<double>("min_pT"),
43  parameters.getParameter<double>("max_pT"),
44  parameters.getParameter<double>("min_pT_dRcut"),
45  parameters.getParameter<double>("max_pT_dRcut"),
46  parameters.getParameter<double>("max_pT_trackPTcut") };
47 
48  uses("ipTagInfos");
49  }
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
reco::TrackIPTagInfo::variableJTAParameters varJTApars

Member Function Documentation

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

Reimplemented from JetTagComputer.

Definition at line 51 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_ipType, m_useAllQualities, AlCaHLTBitMon_ParallelJobs::p, p4, reco::TrackIPTagInfo::primaryVertex(), reco::TrackIPTagInfo::probabilities(), reco::TrackIPTagInfo::selectedTracks(), testEve_cfg::tracks, useVariableJTA_, reco::TrackIPTagInfo::variableJTA(), and varJTApars.

52  {
53  const reco::TrackIPTagInfo & tkip = ti.get<reco::TrackIPTagInfo>();
54 
56  const std::vector<float> & allProbabilities((tkip.probabilities(m_ipType)));
57  const std::vector<reco::TrackIPTagInfo::TrackIPData> & impactParameters((tkip.impactParameterData()));
58 
59  if (tkip.primaryVertex().isNull()) return 0 ;
60 
61  GlobalPoint pv(tkip.primaryVertex()->position().x(),tkip.primaryVertex()->position().y(),tkip.primaryVertex()->position().z());
62 
63  std::vector<float> probabilities;
64  int i=0;
65  for(std::vector<float>::const_iterator it = allProbabilities.begin(); it!=allProbabilities.end(); ++it, i++)
66  {
67  if ( fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis && // distance to JetAxis
68  (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen && // max decay len
69  (m_useAllQualities == true || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
70  )
71  {
72  float p;
73  if(m_trackSign ==0 )
74  {
75  if (*it >=0){p=*it/2.;}else{p=1.+*it/2.;}
76  }
77  else if(m_trackSign > 0)
78  {
79  if(*it >=0 ) p=*it; else continue;
80  } else
81  {
82  if(*it <=0 ) p= -*it; else continue;
83  }
84  if (useVariableJTA_) {
85  if (tkip.variableJTA( varJTApars )[i])
86  probabilities.push_back(p);
87  }else{
88  if(m_deltaR <= 0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR )
89  probabilities.push_back(p);
90  }
91  }
92  }
93  return jetProbability(probabilities);
94  }
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
std::vector< bool > variableJTA(const variableJTAParameters &params) const
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
reco::TrackIPTagInfo::variableJTAParameters varJTApars
double JetProbabilityComputer::jetProbability ( const std::vector< float > &  v) const
inline

Definition at line 96 of file JetProbabilityComputer.h.

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

Referenced by discriminator().

97 {
98  int ngoodtracks=v.size();
99  double SumJet=0.;
100 
101  for(std::vector<float>::const_iterator q = v.begin(); q != v.end(); q++){
102  SumJet+=(*q>m_minTrackProb)?log(*q):log(m_minTrackProb);
103  }
104 
105  double ProbJet;
106  double Loginvlog=0;
107 
108  if(SumJet<0.){
109  if(ngoodtracks>=2){
110  Loginvlog=log(-SumJet);
111  }
112  double Prob=1.;
113  double lfact=1.;
114  for(int l=1; l!=ngoodtracks; l++){
115  lfact*=l;
116  Prob+=exp(l*Loginvlog-log(1.*lfact));
117  }
118  double LogProb=log(Prob);
119  ProbJet=
120  std::min(exp(std::max(LogProb+SumJet,-30.)),1.);
121  }else{
122  ProbJet=1.;
123  }
124  if(ProbJet>1)
125  std::cout << "ProbJet too high: " << ProbJet << std::endl;
126 
127  //double LogProbJet=-log(ProbJet);
128  // //return 1.-ProbJet;
129  return -log10(ProbJet)/4.;
130  }
static std::vector< std::string > checklist log
T min(T a, T b)
Definition: MathUtil.h:58
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

double JetProbabilityComputer::m_cutMaxDecayLen
private

Definition at line 138 of file JetProbabilityComputer.h.

Referenced by JetProbabilityComputer().

double JetProbabilityComputer::m_cutMaxDistToAxis
private

Definition at line 139 of file JetProbabilityComputer.h.

Referenced by JetProbabilityComputer().

double JetProbabilityComputer::m_deltaR
private

Definition at line 136 of file JetProbabilityComputer.h.

Referenced by JetProbabilityComputer().

int JetProbabilityComputer::m_ipType
private

Definition at line 135 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

double JetProbabilityComputer::m_minTrackProb
private

Definition at line 134 of file JetProbabilityComputer.h.

Referenced by jetProbability(), and JetProbabilityComputer().

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

Definition at line 140 of file JetProbabilityComputer.h.

Referenced by JetProbabilityComputer().

int JetProbabilityComputer::m_trackSign
private

Definition at line 137 of file JetProbabilityComputer.h.

Referenced by JetProbabilityComputer().

bool JetProbabilityComputer::m_useAllQualities
private

Definition at line 141 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

bool JetProbabilityComputer::useVariableJTA_
private

Definition at line 132 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().

reco::TrackIPTagInfo::variableJTAParameters JetProbabilityComputer::varJTApars
private

Definition at line 133 of file JetProbabilityComputer.h.

Referenced by discriminator(), and JetProbabilityComputer().