CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/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, bool switchOff2TrackVertex) {
00065     transvSize_ = transvSize;
00066     longSize_   = longSize;
00067     primaryVertexCut_ = primaryVertexCut;
00068     tobCut_ = tobCut;
00069     tecCut_ = tecCut;
00070     minAdaptWeight_ = minAdaptWeight;
00071     switchOff2TrackVertex_ = switchOff2TrackVertex;
00072   }
00073 
00075   void setDebug( bool debug ) {debug_ = debug;}
00076 
00078   void setEdmParameters( const MagneticField* magField,
00079                          edm::ESHandle<GlobalTrackingGeometry> globTkGeomHandle,
00080                          edm::ESHandle<TrackerGeometry> tkerGeomHandle){ 
00081     magField_ = magField; 
00082     globTkGeomHandle_ = globTkGeomHandle;
00083     tkerGeomHandle_ = tkerGeomHandle; 
00084   }
00085 
00086   void setTracksSelector(edm::ParameterSet ps){
00087     helper_.setTracksSelector(ps);
00088   }
00089 
00090   void setVertexIdentifier(edm::ParameterSet ps){
00091     helper_.setVertexIdentifier(ps);
00092   }
00093 
00094   void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle, 
00095                         edm::Handle< reco::BeamSpot > beamSpotHandle){
00096     helper_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
00097   }
00098 
00099   void setAVFParameters(edm::ParameterSet ps){
00100       sigmacut_ = ps.getParameter<double>("sigmacut");
00101       t_ini_    = ps.getParameter<double>("Tini");
00102       ratio_    = ps.getParameter<double>("ratio");
00103   }
00104 
00106   void  setInput(const edm::Handle< reco::PFDisplacedVertexCandidateCollection >&); 
00107   
00108   
00110   std::auto_ptr< reco::PFDisplacedVertexCollection > transferDisplacedVertices() {return displacedVertices_;}
00111 
00112   const std::auto_ptr< reco::PFDisplacedVertexCollection >& displacedVertices() const {return displacedVertices_;}
00113 
00114 
00115 
00117 
00118   void findDisplacedVertices();
00119 
00120 
00121  private:
00122   
00124 
00126   void findSeedsFromCandidate(reco::PFDisplacedVertexCandidate&, reco::PFDisplacedVertexSeedCollection&);
00127 
00129   void mergeSeeds(reco::PFDisplacedVertexSeedCollection&, std::vector<bool>& bLocked);
00130 
00132   bool fitVertexFromSeed(reco::PFDisplacedVertexSeed&, reco::PFDisplacedVertex&);
00133 
00135   void selectAndLabelVertices(reco::PFDisplacedVertexCollection&,  std::vector <bool>&);
00136 
00137   bool rejectAndLabelVertex(reco::PFDisplacedVertex& dv);
00138 
00140 
00141   bool isCloseTo(const reco::PFDisplacedVertexSeed&, const reco::PFDisplacedVertexSeed&) const;
00142 
00143   double getTransvDiff(const GlobalPoint&, const GlobalPoint&) const;
00144   double getLongDiff(const GlobalPoint&, const GlobalPoint&) const;
00145   double getLongProj(const GlobalPoint&, const GlobalVector&) const;
00146 
00147   reco::PFDisplacedVertex::VertexTrackType getVertexTrackType(PFTrackHitFullInfo&) const;
00148 
00149   unsigned commonTracks(const reco::PFDisplacedVertex&, const reco::PFDisplacedVertex&) const;
00150 
00151   friend std::ostream& operator<<(std::ostream&, const PFDisplacedVertexFinder&);
00152 
00153 
00155 
00156   std::auto_ptr< reco::PFDisplacedVertexCandidateCollection >  displacedVertexCandidates_;
00157   std::auto_ptr< reco::PFDisplacedVertexCollection >    displacedVertices_;
00158 
00160 
00162 
00163   double transvSize_;
00164   double longSize_;
00165   double primaryVertexCut_;
00166   double tobCut_;
00167   double tecCut_;
00168   double minAdaptWeight_;
00169 
00170   bool switchOff2TrackVertex_;
00171 
00173   
00174   double sigmacut_; //= 6;
00175   double t_ini_; //= 256.;
00176   double ratio_; //= 0.25;
00177 
00178 
00180   bool   debug_;
00181   
00183   edm::ESHandle<GlobalTrackingGeometry> globTkGeomHandle_;
00184 
00186   edm::ESHandle<TrackerGeometry> tkerGeomHandle_;
00187 
00189   const MagneticField* magField_;
00190 
00191   
00192   PFCheckHitPattern hitPattern_;
00193 
00194   PFDisplacedVertexHelper helper_;
00195 
00196 };
00197 
00198 #endif
00199 
00200