CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
18  public:
20  {
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" ||
37  trackQualityType == "Any" ||
38  trackQualityType == "ANY" ) m_useAllQualities = true;
39 
40  uses("ipTagInfos");
41  }
42 
43  float discriminator(const TagInfoHelper & ti) const
44  {
45  const reco::TrackIPTagInfo & tkip = ti.get<reco::TrackIPTagInfo>();
46  std::multiset<float> significances = orderedSignificances(tkip);
47  std::multiset<float>::iterator sig;
48  unsigned int nPromptTrk = 0;
49  for(sig=significances.begin(); sig!=significances.end(); sig++) {
50  if (fabs(*sig) < maxImpactParameterSig) nPromptTrk++;
51  // edm::LogDebug("") << "Track "<< nPromptTrk << " sig=" << *sig;
52  }
53  return double(nPromptTrk);
54  }
55 
56  protected:
57  std::multiset<float> orderedSignificances(const reco::TrackIPTagInfo & tkip) const {
58 
59  const std::vector<reco::btag::TrackIPData> & impactParameters((tkip.impactParameterData()));
61  std::multiset<float> significances;
62  int i=0;
63  if(tkip.primaryVertex().isNull()) { return std::multiset<float>();}
64 
65  GlobalPoint pv(tkip.primaryVertex()->position().x(),tkip.primaryVertex()->position().y(),tkip.primaryVertex()->position().z());
66 
67  for(std::vector<reco::btag::TrackIPData>::const_iterator it = impactParameters.begin(); it!=impactParameters.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 || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
72  )
73  {
74  if ( ( m_deltaR <=0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR ) &&
75  ( m_deltaRmin <=0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) > m_deltaRmin ) ) {
76  if ( fabs(((m_ipType==0)?it->ip3d:it->ip2d).value()) < maxImpactParameter ) {
77  significances.insert( ((m_ipType==0)?it->ip3d:it->ip2d).significance() );
78  }
79  }
80  }
81  }
82 
83  return significances;
84  }
85 
87  int m_ipType;
88  double m_deltaR;
89  double m_deltaRmin;
96 };
97 
98 #endif // ImpactParameter_PromptTrackCountingComputer_h
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
const T & get(unsigned int index=0) const
reco::TrackBase::TrackQuality m_trackQuality
TrackQuality
track quality
Definition: TrackBase.h:151
const Container & selectedTracks() const
Definition: IPTagInfo.h:101
const edm::Ref< VertexCollection > & primaryVertex() const
Definition: IPTagInfo.h:133
float discriminator(const TagInfoHelper &ti) const
double p4[4]
Definition: TauolaWrapper.h:92
void uses(unsigned int id, const std::string &label)
PromptTrackCountingComputer(const edm::ParameterSet &parameters)
bool isNull() const
Checks for null.
Definition: Ref.h:249
const std::vector< btag::TrackIPData > & impactParameterData() const
Definition: IPTagInfo.h:91
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
tuple tracks
Definition: testEve_cfg.py:39
std::multiset< float > orderedSignificances(const reco::TrackIPTagInfo &tkip) const