CMS 3D CMS Logo

PatternRecognitionbyCLUE3D.h
Go to the documentation of this file.
1 // Author: Marco Rovere - marco.rovere@cern.ch
2 // Date: 04/2021
3 
4 #ifndef __RecoHGCal_TICL_PRbyCLUE3D_H__
5 #define __RecoHGCal_TICL_PRbyCLUE3D_H__
6 #include <memory> // unique_ptr
9 
10 namespace ticl {
11  template <typename TILES>
13  public:
15  ~PatternRecognitionbyCLUE3D() override = default;
16 
18  std::vector<Trackster>& result,
19  std::unordered_map<int, std::vector<int>>& seedToTracksterAssociation) override;
20 
21  void energyRegressionAndID(const std::vector<reco::CaloCluster>& layerClusters,
22  const tensorflow::Session*,
23  std::vector<Trackster>& result);
24 
26 
27  private:
28  struct ClustersOnLayer {
29  std::vector<float> x;
30  std::vector<float> y;
31  std::vector<float> z;
32  std::vector<float> r_over_absz;
33  std::vector<float> radius;
34  std::vector<float> eta;
35  std::vector<float> phi;
36  std::vector<int> cells;
37  std::vector<uint8_t> isSilicon;
38 
39  std::vector<float> energy;
40  std::vector<float> rho;
41  std::vector<float> z_extension;
42 
43  std::vector<std::pair<float, int>> delta;
44  std::vector<std::pair<int, int>> nearestHigher;
45  std::vector<int> clusterIndex;
46  std::vector<unsigned int> layerClusterOriginalIdx;
47  std::vector<std::vector<std::pair<int, int>>> followers;
48  std::vector<bool> isSeed;
49 
50  void clear() {
51  x.clear();
52  y.clear();
53  z.clear();
54  r_over_absz.clear();
55  radius.clear();
56  eta.clear();
57  phi.clear();
58  cells.clear();
59  isSilicon.clear();
60  energy.clear();
61  rho.clear();
62  z_extension.clear();
63  delta.clear();
64  nearestHigher.clear();
65  clusterIndex.clear();
67  followers.clear();
68  isSeed.clear();
69  }
70 
71  void shrink_to_fit() {
72  x.shrink_to_fit();
73  y.shrink_to_fit();
74  z.shrink_to_fit();
75  r_over_absz.shrink_to_fit();
76  radius.shrink_to_fit();
77  eta.shrink_to_fit();
78  phi.shrink_to_fit();
79  cells.shrink_to_fit();
80  isSilicon.shrink_to_fit();
81  energy.shrink_to_fit();
82  rho.shrink_to_fit();
83  z_extension.shrink_to_fit();
84  delta.shrink_to_fit();
85  nearestHigher.shrink_to_fit();
86  clusterIndex.shrink_to_fit();
87  layerClusterOriginalIdx.shrink_to_fit();
88  followers.shrink_to_fit();
89  isSeed.shrink_to_fit();
90  }
91  };
92 
93  void reset() {
94  for (auto& c : clusters_) {
95  c.clear();
96  c.shrink_to_fit();
97  }
98  }
99  void calculateLocalDensity(const TILES&, const int layerId, const std::vector<std::pair<int, int>>&);
100  void calculateDistanceToHigher(const TILES&, const int layerId, const std::vector<std::pair<int, int>>&);
101  int findAndAssignTracksters(const TILES&, const std::vector<std::pair<int, int>>&);
102  void dumpClusters(const TILES& tiles,
103  const std::vector<std::pair<int, int>>& layerIdx2layerandSoa,
104  const int) const;
105  void dumpTracksters(const std::vector<std::pair<int, int>>& layerIdx2layerandSoa,
106  const int,
107  const std::vector<Trackster>&) const;
108  void dumpTiles(const TILES&) const;
109 
110  std::vector<ClustersOnLayer> clusters_;
111  std::vector<float> layersPosZ_;
112 
114  const double criticalDensity_;
115  const double criticalSelfDensity_;
118  const double densityXYDistanceSqr_;
119  const double kernelDensityFactor_;
124  const bool rescaleDensityByZ_;
126  const double criticalXYDistance_;
128  const double outlierMultiplier_;
130  const std::vector<int> filter_on_categories_;
134  const float eidMinClusterEnergy_;
135  const int eidNLayers_;
136  const int eidNClusters_;
137 
139  tensorflow::Session* eidSession_;
140 
141  static const int eidNFeatures_ = 3;
142  };
143 
144 } // namespace ticl
145 #endif
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result)
PatternRecognitionbyCLUE3D(const edm::ParameterSet &conf, edm::ConsumesCollector)
std::vector< ClustersOnLayer > clusters_
~PatternRecognitionbyCLUE3D() override=default
void calculateDistanceToHigher(const TILES &, const int layerId, const std::vector< std::pair< int, int >> &)
static std::string const input
Definition: EdmProvDump.cc:50
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
void makeTracksters(const typename PatternRecognitionAlgoBaseT< TILES >::Inputs &input, std::vector< Trackster > &result, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) override
int findAndAssignTracksters(const TILES &, const std::vector< std::pair< int, int >> &)
std::vector< std::vector< std::pair< int, int > > > followers
void dumpClusters(const TILES &tiles, const std::vector< std::pair< int, int >> &layerIdx2layerandSoa, const int) const
void calculateLocalDensity(const TILES &, const int layerId, const std::vector< std::pair< int, int >> &)
Definition: Common.h:8
const std::vector< int > filter_on_categories_
void dumpTracksters(const std::vector< std::pair< int, int >> &layerIdx2layerandSoa, const int, const std::vector< Trackster > &) const