00001 #ifndef KDTreeLinkerBase_h 00002 #define KDTreeLinkerBase_h 00003 00004 #include "DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h" 00005 #include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h" 00006 00007 #include <vector> 00008 00009 class KDTreeLinkerBase 00010 { 00011 public: 00012 KDTreeLinkerBase(); 00013 00014 virtual ~KDTreeLinkerBase(); 00015 00016 // Get/Set of the maximal size of the cristal (ECAL, HCAL,...) in phi/eta and 00017 // X/Y. By default, thus value are set for the ECAL cristal. 00018 void setCristalPhiEtaMaxSize(float size); 00019 void setCristalXYMaxSize(float size); 00020 float getCristalPhiEtaMaxSize() const; 00021 float getCristalXYMaxSize() const; 00022 00023 // Get/Set phi offset. See bellow in the description of phiOffset_ to understand 00024 // the application. 00025 void setPhiOffset(double phiOffset); 00026 float getPhiOffset() const; 00027 00028 // Debug flag. 00029 void setDebug(bool isDebug); 00030 00031 // With this method, we create the list of elements that we want to link. 00032 virtual void insertTargetElt(reco::PFBlockElement *target) = 0; 00033 00034 // Here, we create the list of cluster that we want to link. From cluster 00035 // and fraction, we will create a second list of rechits that will be used to 00036 // build the KDTree. 00037 virtual void insertFieldClusterElt(reco::PFBlockElement *cluster) = 0; 00038 00039 // The KDTree building from rechits list. 00040 virtual void buildTree() = 0; 00041 00042 // Here we will iterate over all target elements. For each one, we will search the closest 00043 // rechits in the KDTree, from rechits we will find the associated clusters and after that 00044 // we will check the links between the target and all closest clusters. 00045 virtual void searchLinks() = 0; 00046 00047 // Here, we will store all target/cluster founded links in the PFBlockElement class 00048 // of each target in the PFmultilinks field. 00049 virtual void updatePFBlockEltWithLinks() = 0; 00050 00051 // Here we free all allocated structures. 00052 virtual void clear() = 0; 00053 00054 // This method calls is the good order buildTree(), searchLinks(), 00055 // updatePFBlockEltWithLinks() and clear() 00056 virtual void process(); 00057 00058 protected: 00059 // Cristal maximal size. By default, thus value are set for the ECAL cristal. 00060 float cristalPhiEtaMaxSize_; 00061 float cristalXYMaxSize_; 00062 00063 // Usually, phi is between -Pi and +Pi. But phi space is circular, that's why an element 00064 // with phi = 3.13 and another with phi = -3.14 are close. To solve this problem, during 00065 // the kdtree building step, we duplicate some elements close enough to +Pi (resp -Pi) by 00066 // substracting (adding) 2Pi. This field define the threshold of this operation. 00067 float phiOffset_; 00068 00069 // Debug boolean. Not used until now. 00070 bool debug_; 00071 }; 00072 00073 00074 #endif /* !KDTreeLinkerBase_h */