Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:06

0001 #include "RecoTracker/DisplacedRegionalTracking/plugins/DisplacedVertexCluster.h"
0002 
0003 DisplacedVertexCluster::DisplacedVertexCluster(const reco::VertexCompositeCandidate *const trackClusterPtr,
0004                                                const double rParam)
0005     : valid_(true),
0006       rParam2_(rParam * rParam),
0007       sumOfCenters_(trackClusterPtr->vertex()),
0008       centerOfMass_(trackClusterPtr->vertex()) {
0009   constituents_.push_back(trackClusterPtr);
0010 }
0011 
0012 void DisplacedVertexCluster::merge(const DisplacedVertexCluster &other) {
0013   for (const auto &trackCluster : other.constituents())
0014     constituents_.push_back(trackCluster);
0015   sumOfCenters_ += other.sumOfCenters();
0016   centerOfMass_ = sumOfCenters_ * (1.0 / constituents_.size());
0017 }
0018 
0019 double DisplacedVertexCluster::Distance::distance2() const {
0020   if (entities_.first->valid() && entities_.second->valid())
0021     return (entities_.first->centerOfMass() - entities_.second->centerOfMass()).mag2();
0022   return std::numeric_limits<double>::max();
0023 }