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 filter(std::vector<Trackster>& output,
22  const std::vector<Trackster>& inTracksters,
24  std::unordered_map<int, std::vector<int>>& seedToTracksterAssociation) override;
25 
26  void energyRegressionAndID(const std::vector<reco::CaloCluster>& layerClusters,
27  const tensorflow::Session*,
28  std::vector<Trackster>& result);
29 
31 
32  private:
33  struct ClustersOnLayer {
34  std::vector<float> x;
35  std::vector<float> y;
36  std::vector<float> z;
37  std::vector<float> r_over_absz;
38  std::vector<float> radius;
39  std::vector<float> eta;
40  std::vector<float> phi;
41  std::vector<int> cells;
42  std::vector<int> algoId; // hgcal_em = 6, hgcal_had = 7, hgcal_scintillator = 8, hfnose = 9
43  std::vector<uint8_t> isSilicon;
44 
45  std::vector<float> energy;
46  std::vector<float> rho;
47  std::vector<float> z_extension;
48 
49  std::vector<std::pair<float, int>> delta;
50  std::vector<std::pair<int, int>> nearestHigher;
51  std::vector<int> clusterIndex;
52  std::vector<unsigned int> layerClusterOriginalIdx;
53  std::vector<std::vector<std::pair<int, int>>> followers;
54  std::vector<bool> isSeed;
55 
56  void clear() {
57  x.clear();
58  y.clear();
59  z.clear();
60  r_over_absz.clear();
61  radius.clear();
62  eta.clear();
63  phi.clear();
64  cells.clear();
65  algoId.clear();
66  isSilicon.clear();
67  energy.clear();
68  rho.clear();
69  z_extension.clear();
70  delta.clear();
71  nearestHigher.clear();
72  clusterIndex.clear();
74  followers.clear();
75  isSeed.clear();
76  }
77 
78  void shrink_to_fit() {
79  x.shrink_to_fit();
80  y.shrink_to_fit();
81  z.shrink_to_fit();
82  r_over_absz.shrink_to_fit();
83  radius.shrink_to_fit();
84  eta.shrink_to_fit();
85  phi.shrink_to_fit();
86  cells.shrink_to_fit();
87  algoId.shrink_to_fit();
88  isSilicon.shrink_to_fit();
89  energy.shrink_to_fit();
90  rho.shrink_to_fit();
91  z_extension.shrink_to_fit();
92  delta.shrink_to_fit();
93  nearestHigher.shrink_to_fit();
94  clusterIndex.shrink_to_fit();
95  layerClusterOriginalIdx.shrink_to_fit();
96  followers.shrink_to_fit();
97  isSeed.shrink_to_fit();
98  }
99  };
100 
101  void reset() {
102  for (auto& c : clusters_) {
103  c.clear();
104  c.shrink_to_fit();
105  }
106  }
107  void calculateLocalDensity(const TILES&, const int layerId, const std::vector<std::pair<int, int>>&);
108  void calculateDistanceToHigher(const TILES&, const int layerId, const std::vector<std::pair<int, int>>&);
109  int findAndAssignTracksters(const TILES&, const std::vector<std::pair<int, int>>&);
110  void dumpClusters(const TILES& tiles,
111  const std::vector<std::pair<int, int>>& layerIdx2layerandSoa,
112  const int) const;
113  void dumpTracksters(const std::vector<std::pair<int, int>>& layerIdx2layerandSoa,
114  const int,
115  const std::vector<Trackster>&) const;
116  void dumpTiles(const TILES&) const;
117 
118  std::vector<ClustersOnLayer> clusters_;
119  std::vector<float> layersPosZ_;
120  std::vector<int> tracksterSeedAlgoId_;
121 
123  const std::vector<double> criticalDensity_;
124  const std::vector<double> criticalSelfDensity_;
125  const std::vector<int> densitySiblingLayers_;
126  const std::vector<double> densityEtaPhiDistanceSqr_;
127  const std::vector<double> densityXYDistanceSqr_;
128  const std::vector<double> kernelDensityFactor_;
133  const bool rescaleDensityByZ_;
134  const std::vector<double> criticalEtaPhiDistance_;
135  const std::vector<double> criticalXYDistance_;
136  const std::vector<int> criticalZDistanceLyr_;
137  const std::vector<double> outlierMultiplier_;
138  const std::vector<int> minNumLayerCluster_;
139  const bool doPidCut_;
140  const float cutHadProb_;
141  const std::vector<int> filter_on_categories_;
142  const bool computeLocalTime_;
143  const bool usePCACleaning_;
144 
146  };
147 
148 } // namespace ticl
149 #endif
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
const std::vector< double > densityEtaPhiDistanceSqr_
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 filter(std::vector< Trackster > &output, const std::vector< Trackster > &inTracksters, const typename PatternRecognitionAlgoBaseT< TILES >::Inputs &input, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) override
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
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result)
Definition: output.py:1
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_