CMS 3D CMS Logo

Functions
TracksterLinkingbySkeletons.cc File Reference
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <Math/VectorUtil.h>
#include "DataFormats/Math/interface/deltaR.h"
#include "DataFormats/HGCalReco/interface/Common.h"
#include "DataFormats/GeometrySurface/interface/BoundDisk.h"
#include "DataFormats/HGCalReco/interface/Trackster.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
#include "RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h"
#include "RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h"
#include "RecoHGCal/TICL/plugins/TracksterLinkingbySkeletons.h"
#include "TICLGraph.h"

Go to the source code of this file.

Functions

bool isInCylinder (const std::array< ticl::Vector, 3 > &mySkeleton, const std::array< ticl::Vector, 3 > &otherSkeleton, const float radius_sqr)
 

Function Documentation

◆ isInCylinder()

bool isInCylinder ( const std::array< ticl::Vector, 3 > &  mySkeleton,
const std::array< ticl::Vector, 3 > &  otherSkeleton,
const float  radius_sqr 
)

Definition at line 170 of file TracksterLinkingbySkeletons.cc.

References HLT_2024v13_cff::distance, dqmdumpme::first, dqmdumpme::last, and amptDefault_cfi::proj.

Referenced by ticl::TracksterLinkingbySkeletons::areCompatible().

172  {
173  const auto &first = mySkeleton[0];
174  const auto &last = mySkeleton[2];
175  const auto &pointToCheck = otherSkeleton[0];
176 
177  const auto &cylAxis = last - first;
178  const auto &vecToPoint = pointToCheck - first;
179 
180  auto axisNorm = cylAxis.Dot(cylAxis);
181  auto projLength = vecToPoint.Dot(cylAxis) / axisNorm;
182  bool isWithinLength = projLength >= 0 && projLength <= 1;
183 
184  if (!isWithinLength)
185  return false;
186 
187  const auto &proj = cylAxis * projLength;
188 
189  const auto &pointOnAxis = first + proj;
190 
191  const auto &distance = pointToCheck - pointOnAxis;
192  auto distance2 = distance.Dot(distance);
193 
194  bool isWithinRadius = distance2 <= radius_sqr;
195 
196  return isWithinRadius;
197 }