File indexing completed on 2024-04-06 12:04:51
0001 #ifndef RecoParticleFlow_PFAlgo_PFBlock_h
0002 #define RecoParticleFlow_PFAlgo_PFBlock_h
0003
0004 #include <map>
0005 #include <iostream>
0006
0007
0008
0009
0010 #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h"
0011
0012 #include "DataFormats/Common/interface/OwnVector.h"
0013
0014 namespace reco {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 class PFBlock {
0027 public:
0028 struct Link {
0029 Link() : distance(-1), test(0) {}
0030 Link(float d, char t) : distance(d), test(t) {}
0031 float distance;
0032 char test;
0033 };
0034
0035 typedef edm::OwnVector<reco::PFBlockElement>::const_iterator IE;
0036
0037
0038
0039 typedef std::map<unsigned int, Link> LinkData;
0040
0041 enum LinkTest { LINKTEST_RECHIT, LINKTEST_NLINKTEST, LINKTEST_ALL };
0042
0043 PFBlock() {}
0044
0045
0046
0047
0048 void addElement(reco::PFBlockElement* element);
0049
0050 void bookLinkData();
0051
0052
0053
0054 bool matrix2vector(unsigned i, unsigned j, unsigned& index) const;
0055
0056
0057
0058
0059 void setLink(unsigned i1, unsigned i2, double dist, LinkData& linkData, LinkTest test = LINKTEST_RECHIT) const;
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 void associatedElements(unsigned i,
0071 const LinkData& linkData,
0072 std::multimap<double, unsigned>& sortedAssociates,
0073 reco::PFBlockElement::Type type = PFBlockElement::NONE,
0074 LinkTest test = LINKTEST_RECHIT) const;
0075
0076
0077 double dist(unsigned ie1, unsigned ie2, const LinkData& linkData, LinkTest test) const {
0078 return dist(ie1, ie2, linkData);
0079 }
0080
0081
0082 double dist(unsigned ie1, unsigned ie2, const LinkData& linkData) const;
0083
0084
0085 const edm::OwnVector<reco::PFBlockElement>& elements() const { return elements_; }
0086
0087
0088 const LinkData& linkData() const { return linkData_; }
0089
0090
0091 LinkData& linkData() { return linkData_; }
0092
0093 private:
0094
0095 unsigned linkDataSize() const;
0096
0097
0098 LinkData linkData_;
0099
0100
0101 edm::OwnVector<reco::PFBlockElement> elements_;
0102 };
0103
0104 std::ostream& operator<<(std::ostream& out, const PFBlock& co);
0105
0106 }
0107
0108 #endif