CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidate.h

Go to the documentation of this file.
00001 #ifndef DataFormat_ParticleFlowReco_PFDisplacedVertexCandidate_h
00002 #define DataFormat_ParticleFlowReco_PFDisplacedVertexCandidate_h 
00003 
00004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00005 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00006 
00007 #include <vector>
00008 #include <map>
00009 #include <iostream>
00010 
00011 namespace reco {
00012 
00013   
00015 
00029   class PFDisplacedVertexCandidate {
00030 
00031 
00032   public:
00033 
00037     struct VertexLink {
00038       VertexLink()   : distance_(-1), dcaPoint_(0,0,0), test_(0) {}
00039       VertexLink(float d, GlobalPoint p, char t) : distance_(d), dcaPoint_(p), test_(t) {}
00040       float distance_;
00041       GlobalPoint dcaPoint_;
00042       char test_;
00043     };
00044 
00047     enum VertexLinkTest {
00048       LINKTEST_DCA,
00049       LINKTEST_DUMMY,
00050       LINKTEST_ALL
00051     };
00052 
00053     
00054     typedef std::map< unsigned int, VertexLink >  VertexLinkData;
00055 
00058     typedef std::map< float, std::pair<int,int> > DistMap;
00059     typedef std::vector< float > DistVector;
00060 
00062     PFDisplacedVertexCandidate();
00063 
00064 
00066     void addElement(const TrackBaseRef);
00067 
00071     void setLink(unsigned i1, 
00072                  unsigned i2, 
00073                  const float dist, 
00074                  const GlobalPoint& dcaPoint,
00075                  const VertexLinkTest test=LINKTEST_DCA );
00076 
00077     
00079     void associatedElements( const unsigned i,
00080                              const VertexLinkData& vertexLinkData, 
00081                              std::multimap<float, unsigned>& sortedAssociates,
00082                              const VertexLinkTest test=LINKTEST_DCA ) const; 
00083 
00085 
00087     DistMap r2Map() const;
00088 
00091     DistVector r2Vector() const;
00092 
00094     DistVector distVector() const;
00095     
00097     const GlobalPoint dcaPoint( unsigned ie1, unsigned ie2) const;
00098 
00099 
00101     bool isValid() const 
00102       {return elements_.size()>1;}    
00103 
00104 
00106     const TrackBaseRef& tref(unsigned ie) const 
00107       {return elements_[ie];}
00108 
00110     const std::vector < TrackBaseRef >& elements() const 
00111       {return elements_;}
00112 
00114     unsigned nTracks() const 
00115       {return elements_.size();}
00116  
00117 
00119     const VertexLinkData& vertexLinkData() const 
00120       {return vertexLinkData_;}
00121 
00123     void Dump(std::ostream& out = std::cout) const;
00124 
00125   private:
00126 
00128 
00130     const float dist( unsigned ie1, unsigned ie2) const;
00131 
00133     bool testLink (unsigned ie1, unsigned ie2) const;
00134 
00136     friend std::ostream& operator<<( std::ostream&, const PFDisplacedVertexCandidate& );
00137     
00138      
00140 
00143     unsigned vertexLinkDataSize() const;
00144 
00147     bool matrix2vector(unsigned i, unsigned j, unsigned& index) const;
00148 
00149 
00151 
00153     std::vector < TrackBaseRef >          elements_;
00154 
00156     VertexLinkData                        vertexLinkData_;
00157 
00158 
00159   };
00160 }
00161 
00162 #endif
00163 
00164 
00165