CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 

Public Member Functions

float discriminator (const TagInfoHelper &ti) const
 
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

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

Definition at line 18 of file TemplatedJetProbabilityComputer.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file TemplatedJetProbabilityComputer.h.

References edm::ParameterSet::getParameter(), 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" ||
35  trackQualityType == "Any" ||
36  trackQualityType == "ANY" ) m_useAllQualities = true;
37 
38  useVariableJTA_ = parameters.getParameter<bool>("useVariableJTA");
39  if(useVariableJTA_)
40  varJTApars = {
41  parameters.getParameter<double>("a_dR"),
42  parameters.getParameter<double>("b_dR"),
43  parameters.getParameter<double>("a_pT"),
44  parameters.getParameter<double>("b_pT"),
45  parameters.getParameter<double>("min_pT"),
46  parameters.getParameter<double>("max_pT"),
47  parameters.getParameter<double>("min_pT_dRcut"),
48  parameters.getParameter<double>("max_pT_dRcut"),
49  parameters.getParameter<double>("max_pT_trackPTcut") };
50 
51  uses("ipTagInfos");
52  }
T getParameter(std::string const &) const
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:123

Member Function Documentation

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

Reimplemented from JetTagComputer.

Definition at line 54 of file TemplatedJetProbabilityComputer.h.

References HLT_25ns14e33_v1_cff::DeltaR, JetTagComputer::TagInfoHelper::get(), i, reco::IPTagInfo< Container, Base >::impactParameterData(), PyquenDefaultSettings_cff::impactParameters, edm::Ref< C, T, F >::isNull(), TemplatedJetProbabilityComputer< Container, Base >::jetProbability(), TemplatedJetProbabilityComputer< Container, Base >::m_ipType, TemplatedJetProbabilityComputer< Container, Base >::m_useAllQualities, AlCaHLTBitMon_ParallelJobs::p, p4, reco::IPTagInfo< Container, Base >::primaryVertex(), reco::IPTagInfo< Container, Base >::probabilities(), MetAnalyzer::pv(), reco::TrackBase::quality(), reco::IPTagInfo< Container, Base >::selectedTracks(), reco::btag::toTrack(), testEve_cfg::tracks, TemplatedJetProbabilityComputer< Container, Base >::useVariableJTA_, reco::IPTagInfo< Container, Base >::variableJTA(), and TemplatedJetProbabilityComputer< Container, Base >::varJTApars.

55  {
56  const TagInfo & tkip = ti.get<TagInfo>();
57  const Container & tracks(tkip.selectedTracks());
58  const std::vector<float> & allProbabilities((tkip.probabilities(m_ipType)));
59  const std::vector<reco::btag::TrackIPData> & impactParameters((tkip.impactParameterData()));
60 
61  if (tkip.primaryVertex().isNull()) return 0 ;
62 
63  GlobalPoint pv(tkip.primaryVertex()->position().x(),tkip.primaryVertex()->position().y(),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  {
69  if ( fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis && // distance to JetAxis
70  (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen && // max decay len
71  (m_useAllQualities == true || reco::btag::toTrack(tracks[i])->quality(m_trackQuality)) // use selected track qualities
72  )
73  {
74  float p;
75  if(m_trackSign ==0 )
76  {
77  if (*it >=0){p=*it/2.;}else{p=1.+*it/2.;}
78  }
79  else if(m_trackSign > 0)
80  {
81  if(*it >=0 ) p=*it; else continue;
82  } else
83  {
84  if(*it <=0 ) p= -*it; else continue;
85  }
86  if (useVariableJTA_) {
87  if (tkip.variableJTA( varJTApars )[i])
88  probabilities.push_back(p);
89  }else{
90  if(m_deltaR <= 0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR )
91  probabilities.push_back(p);
92  }
93  }
94  }
95  return jetProbability(probabilities);
96  }
int i
Definition: DBlmapReader.cc:9
reco::TrackBase::TrackQuality m_trackQuality
EcalChannelStatus Container
const reco::Track * toTrack(const reco::TrackBaseRef &t)
Definition: IPTagInfo.h:24
reco::IPTagInfo< Container, Base > TagInfo
double jetProbability(const std::vector< float > &v) const
double p4[4]
Definition: TauolaWrapper.h:92
reco::btag::variableJTAParameters varJTApars
tuple tracks
Definition: testEve_cfg.py:39
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:497
template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::jetProbability ( const std::vector< float > &  v) const
inline

Definition at line 98 of file TemplatedJetProbabilityComputer.h.

References gather_cfg::cout, create_public_lumi_plots::exp, prof2calltree::l, cmsBatch::log, TemplatedJetProbabilityComputer< Container, Base >::m_minTrackProb, bookConverter::max, min(), and lumiQueryAPI::q.

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

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

Member Data Documentation

template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDecayLen
private
template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_cutMaxDistToAxis
private
template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_deltaR
private
template<class Container , class Base >
int TemplatedJetProbabilityComputer< Container, Base >::m_ipType
private
template<class Container , class Base >
double TemplatedJetProbabilityComputer< Container, Base >::m_minTrackProb
private
template<class Container , class Base >
reco::TrackBase::TrackQuality TemplatedJetProbabilityComputer< Container, Base >::m_trackQuality
private
template<class Container , class Base >
int TemplatedJetProbabilityComputer< Container, Base >::m_trackSign
private
template<class Container , class Base >
bool TemplatedJetProbabilityComputer< Container, Base >::m_useAllQualities
private
template<class Container , class Base >
bool TemplatedJetProbabilityComputer< Container, Base >::useVariableJTA_
private
template<class Container , class Base >
reco::btag::variableJTAParameters TemplatedJetProbabilityComputer< Container, Base >::varJTApars
private