CMS 3D CMS Logo

SuperclusteringDNNInputs.h
Go to the documentation of this file.
1 
2 // Author: Theo Cuisset - theo.cuisset@cern.ch
3 // Date: 11/2023
4 
5 #ifndef __RecoHGCal_TICL_SuperclusteringDNNInputs_H__
6 #define __RecoHGCal_TICL_SuperclusteringDNNInputs_H__
7 
8 #include <vector>
9 #include <string>
10 #include <memory>
11 
12 namespace ticl {
13  class Trackster;
14 
15  // Abstract base class for DNN input preparation.
17  public:
18  virtual ~AbstractSuperclusteringDNNInput() = default;
19 
20  virtual unsigned int featureCount() const { return featureNames().size(); };
21 
25  virtual std::vector<std::string> featureNames() const {
26  std::vector<std::string> defaultNames;
27  defaultNames.reserve(featureCount());
28  for (unsigned int i = 1; i <= featureCount(); i++) {
29  defaultNames.push_back(std::string("nb_") + std::to_string(i));
30  }
31  return defaultNames;
32  }
33 
35  virtual std::vector<float> computeVector(ticl::Trackster const& ts_base, ticl::Trackster const& ts_toCluster) = 0;
36  };
37 
38  /* First version of DNN by Alessandro Tarabini. Meant as a DNN equivalent of Mustache algorithm (superclustering algo in ECAL)
39  Uses features : ['DeltaEta', 'DeltaPhi', 'multi_en', 'multi_eta', 'multi_pt', 'seedEta','seedPhi','seedEn', 'seedPt']
40  */
42  public:
43  unsigned int featureCount() const override { return 9; }
44 
45  std::vector<float> computeVector(ticl::Trackster const& ts_base, ticl::Trackster const& ts_toCluster) override;
46 
47  std::vector<std::string> featureNames() const override {
48  return {"DeltaEtaBaryc",
49  "DeltaPhiBaryc",
50  "multi_en",
51  "multi_eta",
52  "multi_pt",
53  "seedEta",
54  "seedPhi",
55  "seedEn",
56  "seedPt"};
57  }
58  };
59 
60  /* Second version of DNN by Alessandro Tarabini, making use of HGCAL-specific features.
61  Uses features : ['DeltaEta', 'DeltaPhi', 'multi_en', 'multi_eta', 'multi_pt', 'seedEta','seedPhi','seedEn', 'seedPt', 'theta', 'theta_xz_seedFrame', 'theta_yz_seedFrame', 'theta_xy_cmsFrame', 'theta_yz_cmsFrame', 'theta_xz_cmsFrame', 'explVar', 'explVarRatio']
62  */
64  public:
65  unsigned int featureCount() const override { return 17; }
66 
67  std::vector<float> computeVector(ticl::Trackster const& ts_base, ticl::Trackster const& ts_toCluster) override;
68 
69  std::vector<std::string> featureNames() const override {
70  return {"DeltaEtaBaryc",
71  "DeltaPhiBaryc",
72  "multi_en",
73  "multi_eta",
74  "multi_pt",
75  "seedEta",
76  "seedPhi",
77  "seedEn",
78  "seedPt",
79  "theta",
80  "theta_xz_seedFrame",
81  "theta_yz_seedFrame",
82  "theta_xy_cmsFrame",
83  "theta_yz_cmsFrame",
84  "theta_xz_cmsFrame",
85  "explVar",
86  "explVarRatio"};
87  }
88  };
89 
90  std::unique_ptr<AbstractSuperclusteringDNNInput> makeSuperclusteringDNNInputFromString(std::string dnnVersion);
91 } // namespace ticl
92 
93 #endif
std::vector< float > computeVector(ticl::Trackster const &ts_base, ticl::Trackster const &ts_toCluster) override
virtual std::vector< float > computeVector(ticl::Trackster const &ts_base, ticl::Trackster const &ts_toCluster)=0
static std::string to_string(const XMLCh *ch)
virtual std::vector< std::string > featureNames() const
unsigned int featureCount() const override
virtual ~AbstractSuperclusteringDNNInput()=default
unsigned int featureCount() const override
std::unique_ptr< AbstractSuperclusteringDNNInput > makeSuperclusteringDNNInputFromString(std::string dnnVersion)
std::vector< float > computeVector(ticl::Trackster const &ts_base, ticl::Trackster const &ts_toCluster) override
Definition: Common.h:10
std::vector< std::string > featureNames() const override
std::vector< std::string > featureNames() const override