CMS 3D CMS Logo

PromptTrackCountingComputer.h
Go to the documentation of this file.
1 #ifndef ImpactParameter_PromptTrackCountingComputer_h
2 #define ImpactParameter_PromptTrackCountingComputer_h
3 
4 // This returns a discriminator equal to the number of prompt tracks in the jet
5 // It is intended for exotica physics, not b tagging.
6 // It closely resembles the TrackCountingComputer, but with a different discrinator definition and slightly different cuts.
7 // Author: Ian Tomalin
8 
13 #include "Math/GenVector/VectorUtil.h"
15 
17 public:
18  using Tokens = void;
19 
21  m_nthTrack = parameters.getParameter<int>("nthTrack");
22  m_ipType = parameters.getParameter<int>("impactParameterType");
23  // Maximum and minimum allowed deltaR respectively.
24  m_deltaR = parameters.getParameter<double>("deltaR");
25  m_deltaRmin = parameters.getParameter<double>("deltaRmin");
26  maxImpactParameter = parameters.getParameter<double>("maxImpactParameter");
27  maxImpactParameterSig = parameters.getParameter<double>("maxImpactParameterSig");
28  m_cutMaxDecayLen = parameters.getParameter<double>("maximumDecayLength"); //used
29  m_cutMaxDistToAxis = parameters.getParameter<double>("maximumDistanceToJetAxis"); //used
30  //
31  // access track quality class; "any" takes everything
32  //
33  std::string trackQualityType = parameters.getParameter<std::string>("trackQualityClass"); //used
35  m_useAllQualities = false;
36  if (trackQualityType == "any" || trackQualityType == "Any" || trackQualityType == "ANY")
37  m_useAllQualities = true;
38 
39  uses("ipTagInfos");
40  }
41 
42  float discriminator(const TagInfoHelper& ti) const override {
43  const reco::TrackIPTagInfo& tkip = ti.get<reco::TrackIPTagInfo>();
44  std::multiset<float> significances = orderedSignificances(tkip);
45  std::multiset<float>::iterator sig;
46  unsigned int nPromptTrk = 0;
47  for (sig = significances.begin(); sig != significances.end(); sig++) {
48  if (fabs(*sig) < maxImpactParameterSig)
49  nPromptTrk++;
50  // edm::LogDebug("") << "Track "<< nPromptTrk << " sig=" << *sig;
51  }
52  return double(nPromptTrk);
53  }
54 
55 protected:
56  std::multiset<float> orderedSignificances(const reco::TrackIPTagInfo& tkip) const {
57  const std::vector<reco::btag::TrackIPData>& impactParameters((tkip.impactParameterData()));
59  std::multiset<float> significances;
60  int i = 0;
61  if (tkip.primaryVertex().isNull()) {
62  return std::multiset<float>();
63  }
64 
65  GlobalPoint pv(tkip.primaryVertex()->position().x(),
66  tkip.primaryVertex()->position().y(),
67  tkip.primaryVertex()->position().z());
68 
69  for (std::vector<reco::btag::TrackIPData>::const_iterator it = impactParameters.begin();
70  it != impactParameters.end();
71  ++it, i++) {
72  if (fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis && // distance to JetAxis
73  (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen && // max decay len
74  (m_useAllQualities == true || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
75  ) {
76  if ((m_deltaR <= 0 ||
77  ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR) &&
78  (m_deltaRmin <= 0 ||
79  ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) > m_deltaRmin)) {
80  if (fabs(((m_ipType == 0) ? it->ip3d : it->ip2d).value()) < maxImpactParameter) {
81  significances.insert(((m_ipType == 0) ? it->ip3d : it->ip2d).significance());
82  }
83  }
84  }
85  }
86 
87  return significances;
88  }
89 
91  int m_ipType;
92  double m_deltaR;
93  double m_deltaRmin;
100 };
101 
102 #endif // ImpactParameter_PromptTrackCountingComputer_h
reco::TrackBase::TrackQuality m_trackQuality
std::multiset< float > orderedSignificances(const reco::TrackIPTagInfo &tkip) const
TrackQuality
track quality
Definition: TrackBase.h:150
const T & get(unsigned int index=0) const
const Container & selectedTracks() const
Definition: IPTagInfo.h:99
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
string quality
float discriminator(const TagInfoHelper &ti) const override
void uses(unsigned int id, const std::string &label)
def pv(vc)
Definition: MetAnalyzer.py:7
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:90
PromptTrackCountingComputer(const edm::ParameterSet &parameters)
bool isNull() const
Checks for null.
Definition: Ref.h:235
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133