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<int> algoId; // hgcal_em = 6, hgcal_had = 7, hgcal_scintillator = 8, hfnose = 9
38  std::vector<uint8_t> isSilicon;
39 
40  std::vector<float> energy;
41  std::vector<float> rho;
42  std::vector<float> z_extension;
43 
44  std::vector<std::pair<float, int>> delta;
45  std::vector<std::pair<int, int>> nearestHigher;
46  std::vector<int> clusterIndex;
47  std::vector<unsigned int> layerClusterOriginalIdx;
48  std::vector<std::vector<std::pair<int, int>>> followers;
49  std::vector<bool> isSeed;
50 
51  void clear() {
52  x.clear();
53  y.clear();
54  z.clear();
55  r_over_absz.clear();
56  radius.clear();
57  eta.clear();
58  phi.clear();
59  cells.clear();
60  algoId.clear();
61  isSilicon.clear();
62  energy.clear();
63  rho.clear();
64  z_extension.clear();
65  delta.clear();
66  nearestHigher.clear();
67  clusterIndex.clear();
69  followers.clear();
70  isSeed.clear();
71  }
72 
73  void shrink_to_fit() {
74  x.shrink_to_fit();
75  y.shrink_to_fit();
76  z.shrink_to_fit();
77  r_over_absz.shrink_to_fit();
78  radius.shrink_to_fit();
79  eta.shrink_to_fit();
80  phi.shrink_to_fit();
81  cells.shrink_to_fit();
82  algoId.shrink_to_fit();
83  isSilicon.shrink_to_fit();
84  energy.shrink_to_fit();
85  rho.shrink_to_fit();
86  z_extension.shrink_to_fit();
87  delta.shrink_to_fit();
88  nearestHigher.shrink_to_fit();
89  clusterIndex.shrink_to_fit();
90  layerClusterOriginalIdx.shrink_to_fit();
91  followers.shrink_to_fit();
92  isSeed.shrink_to_fit();
93  }
94  };
95 
96  void reset() {
97  for (auto& c : clusters_) {
98  c.clear();
99  c.shrink_to_fit();
100  }
101  }
102  void calculateLocalDensity(const TILES&, const int layerId, const std::vector<std::pair<int, int>>&);
103  void calculateDistanceToHigher(const TILES&, const int layerId, const std::vector<std::pair<int, int>>&);
104  int findAndAssignTracksters(const TILES&, const std::vector<std::pair<int, int>>&);
105  void dumpClusters(const TILES& tiles,
106  const std::vector<std::pair<int, int>>& layerIdx2layerandSoa,
107  const int) const;
108  void dumpTracksters(const std::vector<std::pair<int, int>>& layerIdx2layerandSoa,
109  const int,
110  const std::vector<Trackster>&) const;
111  void dumpTiles(const TILES&) const;
112 
113  std::vector<ClustersOnLayer> clusters_;
114  std::vector<float> layersPosZ_;
115  std::vector<int> tracksterSeedAlgoId_;
116 
118  const std::vector<double> criticalDensity_;
119  const std::vector<double> criticalSelfDensity_;
120  const std::vector<int> densitySiblingLayers_;
121  const std::vector<double> densityEtaPhiDistanceSqr_;
122  const std::vector<double> densityXYDistanceSqr_;
123  const std::vector<double> kernelDensityFactor_;
128  const bool rescaleDensityByZ_;
129  const std::vector<double> criticalEtaPhiDistance_;
130  const std::vector<double> criticalXYDistance_;
131  const std::vector<int> criticalZDistanceLyr_;
132  const std::vector<double> outlierMultiplier_;
133  const std::vector<int> minNumLayerCluster_;
134  const bool doPidCut_;
135  const float cutHadProb_;
136  const std::vector<int> filter_on_categories_;
140  const float eidMinClusterEnergy_;
141  const int eidNLayers_;
142  const int eidNClusters_;
143  const bool computeLocalTime_;
144  const bool usePCACleaning_;
145 
147  tensorflow::Session* eidSession_;
148 
149  static const int eidNFeatures_ = 3;
150  };
151 
152 } // namespace ticl
153 #endif
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
const std::vector< double > densityEtaPhiDistanceSqr_
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result)
const std::vector< double > densityXYDistanceSqr_
PatternRecognitionbyCLUE3D(const edm::ParameterSet &conf, edm::ConsumesCollector)
std::vector< ClustersOnLayer > clusters_
~PatternRecognitionbyCLUE3D() override=default
const std::vector< double > outlierMultiplier_
void calculateDistanceToHigher(const TILES &, const int layerId, const std::vector< std::pair< int, int >> &)
static std::string const input
Definition: EdmProvDump.cc:50
const std::vector< int > densitySiblingLayers_
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
const std::vector< double > kernelDensityFactor_
int findAndAssignTracksters(const TILES &, const std::vector< std::pair< int, int >> &)
const std::vector< double > criticalDensity_
const std::vector< double > criticalXYDistance_
const std::vector< double > criticalEtaPhiDistance_
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:10
const std::vector< int > criticalZDistanceLyr_
const std::vector< int > filter_on_categories_
void dumpTracksters(const std::vector< std::pair< int, int >> &layerIdx2layerandSoa, const int, const std::vector< Trackster > &) const
const std::vector< double > criticalSelfDensity_