CMS 3D CMS Logo

HistogramProbabilityEstimator.cc
Go to the documentation of this file.
1 
5 
7 #include <algorithm>
8 using namespace reco;
9 using namespace std;
10 
11 pair<bool,double> HistogramProbabilityEstimator::probability(bool quality, int ipType,float significance, const Track& track, const Jet & jet, const Vertex & vertex) const
12 {
13 
14  TrackClassFilter::Input input(quality, track, jet, vertex);
15 
16  double trackProbability=0;
17 
18  double absSignificance= fabs(significance);
19 
20 
21  const CalibratedHistogram * probabilityHistogram = nullptr;
22  vector<TrackProbabilityCalibration::Entry>::const_iterator found;
23  vector<TrackProbabilityCalibration::Entry>::const_iterator it;
24  vector<TrackProbabilityCalibration::Entry>::const_iterator it_end;
25  if(ipType==0) {it=m_calibration3D->data.begin(); it_end=m_calibration3D->data.end(); }
26  else if(ipType==1) {it=m_calibration2D->data.begin(); it_end=m_calibration2D->data.end(); }
27  else return pair<bool,double>(probabilityHistogram ,trackProbability);
28 
29  found = std::find_if(it,it_end,bind1st(TrackClassFilter(),input));
30  if(found!=it_end) probabilityHistogram = &found->histogram;
31  if(!probabilityHistogram)
32  {
33 // edm::LogWarning ("TrackProbability|HistogramMissing") << " PDF Histogram not found for this track" ;
34  } else {
35  trackProbability = 1. - probabilityHistogram->normalizedIntegral(absSignificance);
36  }
37  if(absSignificance!=0)
38  trackProbability*=significance/absSignificance; //Return a "signed" probability
39 
40  return pair<bool,double>(probabilityHistogram ,trackProbability);
41 
42 }
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
static std::string const input
Definition: EdmProvDump.cc:44
Definition: Jet.py:1
double trackProbability(const reco::TrackRef track)
fixed size matrix
std::pair< bool, double > probability(bool quality, int ipType, float significance, const reco::Track &, const reco::Jet &, const reco::Vertex &) const