CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoVertex/NuclearInteractionProducer/interface/NuclearVertexBuilder.h

Go to the documentation of this file.
00001 #ifndef NuclearVertexBuilder_h_
00002 #define NuclearVertexBuilder_h_
00003 
00004 #include "DataFormats/VertexReco/interface/Vertex.h"
00005 #include "DataFormats/TrackReco/interface/Track.h"
00006 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00007 #include "MagneticField/Engine/interface/MagneticField.h"
00008 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00009 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00010 #include "TrackingTools/PatternTools/interface/ClosestApproachInRPhi.h"
00011 
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 
00014 class FreeTrajectoryState;
00015 
00016 class NuclearVertexBuilder {
00017 
00018   public :
00019        NuclearVertexBuilder( const MagneticField * mag, const TransientTrackBuilder* transientTkBuilder, const edm::ParameterSet& iConfig ) : 
00020                theMagField(mag), 
00021                theTransientTrackBuilder(transientTkBuilder), 
00022                minDistFromPrim_( iConfig.getParameter<double>("minDistFromPrimary") ),
00023                chi2Cut_(iConfig.getParameter<double>("chi2Cut")), 
00024                DPtovPtCut_(iConfig.getParameter<double>("DPtovPtCut")),
00025                minDistFromVtx_(iConfig.getParameter<double>("minDistFromVtx")),
00026                shareFrac_(iConfig.getParameter<double>("shareFrac")){}
00027 
00028        void build( const reco::TrackRef& primaryTrack, std::vector<reco::TrackRef>& secondaryTrack );
00029        reco::Vertex  getVertex() const { return the_vertex; } 
00030        bool isCompatible( const reco::TrackRef& secTrack ) const;
00031        void addSecondaryTrack( const reco::TrackRef& secTrack );
00032        ClosestApproachInRPhi* closestApproach( const reco::TrackRef& primTrack, const reco::TrackRef& secTrack ) const;
00033 
00034 
00035   private :
00036        FreeTrajectoryState getTrajectory(const reco::TrackRef& track) const;
00037        bool FillVertexWithCrossingPoint(const reco::TrackRef& primTrack, const std::vector<reco::TrackRef>& secTracks);
00038        bool FillVertexWithAdaptVtxFitter(const reco::TrackRef& primTrack, const std::vector<reco::TrackRef>& secTracks);
00039        void FillVertexWithLastPrimHit(const reco::TrackRef& primTrack, const std::vector<reco::TrackRef>& secTracks);
00040        bool isGoodSecondaryTrack( const reco::TrackRef& primTrack,  const reco::TrackRef& secTrack ) const;
00041        bool isGoodSecondaryTrack( const reco::TrackRef& secTrack,
00042                                   const reco::TrackRef& primTrack,
00043                                   const double& distOfClosestApp,
00044                                   const GlobalPoint& crossPoint ) const;
00045        void cleanTrackCollection( const reco::TrackRef& primTrack,
00046                                   std::vector<reco::TrackRef>& tC) const;
00047        void checkEnergy( const reco::TrackRef& primTrack,
00048                          std::vector<reco::TrackRef>& tC) const;
00049 
00050        reco::Vertex  the_vertex;
00051 
00052 
00053        const MagneticField * theMagField;
00054        const TransientTrackBuilder* theTransientTrackBuilder;
00055        double minDistFromPrim_;
00056        double chi2Cut_;
00057        double DPtovPtCut_;
00058        double minDistFromVtx_;
00059        double shareFrac_;
00060 
00061        class cmpTracks {
00062           public:
00063                 bool operator () (const reco::TrackRef& a, const reco::TrackRef& b) {
00064                   if( a->numberOfValidHits() != b->numberOfValidHits()) return (a->numberOfValidHits()> b->numberOfValidHits());
00065                   else return (a->normalizedChi2()<b->normalizedChi2());
00066                 }
00067         };
00068 
00069 };
00070 
00071 #endif