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 //#include "RecoBTag/BTagTools/interface/VariableJTA.h"
11 
13 {
14 
15  public:
17  {
18  m_nthTrack = parameters.getParameter<int>("nthTrack");
19  m_ipType = parameters.getParameter<int>("impactParameterType");
20  m_deltaR = parameters.getParameter<double>("deltaR");
21  m_cutMaxDecayLen = parameters.getParameter<double>("maximumDecayLength"); //used
22  m_cutMaxDistToAxis = parameters.getParameter<double>("maximumDistanceToJetAxis"); //used
23  //
24  // access track quality class; "any" takes everything
25  //
26  std::string trackQualityType = parameters.getParameter<std::string>("trackQualityClass"); //used
28  m_useAllQualities = false;
29  if (trackQualityType == "any" ||
30  trackQualityType == "Any" ||
31  trackQualityType == "ANY" ) m_useAllQualities = true;
32 
33  uses("ipTagInfos");
34 
35  useVariableJTA_ = parameters.existsAs<bool>("useVariableJTA") ? parameters.getParameter<bool>("useVariableJTA") : false ;
36  if (useVariableJTA_){
37  varJTApars = {
38  parameters.getParameter<double>("a_dR"),
39  parameters.getParameter<double>("b_dR"),
40  parameters.getParameter<double>("a_pT"),
41  parameters.getParameter<double>("b_pT"),
42  parameters.getParameter<double>("min_pT"),
43  parameters.getParameter<double>("max_pT"),
44  parameters.getParameter<double>("min_pT_dRcut"),
45  parameters.getParameter<double>("max_pT_dRcut"),
46  parameters.getParameter<double>("max_pT_trackPTcut") };
47  }
48  }
49 
50 
51  float discriminator(const TagInfoHelper & ti) const
52  {
53  const reco::TrackIPTagInfo & tkip = ti.get<reco::TrackIPTagInfo>();
54  std::multiset<float> significances = orderedSignificances(tkip);
55  std::multiset<float>::reverse_iterator nth=significances.rbegin();
56  for(int i=0;i<m_nthTrack-1 && nth!=significances.rend();i++) nth++;
57  if(nth!=significances.rend()) return *nth; else return -100.;
58  }
59 
60  protected:
61 
62  std::multiset<float> orderedSignificances(const reco::TrackIPTagInfo & tkip) const {
63 
64  const std::vector<reco::TrackIPTagInfo::TrackIPData> & impactParameters((tkip.impactParameterData()));
66  std::multiset<float> significances;
67  int i=0;
68  if(tkip.primaryVertex().isNull()) { return std::multiset<float>();}
69 
70  GlobalPoint pv(tkip.primaryVertex()->position().x(),tkip.primaryVertex()->position().y(),tkip.primaryVertex()->position().z());
71 
72  for(std::vector<reco::TrackIPTagInfo::TrackIPData>::const_iterator it = impactParameters.begin(); it!=impactParameters.end(); ++it, i++) {
73  if( fabs(impactParameters[i].distanceToJetAxis.value()) < m_cutMaxDistToAxis && // distance to JetAxis
74  (impactParameters[i].closestToJetAxis - pv).mag() < m_cutMaxDecayLen && // max decay len
75  (m_useAllQualities == true || (*tracks[i]).quality(m_trackQuality)) // use selected track qualities
76  ) {
77  if (useVariableJTA_) {
78  if (tkip.variableJTA( varJTApars )[i]) significances.insert( ((m_ipType==0)?it->ip3d:it->ip2d).significance() );
79  }
80  else // no using variable JTA, use the default method
81  if(m_deltaR <=0 || ROOT::Math::VectorUtil::DeltaR((*tkip.jet()).p4().Vect(), (*tracks[i]).momentum()) < m_deltaR)
82  significances.insert( ((m_ipType==0)?it->ip3d:it->ip2d).significance() );
83  }
84  }
85 
86  return significances;
87  }
88 
89 
92 
94  int m_ipType;
95  double m_deltaR;
100 };
101 
102 #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
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
const edm::Ref< VertexCollection > & primaryVertex() const
TrackQuality
track quality
Definition: TrackBase.h:93
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
reco::TrackIPTagInfo::variableJTAParameters varJTApars
std::vector< bool > variableJTA(const variableJTAParameters &params) const
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
volatile std::atomic< bool > shutdown_flag false
reco::TrackBase::TrackQuality m_trackQuality
const edm::RefVector< TrackCollection > & selectedTracks() const