CMS 3D CMS Logo

HistogramProbabilityEstimator.cc

Go to the documentation of this file.
00001 
00002 #include "RecoBTag/TrackProbability/interface/HistogramProbabilityEstimator.h"
00003 #include "RecoBTag/TrackProbability/interface/TrackClassFilter.h"
00004 #include "CondFormats/BTauObjects/interface/CalibratedHistogram.h"
00005 
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include <algorithm>
00008 using namespace reco;
00009 using namespace std;
00010 
00011 pair<bool,double> HistogramProbabilityEstimator::probability(bool quality, int ipType,float significance, const Track& track, const Jet & jet, const Vertex & vertex) const 
00012 {
00013  
00014   TrackClassFilter::Input input(quality, track, jet, vertex);
00015  
00016   double trackProbability=0;
00017  
00018      double absSignificance= fabs(significance);
00019   
00020        
00021       const CalibratedHistogram * probabilityHistogram  = 0;
00022       vector<TrackProbabilityCalibration::Entry>::const_iterator found;
00023       vector<TrackProbabilityCalibration::Entry>::const_iterator it;
00024       vector<TrackProbabilityCalibration::Entry>::const_iterator it_end;
00025       if(ipType==0) {it=m_calibration3D->data.begin(); it_end=m_calibration3D->data.end(); }
00026       else if(ipType==1) {it=m_calibration2D->data.begin(); it_end=m_calibration2D->data.end(); }
00027       else return pair<bool,double>(probabilityHistogram ,trackProbability);
00028 
00029       found = std::find_if(it,it_end,bind1st(TrackClassFilter(),input));
00030       if(found!=it_end) probabilityHistogram = &found->histogram;
00031      if(!probabilityHistogram)
00032        {
00033 //        edm::LogWarning ("TrackProbability|HistogramMissing") << " PDF Histogram not found for this track" ;
00034        } else {
00035           trackProbability = 1. - probabilityHistogram->normalizedIntegral(absSignificance);
00036        }             
00037       if(absSignificance!=0)  
00038         trackProbability*=significance/absSignificance;   //Return a "signed" probability
00039     
00040     return pair<bool,double>(probabilityHistogram ,trackProbability);
00041 
00042 }
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 

Generated on Tue Jun 9 17:43:06 2009 for CMSSW by  doxygen 1.5.4