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, std::vector<Trackster>& result);
22 
24 
25  private:
26  struct ClustersOnLayer {
27  std::vector<float> x;
28  std::vector<float> y;
29  std::vector<float> radius;
30  std::vector<float> eta;
31  std::vector<float> phi;
32  std::vector<int> cells;
33 
34  std::vector<float> energy;
35  std::vector<float> rho;
36 
37  std::vector<float> delta;
38  std::vector<std::pair<int, int>> nearestHigher;
39  std::vector<int> clusterIndex;
40  std::vector<unsigned int> layerClusterOriginalIdx;
41  std::vector<std::vector<std::pair<int, int>>> followers;
42  std::vector<bool> isSeed;
43 
44  void clear() {
45  x.clear();
46  y.clear();
47  radius.clear();
48  eta.clear();
49  phi.clear();
50  cells.clear();
51  energy.clear();
52  rho.clear();
53  delta.clear();
54  nearestHigher.clear();
55  clusterIndex.clear();
57  followers.clear();
58  isSeed.clear();
59  }
60 
61  void shrink_to_fit() {
62  x.shrink_to_fit();
63  y.shrink_to_fit();
64  radius.shrink_to_fit();
65  eta.shrink_to_fit();
66  phi.shrink_to_fit();
67  cells.shrink_to_fit();
68  energy.shrink_to_fit();
69  rho.shrink_to_fit();
70  delta.shrink_to_fit();
71  nearestHigher.shrink_to_fit();
72  clusterIndex.shrink_to_fit();
73  layerClusterOriginalIdx.shrink_to_fit();
74  followers.shrink_to_fit();
75  isSeed.shrink_to_fit();
76  }
77  };
78 
79  void reset() {
80  for (auto& c : clusters_) {
81  c.clear();
82  c.shrink_to_fit();
83  }
84  }
85  void calculateLocalDensity(const TILES&, const unsigned int layerId, const std::vector<std::pair<int, int>>&);
86  void calculateDistanceToHigher(const TILES&, const unsigned int layerId, const std::vector<std::pair<int, int>>&);
87  int findAndAssignTracksters(const TILES&, const std::vector<std::pair<int, int>>&);
88  void dumpClusters(const std::vector<std::pair<int, int>>& layerIdx2layerandSoa, const int) const;
89  void dumpTracksters(const std::vector<std::pair<int, int>>& layerIdx2layerandSoa,
90  const int,
91  const std::vector<Trackster>&) const;
92  void dumpTiles(const TILES&) const;
93 
94  std::vector<ClustersOnLayer> clusters_;
95 
97  const double criticalDensity_;
100  const double densityOnSameLayer_;
102  const double outlierMultiplier_;
104  const std::vector<int> filter_on_categories_;
108  const float eidMinClusterEnergy_;
109  const int eidNLayers_;
110  const int eidNClusters_;
111 
113  tensorflow::Session* eidSession_;
114 
115  static const int eidNFeatures_ = 3;
116  };
117 
118 } // namespace ticl
119 #endif
ticl::PatternRecognitionbyCLUE3D::eidInputName_
const std::string eidInputName_
Definition: PatternRecognitionbyCLUE3D.h:105
PatternRecognitionAlgoBase.h
ticl::PatternRecognitionbyCLUE3D::eidNClusters_
const int eidNClusters_
Definition: PatternRecognitionbyCLUE3D.h:110
hgcal::RecHitTools
Definition: RecHitTools.h:23
ticl::PatternRecognitionbyCLUE3D::energyRegressionAndID
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, std::vector< Trackster > &result)
Definition: PatternRecognitionbyCLUE3D.cc:304
input
static const std::string input
Definition: EdmProvDump.cc:48
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::energy
std::vector< float > energy
Definition: PatternRecognitionbyCLUE3D.h:34
ticl::PatternRecognitionbyCLUE3D::clusters_
std::vector< ClustersOnLayer > clusters_
Definition: PatternRecognitionbyCLUE3D.h:94
ticl::PatternRecognitionbyCLUE3D::filter_on_categories_
const std::vector< int > filter_on_categories_
Definition: PatternRecognitionbyCLUE3D.h:104
ticl::PatternRecognitionbyCLUE3D::calculateDistanceToHigher
void calculateDistanceToHigher(const TILES &, const unsigned int layerId, const std::vector< std::pair< int, int >> &)
Definition: PatternRecognitionbyCLUE3D.cc:563
ticl::PatternRecognitionbyCLUE3D::eidMinClusterEnergy_
const float eidMinClusterEnergy_
Definition: PatternRecognitionbyCLUE3D.h:108
ticl::PatternRecognitionbyCLUE3D::dumpTracksters
void dumpTracksters(const std::vector< std::pair< int, int >> &layerIdx2layerandSoa, const int, const std::vector< Trackster > &) const
Definition: PatternRecognitionbyCLUE3D.cc:76
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::y
std::vector< float > y
Definition: PatternRecognitionbyCLUE3D.h:28
ticl::PatternRecognitionbyCLUE3D::~PatternRecognitionbyCLUE3D
~PatternRecognitionbyCLUE3D() override=default
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::radius
std::vector< float > radius
Definition: PatternRecognitionbyCLUE3D.h:29
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::cells
std::vector< int > cells
Definition: PatternRecognitionbyCLUE3D.h:32
RecHitTools.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ticl::PatternRecognitionbyCLUE3D::eidOutputNameId_
const std::string eidOutputNameId_
Definition: PatternRecognitionbyCLUE3D.h:107
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::nearestHigher
std::vector< std::pair< int, int > > nearestHigher
Definition: PatternRecognitionbyCLUE3D.h:38
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::delta
std::vector< float > delta
Definition: PatternRecognitionbyCLUE3D.h:37
ticl
Definition: Common.h:8
ticl::PatternRecognitionbyCLUE3D::dumpTiles
void dumpTiles(const TILES &) const
Definition: PatternRecognitionbyCLUE3D.cc:53
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer
Definition: PatternRecognitionbyCLUE3D.h:26
ticl::PatternRecognitionbyCLUE3D
Definition: PatternRecognitionbyCLUE3D.h:12
ticl::PatternRecognitionbyCLUE3D::criticalDensity_
const double criticalDensity_
Definition: PatternRecognitionbyCLUE3D.h:97
ticl::PatternRecognitionAlgoBaseT
Definition: PatternRecognitionAlgoBase.h:25
ticl::PatternRecognitionbyCLUE3D::dumpClusters
void dumpClusters(const std::vector< std::pair< int, int >> &layerIdx2layerandSoa, const int) const
Definition: PatternRecognitionbyCLUE3D.cc:108
ticl::CacheBase
Definition: GlobalCache.h:11
ticl::PatternRecognitionbyCLUE3D::calculateLocalDensity
void calculateLocalDensity(const TILES &, const unsigned int layerId, const std::vector< std::pair< int, int >> &)
Definition: PatternRecognitionbyCLUE3D.cc:443
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::phi
std::vector< float > phi
Definition: PatternRecognitionbyCLUE3D.h:31
ticl::PatternRecognitionbyCLUE3D::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
Definition: PatternRecognitionbyCLUE3D.cc:719
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
ticl::PatternRecognitionbyCLUE3D::findAndAssignTracksters
int findAndAssignTracksters(const TILES &, const std::vector< std::pair< int, int >> &)
Definition: PatternRecognitionbyCLUE3D.cc:659
ticl::PatternRecognitionbyCLUE3D::PatternRecognitionbyCLUE3D
PatternRecognitionbyCLUE3D(const edm::ParameterSet &conf, const CacheBase *cache, edm::ConsumesCollector)
Definition: PatternRecognitionbyCLUE3D.cc:24
utilities.cache
def cache(function)
Definition: utilities.py:3
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::followers
std::vector< std::vector< std::pair< int, int > > > followers
Definition: PatternRecognitionbyCLUE3D.h:41
edm::ParameterSet
Definition: ParameterSet.h:47
ticl::PatternRecognitionbyCLUE3D::rhtools_
hgcal::RecHitTools rhtools_
Definition: PatternRecognitionbyCLUE3D.h:112
ticl::PatternRecognitionbyCLUE3D::densitySiblingLayers_
const int densitySiblingLayers_
Definition: PatternRecognitionbyCLUE3D.h:98
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::rho
std::vector< float > rho
Definition: PatternRecognitionbyCLUE3D.h:35
ticl::PatternRecognitionbyCLUE3D::makeTracksters
void makeTracksters(const typename PatternRecognitionAlgoBaseT< TILES >::Inputs &input, std::vector< Trackster > &result, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) override
Definition: PatternRecognitionbyCLUE3D.cc:146
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::clusterIndex
std::vector< int > clusterIndex
Definition: PatternRecognitionbyCLUE3D.h:39
ticl::PatternRecognitionbyCLUE3D::densityEtaPhiDistanceSqr_
const double densityEtaPhiDistanceSqr_
Definition: PatternRecognitionbyCLUE3D.h:99
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::layerClusterOriginalIdx
std::vector< unsigned int > layerClusterOriginalIdx
Definition: PatternRecognitionbyCLUE3D.h:40
ticl::PatternRecognitionAlgoBaseT::Inputs
Definition: PatternRecognitionAlgoBase.h:31
ticl::PatternRecognitionbyCLUE3D::outlierMultiplier_
const double outlierMultiplier_
Definition: PatternRecognitionbyCLUE3D.h:102
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::shrink_to_fit
void shrink_to_fit()
Definition: PatternRecognitionbyCLUE3D.h:61
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::eta
std::vector< float > eta
Definition: PatternRecognitionbyCLUE3D.h:30
ticl::PatternRecognitionbyCLUE3D::eidSession_
tensorflow::Session * eidSession_
Definition: PatternRecognitionbyCLUE3D.h:113
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::isSeed
std::vector< bool > isSeed
Definition: PatternRecognitionbyCLUE3D.h:42
ticl::PatternRecognitionbyCLUE3D::eidOutputNameEnergy_
const std::string eidOutputNameEnergy_
Definition: PatternRecognitionbyCLUE3D.h:106
ticl::PatternRecognitionbyCLUE3D::densityOnSameLayer_
const double densityOnSameLayer_
Definition: PatternRecognitionbyCLUE3D.h:100
ticl::PatternRecognitionbyCLUE3D::criticalEtaPhiDistance_
const double criticalEtaPhiDistance_
Definition: PatternRecognitionbyCLUE3D.h:101
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::x
std::vector< float > x
Definition: PatternRecognitionbyCLUE3D.h:27
ticl::PatternRecognitionbyCLUE3D::reset
void reset()
Definition: PatternRecognitionbyCLUE3D.h:79
ticl::PatternRecognitionbyCLUE3D::ClustersOnLayer::clear
void clear()
Definition: PatternRecognitionbyCLUE3D.h:44
ticl::PatternRecognitionbyCLUE3D::eidNLayers_
const int eidNLayers_
Definition: PatternRecognitionbyCLUE3D.h:109
ticl::PatternRecognitionbyCLUE3D::eidNFeatures_
static const int eidNFeatures_
Definition: PatternRecognitionbyCLUE3D.h:115
ticl::PatternRecognitionbyCLUE3D::minNumLayerCluster_
const int minNumLayerCluster_
Definition: PatternRecognitionbyCLUE3D.h:103
ticl::PatternRecognitionbyCLUE3D::caloGeomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
Definition: PatternRecognitionbyCLUE3D.h:96
mps_fire.result
result
Definition: mps_fire.py:311
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::ConsumesCollector
Definition: ConsumesCollector.h:45