CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
KDTreeLinkerBase.h
Go to the documentation of this file.
1 #ifndef KDTreeLinkerBase_h
2 #define KDTreeLinkerBase_h
3 
6 
7 #include <vector>
8 
10 {
11  public:
13 
14  virtual ~KDTreeLinkerBase();
15 
17  _targetType = tgt;
18  }
19 
21  _fieldType = fld;
22  }
23 
25  return _targetType;
26  }
27 
29  return _fieldType;
30  }
31 
32  // Get/Set of the maximal size of the cristal (ECAL, HCAL,...) in phi/eta and
33  // X/Y. By default, thus value are set for the ECAL cristal.
34  void setCristalPhiEtaMaxSize(float size);
35  void setCristalXYMaxSize(float size);
36  float getCristalPhiEtaMaxSize() const;
37  float getCristalXYMaxSize() const;
38 
39  // Get/Set phi offset. See bellow in the description of phiOffset_ to understand
40  // the application.
41  void setPhiOffset(double phiOffset);
42  float getPhiOffset() const;
43 
44  // Debug flag.
45  void setDebug(bool isDebug);
46 
47  // With this method, we create the list of elements that we want to link.
48  virtual void insertTargetElt(reco::PFBlockElement *target) = 0;
49 
50  // Here, we create the list of cluster that we want to link. From cluster
51  // and fraction, we will create a second list of rechits that will be used to
52  // build the KDTree.
53  virtual void insertFieldClusterElt(reco::PFBlockElement *cluster) = 0;
54 
55  // The KDTree building from rechits list.
56  virtual void buildTree() = 0;
57 
58  // Here we will iterate over all target elements. For each one, we will search the closest
59  // rechits in the KDTree, from rechits we will find the associated clusters and after that
60  // we will check the links between the target and all closest clusters.
61  virtual void searchLinks() = 0;
62 
63  // Here, we will store all target/cluster founded links in the PFBlockElement class
64  // of each target in the PFmultilinks field.
65  virtual void updatePFBlockEltWithLinks() = 0;
66 
67  // Here we free all allocated structures.
68  virtual void clear() = 0;
69 
70  // This method calls is the good order buildTree(), searchLinks(),
71  // updatePFBlockEltWithLinks() and clear()
72  virtual void process();
73 
74  protected:
75  // target and field
77  // Cristal maximal size. By default, thus value are set for the ECAL cristal.
80 
81  // Usually, phi is between -Pi and +Pi. But phi space is circular, that's why an element
82  // with phi = 3.13 and another with phi = -3.14 are close. To solve this problem, during
83  // the kdtree building step, we duplicate some elements close enough to +Pi (resp -Pi) by
84  // substracting (adding) 2Pi. This field define the threshold of this operation.
85  float phiOffset_;
86 
87  // Debug boolean. Not used until now.
88  bool debug_;
89 };
90 
91 
92 
93 
96 
97 #endif /* !KDTreeLinkerBase_h */
void setFieldType(const reco::PFBlockElement::Type &fld)
Abstract base class for a PFBlock element (track, cluster...)
virtual void updatePFBlockEltWithLinks()=0
edmplugin::PluginFactory< KDTreeLinkerBase *() > KDTreeLinkerFactory
reco::PFBlockElement::Type _fieldType
void setTargetType(const reco::PFBlockElement::Type &tgt)
virtual ~KDTreeLinkerBase()
void setDebug(bool isDebug)
virtual void buildTree()=0
virtual void insertFieldClusterElt(reco::PFBlockElement *cluster)=0
void setPhiOffset(double phiOffset)
float getCristalXYMaxSize() const
const reco::PFBlockElement::Type & targetType() const
virtual void clear()=0
const reco::PFBlockElement::Type & fieldType() const
void setCristalPhiEtaMaxSize(float size)
float getCristalPhiEtaMaxSize() const
virtual void searchLinks()=0
virtual void process()
virtual void insertTargetElt(reco::PFBlockElement *target)=0
reco::PFBlockElement::Type _targetType
void setCristalXYMaxSize(float size)
float getPhiOffset() const
tuple size
Write out results.