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::IPTagInfo::primaryVertex
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
reco::IPTagInfo
Definition: IPTagInfo.h:48
mps_fire.i
i
Definition: mps_fire.py:428
PromptTrackCountingComputer
Definition: PromptTrackCountingComputer.h:16
PromptTrackCountingComputer::m_deltaR
double m_deltaR
Definition: PromptTrackCountingComputer.h:92
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
reco::IPTagInfo::selectedTracks
const Container & selectedTracks() const
Definition: IPTagInfo.h:99
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
JetTagComputer::TagInfoHelper
Definition: JetTagComputer.h:16
edm::RefVector< reco::TrackCollection >
PromptTrackCountingComputer::m_cutMaxDistToAxis
double m_cutMaxDistToAxis
Definition: PromptTrackCountingComputer.h:97
PromptTrackCountingComputer::discriminator
float discriminator(const TagInfoHelper &ti) const override
Definition: PromptTrackCountingComputer.h:42
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
JetTagComputer::TagInfoHelper::get
const T & get(unsigned int index=0) const
Definition: JetTagComputer.h:42
PromptTrackCountingComputer::maxImpactParameterSig
double maxImpactParameterSig
Definition: PromptTrackCountingComputer.h:95
JetTagComputer.h
Track.h
PromptTrackCountingComputer::PromptTrackCountingComputer
PromptTrackCountingComputer(const edm::ParameterSet &parameters)
Definition: PromptTrackCountingComputer.h:20
TrackIPTagInfo.h
Point3DBase< float, GlobalTag >
PromptTrackCountingComputer::m_trackQuality
reco::TrackBase::TrackQuality m_trackQuality
Definition: PromptTrackCountingComputer.h:98
PromptTrackCountingComputer::orderedSignificances
std::multiset< float > orderedSignificances(const reco::TrackIPTagInfo &tkip) const
Definition: PromptTrackCountingComputer.h:56
edm::ParameterSet
Definition: ParameterSet.h:47
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
PromptTrackCountingComputer::m_deltaRmin
double m_deltaRmin
Definition: PromptTrackCountingComputer.h:93
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
p4
double p4[4]
Definition: TauolaWrapper.h:92
PromptTrackCountingComputer::m_cutMaxDecayLen
double m_cutMaxDecayLen
Definition: PromptTrackCountingComputer.h:96
PromptTrackCountingComputer::m_useAllQualities
bool m_useAllQualities
Definition: PromptTrackCountingComputer.h:99
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
JetTagComputer
Definition: JetTagComputer.h:14
reco::IPTagInfo::impactParameterData
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:90
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
JetTagComputer::uses
void uses(unsigned int id, const std::string &label)
Definition: JetTagComputer.cc:17
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
PromptTrackCountingComputer::maxImpactParameter
double maxImpactParameter
Definition: PromptTrackCountingComputer.h:94
PromptTrackCountingComputer::Tokens
void Tokens
Definition: PromptTrackCountingComputer.h:18
TrackCountingTagInfo.h
Vertex.h
relativeConstraints.value
value
Definition: relativeConstraints.py:53
PromptTrackCountingComputer::m_nthTrack
int m_nthTrack
Definition: PromptTrackCountingComputer.h:90
funct::void
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
PromptTrackCountingComputer::m_ipType
int m_ipType
Definition: PromptTrackCountingComputer.h:91