CMS 3D CMS Logo

List of all members | Public Member Functions
ticl::SuperclusteringDNNInputV2 Class Reference

#include <SuperclusteringDNNInputs.h>

Inheritance diagram for ticl::SuperclusteringDNNInputV2:
ticl::AbstractSuperclusteringDNNInput

Public Member Functions

std::vector< float > computeVector (ticl::Trackster const &ts_base, ticl::Trackster const &ts_toCluster) override
 
unsigned int featureCount () const override
 
std::vector< std::string > featureNames () const override
 
- Public Member Functions inherited from ticl::AbstractSuperclusteringDNNInput
virtual ~AbstractSuperclusteringDNNInput ()=default
 

Detailed Description

Definition at line 63 of file SuperclusteringDNNInputs.h.

Member Function Documentation

◆ computeVector()

std::vector< float > ticl::SuperclusteringDNNInputV2::computeVector ( ticl::Trackster const &  ts_base,
ticl::Trackster const &  ts_toCluster 
)
overridevirtual

Compute feature for seed and candidate pair

Implements ticl::AbstractSuperclusteringDNNInput.

Definition at line 63 of file SuperclusteringDNNInputs.cc.

References funct::abs(), ticl::Angle2D(), ticl::Trackster::barycenter(), ticl::Trackster::eigenvalues(), ticl::Trackster::eigenvectors(), f, ticl::Trackster::raw_energy(), makeMuonMisalignmentScenario::rot, and funct::sin().

63  {
64  using ROOT::Math::XYVectorF;
66  using ROOT::Math::VectorUtil::Angle;
67  XYZVectorF const& pca_seed_cmsFrame(ts_base.eigenvectors(0));
68  XYZVectorF const& pca_cand_cmsFrame(ts_toCluster.eigenvectors(0));
69  XYZVectorF xs(pca_seed_cmsFrame.Cross(XYZVectorF(0, 0, 1)).Unit());
70  ROOT::Math::Rotation3D rot(xs, xs.Cross(pca_seed_cmsFrame).Unit(), pca_seed_cmsFrame);
71 
72  XYZVectorF pca_cand_seedFrame = rot(pca_cand_cmsFrame); // seed coordinates
73 
74  float explVar_denominator = std::accumulate(
75  std::begin(ts_toCluster.eigenvalues()), std::end(ts_toCluster.eigenvalues()), 0.f, std::plus<float>());
76  float explVarRatio = 0.;
77  if (explVar_denominator != 0.) {
78  explVarRatio = ts_toCluster.eigenvalues()[0] / explVar_denominator;
79  } else {
80  edm::LogWarning("HGCalTICLSuperclustering")
81  << "Sum of eigenvalues was zero for trackster. Could not compute explained variance ratio.";
82  }
83 
84  return {{
85  std::abs(ts_toCluster.barycenter().Eta()) - std::abs(ts_base.barycenter().Eta()), //DeltaEtaBaryc
86  ts_toCluster.barycenter().Phi() - ts_base.barycenter().phi(), //DeltaPhiBaryc
87  ts_toCluster.raw_energy(), //multi_en
88  ts_toCluster.barycenter().Eta(), //multi_eta
89  (ts_toCluster.raw_energy() * std::sin(ts_toCluster.barycenter().Theta())), //multi_pt
90  ts_base.barycenter().Eta(), //seedEta
91  ts_base.barycenter().Phi(), //seedPhi
92  ts_base.raw_energy(), //seedEn
93  (ts_base.raw_energy() * std::sin(ts_toCluster.barycenter().Theta())), //seedPt
94  static_cast<float>(Angle(pca_cand_cmsFrame, pca_seed_cmsFrame)), // theta : angle between seed and candidate
95  Angle2D(XYVectorF(pca_cand_seedFrame.x(), pca_cand_seedFrame.z()), XYVectorF(0, 1)), // theta_xz_seedFrame
96  Angle2D(XYVectorF(pca_cand_seedFrame.y(), pca_cand_seedFrame.z()), XYVectorF(0, 1)), // theta_yz_seedFrame
97  Angle2D(XYVectorF(pca_cand_cmsFrame.x(), pca_cand_cmsFrame.y()),
98  XYVectorF(pca_seed_cmsFrame.x(), pca_seed_cmsFrame.y())), // theta_xy_cmsFrame
99  Angle2D(XYVectorF(pca_cand_cmsFrame.y(), pca_cand_cmsFrame.z()),
100  XYVectorF(pca_seed_cmsFrame.y(), pca_seed_cmsFrame.z())), // theta_yz_cmsFrame
101  Angle2D(XYVectorF(pca_cand_cmsFrame.x(), pca_cand_cmsFrame.z()),
102  XYVectorF(pca_seed_cmsFrame.x(), pca_seed_cmsFrame.z())), // theta_xz_cmsFrame
103  ts_toCluster.eigenvalues()[0], // explVar
104  explVarRatio // explVarRatio
105  }};
106  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: RntStructs.h:14
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
Log< level::Warning, false > LogWarning
float Angle2D(const Vector1 &v1, const Vector2 &v2)

◆ featureCount()

unsigned int ticl::SuperclusteringDNNInputV2::featureCount ( ) const
inlineoverridevirtual

Reimplemented from ticl::AbstractSuperclusteringDNNInput.

Definition at line 65 of file SuperclusteringDNNInputs.h.

65 { return 17; }

◆ featureNames()

std::vector<std::string> ticl::SuperclusteringDNNInputV2::featureNames ( ) const
inlineoverridevirtual

Get name of features. Used for SuperclusteringSampleDumper branch names (inference does not use the names, only the indices) The default implementation is meant to be overriden by inheriting classes

Reimplemented from ticl::AbstractSuperclusteringDNNInput.

Definition at line 69 of file SuperclusteringDNNInputs.h.

69  {
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  }