CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackCountingComputer.h
Go to the documentation of this file.
1 #ifndef ImpactParameter_TrackCountingComputer_h
2 #define ImpactParameter_TrackCountingComputer_h
3 
8 #include "Math/GenVector/VectorUtil.h"
10 
12 {
13  public:
15  {
16  m_nthTrack = parameters.getParameter<int>("nthTrack");
17  m_ipType = parameters.getParameter<int>("impactParameterType");
18  m_deltaR = parameters.getParameter<double>("deltaR");
19  m_cutMaxDecayLen = parameters.getParameter<double>("maximumDecayLength"); //used
20  m_cutMaxDistToAxis = parameters.getParameter<double>("maximumDistanceToJetAxis"); //used
21  //
22  // access track quality class; "any" takes everything
23  //
24  std::string trackQualityType = parameters.getParameter<std::string>("trackQualityClass"); //used
26  m_useAllQualities = false;
27  if (trackQualityType == "any" ||
28  trackQualityType == "Any" ||
29  trackQualityType == "ANY" ) m_useAllQualities = true;
30 
31  uses("ipTagInfos");
32  }
33 
34 
35  float discriminator(const TagInfoHelper & ti) const
36  {
37  const reco::TrackIPTagInfo & tkip = ti.get<reco::TrackIPTagInfo>();
38  std::multiset<float> significances = orderedSignificances(tkip);
39  std::multiset<float>::reverse_iterator nth=significances.rbegin();
40  for(int i=0;i<m_nthTrack-1 && nth!=significances.rend();i++) nth++;
41  if(nth!=significances.rend()) return *nth; else return -100.;
42  }
43 
44  protected:
45  std::multiset<float> orderedSignificances(const reco::TrackIPTagInfo & tkip) const {
46 
47  const std::vector<reco::TrackIPTagInfo::TrackIPData> & impactParameters((tkip.impactParameterData()));
49  std::multiset<float> significances;
50  int i=0;
51  if(tkip.primaryVertex().isNull()) { return std::multiset<float>();}
52 
53  GlobalPoint pv(tkip.primaryVertex()->position().x(),tkip.primaryVertex()->position().y(),tkip.primaryVertex()->position().z());
54 
55  for(std::vector<reco::TrackIPTagInfo::TrackIPData>::const_iterator it = impactParameters.begin(); it!=impactParameters.end(); ++it, i++)
56  {
57  if( fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis && // distance to JetAxis
58  (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen && // max decay len
59  (m_useAllQualities == true || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
60  )
61  {
62  if(m_deltaR <=0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR)
63  significances.insert( ((m_ipType==0)?it->ip3d:it->ip2d).significance() );
64  }
65  }
66 
67  return significances;
68  }
69 
70 
71 
73  int m_ipType;
74  double m_deltaR;
79 };
80 
81 #endif // ImpactParameter_TrackCountingComputer_h
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
const T & get(unsigned int index=0) const
const edm::Ref< VertexCollection > & primaryVertex() const
TrackQuality
track quality
Definition: TrackBase.h:95
std::multiset< float > orderedSignificances(const reco::TrackIPTagInfo &tkip) const
bool isNull() const
Checks for null.
Definition: Ref.h:247
TrackCountingComputer(const edm::ParameterSet &parameters)
double p4[4]
Definition: TauolaWrapper.h:92
void uses(unsigned int id, const std::string &label)
float discriminator(const TagInfoHelper &ti) const
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
Definition: JTATagInfo.h:20
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:46
tuple tracks
Definition: testEve_cfg.py:39
const std::vector< TrackIPData > & impactParameterData() const
reco::TrackBase::TrackQuality m_trackQuality
const edm::RefVector< TrackCollection > & selectedTracks() const