CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoBTag/SecondaryVertex/interface/SimpleSecondaryVertexComputer.h

Go to the documentation of this file.
00001 #ifndef RecoBTag_SecondaryVertex_SimpleSecondaryVertexComputer_h
00002 #define RecoBTag_SecondaryVertex_SimpleSecondaryVertexComputer_h
00003 
00004 #include <cmath>
00005 
00006 #include "Math/GenVector/VectorUtil.h"
00007 
00008 #include "DataFormats/TrackReco/interface/Track.h"
00009 #include "DataFormats/VertexReco/interface/Vertex.h"
00010 #include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h"
00011 
00012 #include "RecoBTau/JetTagComputer/interface/JetTagComputer.h"
00013 
00014 #include "RecoBTag/SecondaryVertex/interface/TrackKinematics.h"
00015 
00016 class SimpleSecondaryVertexComputer : public JetTagComputer {
00017     public:
00018         SimpleSecondaryVertexComputer(const edm::ParameterSet &parameters) :
00019                 use2d(!parameters.getParameter<bool>("use3d")),
00020                 useSig(parameters.getParameter<bool>("useSignificance")),
00021                 unBoost(parameters.getParameter<bool>("unBoost")),
00022                 minTracks(parameters.getParameter<unsigned int>("minTracks"))
00023         { uses("svTagInfos"); }
00024 
00025         float discriminator(const TagInfoHelper &tagInfos) const
00026         {
00027                 const reco::SecondaryVertexTagInfo &info =
00028                                 tagInfos.get<reco::SecondaryVertexTagInfo>();
00029                 unsigned int idx = 0;
00030                 while(idx < info.nVertices()) {
00031                         if (info.nVertexTracks(idx) >= minTracks)
00032                                 break;
00033                         idx++;
00034                 }
00035                 if (idx >= info.nVertices())
00036                         return -1.0;
00037 
00038                 double gamma;
00039                 if (unBoost) {
00040                         reco::TrackKinematics kinematics(
00041                                                 info.secondaryVertex(idx));
00042                         gamma = kinematics.vectorSum().Gamma();
00043                 } else
00044                         gamma = 1.0;
00045 
00046                 double value;
00047                 if (useSig)
00048                         value = info.flightDistance(idx, use2d).significance();
00049                 else
00050                         value = info.flightDistance(idx, use2d).value();
00051 
00052                 value /= gamma;
00053 
00054                 if (useSig)
00055                         value = (value > 0) ? +std::log(1 + value)
00056                                             : -std::log(1 - value);
00057 
00058                 return value;
00059         }
00060 
00061     private:
00062         bool            use2d;
00063         bool            useSig;
00064         bool            unBoost;
00065         unsigned int    minTracks;
00066 };
00067 
00068 #endif // RecoBTag_SecondaryVertex_SimpleSecondaryVertexComputer_h