00001 #ifndef RecoBTag_GhostTrackVertexFinder_h
00002 #define RecoBTag_GhostTrackVertexFinder_h
00003
00004 #include <memory>
00005 #include <vector>
00006 #include <set>
00007
00008 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00009 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00010 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
00011
00012 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00013 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00014
00015 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00016
00017 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
00018 #include "RecoVertex/VertexPrimitives/interface/VertexFitter.h"
00019 #include "RecoVertex/VertexPrimitives/interface/VertexReconstructor.h"
00020
00021 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackFitter.h"
00022 #include "RecoVertex/GhostTrackFitter/interface/GhostTrack.h"
00023
00024 namespace reco {
00025
00026 class GhostTrack;
00027 class GhostTrackFitter;
00028
00029 class GhostTrackVertexFinder {
00030 public:
00031 enum FitType {
00032 kAlwaysWithGhostTrack,
00033 kSingleTracksWithGhostTrack,
00034 kRefitGhostTrackWithVertices
00035 };
00036
00037 GhostTrackVertexFinder();
00038 GhostTrackVertexFinder(double maxFitChi2, double mergeThreshold,
00039 double primcut, double seccut,
00040 FitType fitType);
00041 ~GhostTrackVertexFinder();
00042
00043 std::vector<TransientVertex>
00044 vertices(const reco::Vertex &primaryVertex,
00045 const GlobalVector &direction,
00046 double coneRadius,
00047 const std::vector<TransientTrack> &tracks) const;
00048
00049 std::vector<TransientVertex>
00050 vertices(const GlobalPoint &primaryPosition,
00051 const GlobalError &primaryError,
00052 const GlobalVector &direction,
00053 double coneRadius,
00054 const std::vector<TransientTrack> &tracks) const;
00055
00056 std::vector<TransientVertex>
00057 vertices(const reco::Vertex &primaryVertex,
00058 const GlobalVector &direction,
00059 double coneRadius,
00060 const reco::BeamSpot &beamSpot,
00061 const std::vector<TransientTrack> &tracks) const;
00062
00063 std::vector<TransientVertex>
00064 vertices(const GlobalPoint &primaryPosition,
00065 const GlobalError &primaryError,
00066 const GlobalVector &direction,
00067 double coneRadius,
00068 const reco::BeamSpot &beamSpot,
00069 const std::vector<TransientTrack> &tracks) const;
00070
00071 std::vector<TransientVertex>
00072 vertices(const reco::Vertex &primaryVertex,
00073 const GlobalVector &direction,
00074 double coneRadius,
00075 const reco::BeamSpot &beamSpot,
00076 const std::vector<TransientTrack> &primaries,
00077 const std::vector<TransientTrack> &tracks) const;
00078
00079 std::vector<TransientVertex>
00080 vertices(const GlobalPoint &primaryPosition,
00081 const GlobalError &primaryError,
00082 const GlobalVector &direction,
00083 double coneRadius,
00084 const reco::BeamSpot &beamSpot,
00085 const std::vector<TransientTrack> &primaries,
00086 const std::vector<TransientTrack> &tracks) const;
00087
00088 std::vector<TransientVertex>
00089 vertices(const reco::Vertex &primaryVertex,
00090 const reco::Track &ghostTrack,
00091 const std::vector<TransientTrack> &tracks,
00092 const std::vector<float> &weights = std::vector<float>()) const;
00093
00094 std::vector<TransientVertex>
00095 vertices(const reco::Vertex &primaryVertex,
00096 const reco::Track &ghostTrack,
00097 const reco::BeamSpot &beamSpot,
00098 const std::vector<TransientTrack> &tracks,
00099 const std::vector<float> &weights = std::vector<float>()) const;
00100
00101 std::vector<TransientVertex>
00102 vertices(const reco::Vertex &primaryVertex,
00103 const reco::Track &ghostTrack,
00104 const reco::BeamSpot &beamSpot,
00105 const std::vector<TransientTrack> &primaries,
00106 const std::vector<TransientTrack> &tracks,
00107 const std::vector<float> &weights = std::vector<float>()) const;
00108
00109 std::vector<TransientVertex>
00110 vertices(const GlobalPoint &primaryPosition,
00111 const GlobalError &primaryError,
00112 const GhostTrack &ghostTrack) const;
00113
00114 std::vector<TransientVertex>
00115 vertices(const GlobalPoint &primaryPosition,
00116 const GlobalError &primaryError,
00117 const reco::BeamSpot &beamSpot,
00118 const GhostTrack &ghostTrack) const;
00119
00120 std::vector<TransientVertex>
00121 vertices(const GlobalPoint &primaryPosition,
00122 const GlobalError &primaryError,
00123 const reco::BeamSpot &beamSpot,
00124 const std::vector<TransientTrack> &primaries,
00125 const GhostTrack &ghostTrack) const;
00126
00127 std::vector<TransientVertex>
00128 vertices(const reco::Vertex &primaryVertex,
00129 const GhostTrack &ghostTrack) const;
00130
00131 std::vector<TransientVertex>
00132 vertices(const reco::Vertex &primaryVertex,
00133 const reco::BeamSpot &beamSpot,
00134 const GhostTrack &ghostTrack) const;
00135
00136 std::vector<TransientVertex>
00137 vertices(const reco::Vertex &primaryVertex,
00138 const reco::BeamSpot &beamSpot,
00139 const std::vector<TransientTrack> &primaries,
00140 const GhostTrack &ghostTrack) const;
00141
00142 std::vector<TransientVertex> vertices(
00143 const GhostTrack &ghostTrack,
00144 const CachingVertex<5> &primary = CachingVertex<5>(),
00145 const reco::BeamSpot &beamSpot = reco::BeamSpot(),
00146 bool hasBeamSpot = false, bool hasPrimaries = false) const;
00147
00148 private:
00149 struct FinderInfo;
00150
00151 std::vector<CachingVertex<5> > initialVertices(
00152 const FinderInfo &info) const;
00153
00154 CachingVertex<5> mergeVertices(const CachingVertex<5> &vertex1,
00155 const CachingVertex<5> &vertex2,
00156 const FinderInfo &info,
00157 bool isPrimary) const;
00158
00159 bool recursiveMerge(std::vector<CachingVertex<5> > &vertices,
00160 const FinderInfo &info) const;
00161
00162 bool reassignTracks(std::vector<CachingVertex<5> > &vertices,
00163 const FinderInfo &info) const;
00164
00165 void refitGhostTrack(std::vector<CachingVertex<5> > &vertices,
00166 FinderInfo &info) const;
00167
00168 GhostTrackFitter &ghostTrackFitter() const;
00169 VertexFitter<5> &vertexFitter(bool primary) const;
00170
00171 static double vertexCompat(const CachingVertex<5> &vtx1,
00172 const CachingVertex<5> &vtx2,
00173 const FinderInfo &info,
00174 double scale1 = 1.0, double scale2 = 1.0);
00175
00176 double maxFitChi2_;
00177 double mergeThreshold_;
00178 double primcut_;
00179 double seccut_;
00180 FitType fitType_;
00181
00182 mutable std::auto_ptr<GhostTrackFitter> ghostTrackFitter_;
00183 mutable std::auto_ptr<VertexFitter<5> > primVertexFitter_;
00184 mutable std::auto_ptr<VertexFitter<5> > secVertexFitter_;
00185 };
00186
00187 }
00188 #endif // RecoBTag_GhostTrackVertexFinder_h