test
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
JetBProbabilityComputer Class Reference

#include <JetBProbabilityComputer.h>

Inheritance diagram for JetBProbabilityComputer:
JetTagComputer

Public Member Functions

float discriminator (const TagInfoHelper &ti) const
 
 JetBProbabilityComputer (const edm::ParameterSet &parameters)
 
double jetProbability (const std::vector< float > &v) const
 
- 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
 
unsigned int m_nbTracks
 
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 13 of file JetBProbabilityComputer.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file JetBProbabilityComputer.h.

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

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

Member Function Documentation

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

log(all);

Reimplemented from JetTagComputer.

Definition at line 52 of file JetBProbabilityComputer.h.

References cond::ecalcond::all, b, JetTagComputer::TagInfoHelper::get(), i, reco::TrackIPTagInfo::impactParameterData(), PyquenDefaultSettings_cff::impactParameters, edm::Ref< C, T, F >::isNull(), reco::JTATagInfo::jet(), jetProbability(), fff_deleter::log, m_ipType, m_nbTracks, m_useAllQualities, AlCaHLTBitMon_ParallelJobs::p, p4, reco::TrackIPTagInfo::primaryVertex(), reco::TrackIPTagInfo::probabilities(), reco::TrackIPTagInfo::selectedTracks(), python.multivaluedict::sort(), testEve_cfg::tracks, useVariableJTA_, reco::TrackIPTagInfo::variableJTA(), and varJTApars.

53  {
54  const reco::TrackIPTagInfo & tkip = ti.get<reco::TrackIPTagInfo>();
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  std::vector<float> probabilitiesB;
65  int i=0;
66  for(std::vector<float>::const_iterator it = allProbabilities.begin(); it!=allProbabilities.end(); ++it, i++)
67  {
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 || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
71  )
72  {
73  // Use only positive(or negative) tracks for B
74  float p=fabs(*it);
75  if (useVariableJTA_) {
76  if (tkip.variableJTA( varJTApars )[i]) {
77  if(m_trackSign>0 || *it <0 ) probabilities.push_back(p); //Use all tracks for positive tagger and only negative for negative tagger
78  if(m_trackSign>0 && *it >=0){probabilitiesB.push_back(*it);} //Use only positive tracks for positive tagger
79  if(m_trackSign<0 && *it <=0){probabilitiesB.push_back(- *it);} //Use only negative tracks for negative tagger
80  }
81  }
82  else
83  if( m_deltaR < 0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR)
84  {
85  //if(m_trackSign>0 || *it >0 ) probabilities.push_back(p); //Use all tracks for positive tagger and only negative for negative tagger
86  if(m_trackSign>0 || *it <0 ) probabilities.push_back(p); //Use all tracks for positive tagger and only negative for negative tagger
87 
88  if(m_trackSign>0 && *it >=0){probabilitiesB.push_back(*it);} //Use only positive tracks for positive tagger
89  if(m_trackSign<0 && *it <=0){probabilitiesB.push_back(- *it);} //Use only negative tracks for negative tagger
90  }
91  }
92  }
93 
94  float all = jetProbability(probabilities);
95  std::sort(probabilitiesB.begin(), probabilitiesB.end());
96  if(probabilitiesB.size() > m_nbTracks ) probabilitiesB.resize(m_nbTracks);
97  float b = jetProbability(probabilitiesB);
98 
99  return -log(b)/4-log(all)/4;
100  }
int i
Definition: DBlmapReader.cc:9
const edm::Ref< VertexCollection > & primaryVertex() const
double jetProbability(const std::vector< float > &v) const
reco::TrackBase::TrackQuality m_trackQuality
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
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
reco::TrackIPTagInfo::variableJTAParameters varJTApars
tuple tracks
Definition: testEve_cfg.py:39
double b
Definition: hdecay.h:120
const std::vector< TrackIPData > & impactParameterData() const
const edm::RefVector< TrackCollection > & selectedTracks() const
double JetBProbabilityComputer::jetProbability ( const std::vector< float > &  v) const
inline

Definition at line 102 of file JetBProbabilityComputer.h.

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

Referenced by discriminator().

103 {
104  int ngoodtracks=v.size();
105  double SumJet=0.;
106 
107  for(std::vector<float>::const_iterator q = v.begin(); q != v.end(); q++){
108  SumJet+=(*q>m_minTrackProb)?log(*q):log(m_minTrackProb);
109  }
110 
111  double ProbJet;
112  double Loginvlog=0;
113 
114  if(SumJet<0.){
115  if(ngoodtracks>=2){
116  Loginvlog=log(-SumJet);
117  }
118  double Prob=1.;
119  double lfact=1.;
120  for(int l=1; l!=ngoodtracks; l++){
121  lfact*=l;
122  Prob+=exp(l*Loginvlog-log(1.*lfact));
123  }
124  double LogProb=log(Prob);
125  ProbJet=
126  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 ProbJet;
136  }
T min(T a, T b)
Definition: MathUtil.h:58
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

double JetBProbabilityComputer::m_cutMaxDecayLen
private

Definition at line 145 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

double JetBProbabilityComputer::m_cutMaxDistToAxis
private

Definition at line 146 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

double JetBProbabilityComputer::m_deltaR
private

Definition at line 142 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

int JetBProbabilityComputer::m_ipType
private

Definition at line 141 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

double JetBProbabilityComputer::m_minTrackProb
private

Definition at line 140 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer(), and jetProbability().

unsigned int JetBProbabilityComputer::m_nbTracks
private

Definition at line 144 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

reco::TrackBase::TrackQuality JetBProbabilityComputer::m_trackQuality
private

Definition at line 147 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

int JetBProbabilityComputer::m_trackSign
private

Definition at line 143 of file JetBProbabilityComputer.h.

Referenced by JetBProbabilityComputer().

bool JetBProbabilityComputer::m_useAllQualities
private

Definition at line 148 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

bool JetBProbabilityComputer::useVariableJTA_
private

Definition at line 138 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().

reco::TrackIPTagInfo::variableJTAParameters JetBProbabilityComputer::varJTApars
private

Definition at line 139 of file JetBProbabilityComputer.h.

Referenced by discriminator(), and JetBProbabilityComputer().