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 172 of file TracksterLinkingbySkeletons.cc.

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

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

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