CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoParticleFlow/PFTracking/interface/PFDisplacedVertexFinder.h

Go to the documentation of this file.
00001 #ifndef RecoParticleFlow_PFTracking_PFDisplacedVertexFinder_h
00002 #define RecoParticleFlow_PFTracking_PFDisplacedVertexFinder_h 
00003 
00004 #include "RecoParticleFlow/PFTracking/interface/PFDisplacedVertexHelper.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 
00007 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidate.h"
00008 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidateFwd.h"
00009 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexSeed.h"
00010 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexSeedFwd.h"
00011 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h"
00012 #include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h"
00013 
00014 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00015 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00016 
00017 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00018 
00019 #include "RecoParticleFlow/PFTracking/interface/PFCheckHitPattern.h"
00020 
00021 
00023 
00028 class TrackingGeometry;
00029 class TrackerGeometry;
00030 class MagneticField;
00031 
00032 class PFDisplacedVertexFinder {
00033 
00034  public:
00035 
00036   PFDisplacedVertexFinder();
00037 
00038   ~PFDisplacedVertexFinder();
00039 
00041 
00042   typedef std::set< reco::TrackBaseRef >::iterator IEset;
00043   typedef reco::PFDisplacedVertexCandidateCollection::iterator IDVC;
00044   typedef reco::PFDisplacedVertexSeedCollection::iterator IDVS;
00045   typedef reco::PFDisplacedVertexCollection::iterator IDV;
00046 
00047   typedef std::pair <unsigned int, unsigned int> PFTrackHitInfo;
00048   typedef std::pair <PFTrackHitInfo, PFTrackHitInfo> PFTrackHitFullInfo;
00049 
00051   enum FitterType {
00052     F_NOTDEFINED,
00053     F_DONOTREFIT,
00054     F_KALMAN,
00055     F_ADAPTIVE
00056   };
00057 
00058 
00060 
00062   void setParameters(double transvSize, double longSize, 
00063                      double primaryVertexCut, double tobCut, 
00064                      double tecCut, double minAdaptWeight) {
00065     transvSize_ = transvSize;
00066     longSize_   = longSize;
00067     primaryVertexCut_ = primaryVertexCut;
00068     tobCut_ = tobCut;
00069     tecCut_ = tecCut;
00070     minAdaptWeight_ = minAdaptWeight;
00071   }
00072 
00074   void setDebug( bool debug ) {debug_ = debug;}
00075 
00077   void setEdmParameters( const MagneticField* magField,
00078                          edm::ESHandle<GlobalTrackingGeometry> globTkGeomHandle,
00079                          edm::ESHandle<TrackerGeometry> tkerGeomHandle){ 
00080     magField_ = magField; 
00081     globTkGeomHandle_ = globTkGeomHandle;
00082     tkerGeomHandle_ = tkerGeomHandle; 
00083   }
00084 
00085   void setTracksSelector(edm::ParameterSet ps){
00086     helper_.setTracksSelector(ps);
00087   }
00088 
00089   void setVertexIdentifier(edm::ParameterSet ps){
00090     helper_.setVertexIdentifier(ps);
00091   }
00092 
00093   void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle, 
00094                         edm::Handle< reco::BeamSpot > beamSpotHandle){
00095     helper_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
00096   }
00097 
00098   void setAVFParameters(edm::ParameterSet ps){
00099       sigmacut_ = ps.getParameter<double>("sigmacut");
00100       t_ini_    = ps.getParameter<double>("Tini");
00101       ratio_    = ps.getParameter<double>("ratio");
00102   }
00103 
00105   void  setInput(const edm::Handle< reco::PFDisplacedVertexCandidateCollection >&); 
00106   
00107   
00109   std::auto_ptr< reco::PFDisplacedVertexCollection > transferDisplacedVertices() {return displacedVertices_;}
00110 
00111   const std::auto_ptr< reco::PFDisplacedVertexCollection >& displacedVertices() const {return displacedVertices_;}
00112 
00113 
00114 
00116 
00117   void findDisplacedVertices();
00118 
00119 
00120  private:
00121   
00123 
00125   void findSeedsFromCandidate(reco::PFDisplacedVertexCandidate&, reco::PFDisplacedVertexSeedCollection&);
00126 
00128   void mergeSeeds(reco::PFDisplacedVertexSeedCollection&, std::vector<bool>& bLocked);
00129 
00131   bool fitVertexFromSeed(reco::PFDisplacedVertexSeed&, reco::PFDisplacedVertex&);
00132 
00134   void selectAndLabelVertices(reco::PFDisplacedVertexCollection&,  std::vector <bool>&);
00135 
00136   bool rejectAndLabelVertex(reco::PFDisplacedVertex& dv);
00137 
00139 
00140   bool isCloseTo(const reco::PFDisplacedVertexSeed&, const reco::PFDisplacedVertexSeed&) const;
00141 
00142   double getTransvDiff(const GlobalPoint&, const GlobalPoint&) const;
00143   double getLongDiff(const GlobalPoint&, const GlobalPoint&) const;
00144   double getLongProj(const GlobalPoint&, const GlobalVector&) const;
00145 
00146   reco::PFDisplacedVertex::VertexTrackType getVertexTrackType(PFTrackHitFullInfo&) const;
00147 
00148   unsigned commonTracks(const reco::PFDisplacedVertex&, const reco::PFDisplacedVertex&) const;
00149 
00150   friend std::ostream& operator<<(std::ostream&, const PFDisplacedVertexFinder&);
00151 
00152 
00154 
00155   std::auto_ptr< reco::PFDisplacedVertexCandidateCollection >  displacedVertexCandidates_;
00156   std::auto_ptr< reco::PFDisplacedVertexCollection >    displacedVertices_;
00157 
00159 
00161 
00162   double transvSize_;
00163   double longSize_;
00164   double primaryVertexCut_;
00165   double tobCut_;
00166   double tecCut_;
00167   double minAdaptWeight_;
00168 
00170   
00171   double sigmacut_; //= 6;
00172   double t_ini_; //= 256.;
00173   double ratio_; //= 0.25;
00174 
00175 
00177   bool   debug_;
00178   
00180   edm::ESHandle<GlobalTrackingGeometry> globTkGeomHandle_;
00181 
00183   edm::ESHandle<TrackerGeometry> tkerGeomHandle_;
00184 
00186   const MagneticField* magField_;
00187 
00188   
00189   PFCheckHitPattern hitPattern_;
00190 
00191   PFDisplacedVertexHelper helper_;
00192 
00193 };
00194 
00195 #endif
00196 
00197