CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DataFormats/ParticleFlowReco/interface/PFBlock.h

Go to the documentation of this file.
00001 #ifndef RecoParticleFlow_PFAlgo_PFBlock_h
00002 #define RecoParticleFlow_PFAlgo_PFBlock_h 
00003 
00004 #include <map>
00005 #include <iostream>
00006 
00007 /* #include "boost/graph/adjacency_matrix.hpp" */
00008 
00009 
00010 // #include "DataFormats/ParticleFlowReco/interface/PFBlockLink.h"
00011 #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h"
00012 // #include "DataFormats/ParticleFlowReco/interface/PFBlockParticle.h"
00013 #include "DataFormats/Common/interface/OwnVector.h"
00014 
00015 
00016 
00017 namespace reco {
00018 
00019   
00021 
00030   class PFBlock {
00031 
00032 
00033   public:
00034 
00035     struct Link {
00036       Link()   : distance(-1), test(0) {}
00037       Link(float d, char t) : distance(d), test(t) {}
00038       float distance;
00039       char test;
00040     };
00041 
00042     typedef edm::OwnVector< reco::PFBlockElement >::const_iterator IE;
00043     /*     typedef std::vector< reco::PFBlockLink >::const_iterator IL; */
00044     
00045     // typedef std::vector< std::vector<double> > LinkData;
00046     typedef std::map< unsigned int,  Link >  LinkData;
00047     
00048     enum LinkTest {
00049       LINKTEST_RECHIT,
00050       LINKTEST_NLINKTEST,
00051       LINKTEST_ALL
00052     };
00053 
00054     PFBlock() {}
00055     // PFBlock(const PFBlock& other);
00056 
00059     void addElement( reco::PFBlockElement* element );
00060     
00061     void bookLinkData();
00062 
00065     bool matrix2vector(unsigned i, unsigned j, unsigned& index) const;
00066 
00070     void setLink(unsigned i1, 
00071                  unsigned i2, 
00072                  double dist, 
00073                  LinkData& linkData, 
00074                  LinkTest  test=LINKTEST_RECHIT ) const;
00075 
00079 
00080 
00086     void associatedElements( unsigned i,
00087                              const LinkData& linkData, 
00088                              std::multimap<double, unsigned>& sortedAssociates,
00089                              reco::PFBlockElement::Type type = PFBlockElement::NONE,
00090                              LinkTest test=LINKTEST_RECHIT ) const; 
00091       
00092 
00094     double dist(unsigned ie1, 
00095                 unsigned ie2, 
00096                 const LinkData& linkData, 
00097                 LinkTest  test ) const {
00098       return dist(ie1,ie2,linkData);
00099     }
00100 
00102     double dist( unsigned ie1, 
00103                  unsigned ie2, 
00104                  const LinkData& linkData) const;
00105 
00107     const edm::OwnVector< reco::PFBlockElement >& elements() const {
00108       return elements_;
00109     }
00110 
00112     const LinkData& linkData() const {
00113       return linkData_;
00114     }
00115 
00117     LinkData& linkData() {
00118       return linkData_;
00119     }
00120 
00121     friend std::ostream& operator<<( std::ostream& out, const PFBlock& co );
00122 
00123   private:
00124     
00126     unsigned linkDataSize() const;
00127     
00129     LinkData                                        linkData_;
00130      
00132     edm::OwnVector< reco::PFBlockElement >          elements_;
00133         
00134   };
00135 }
00136 
00137 #endif
00138 
00139 
00140