CMS 3D CMS Logo

Classes | Functions
tkDetUtil Namespace Reference

Classes

struct  RingPar
 

Functions

float calculatePhiWindow (const MeasurementEstimator::Local2DVector &imaxDistance, const TrajectoryStateOnSurface &ts, const Plane &plane)
 
template<class T >
BoundDiskcomputeDisk (const std::vector< const T *> &structures)
 
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
 
float computeYdirWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
 
RingPar fillRingParametersFromDisk (const BoundDisk &ringDisk)
 
std::array< int, 3 > findThreeClosest (const std::vector< RingPar > &ringParams, const std::vector< GlobalPoint > &ringCrossing, const int ringSize)
 
template<class T >
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result, const int ringSize, const std::vector< const T *> &diskComponents, const std::vector< RingPar > &ringParams)
 
bool overlapInPhi (float phi, const GeomDet &det, float phiWindow)
 
bool overlapInPhi (GlobalPoint crossPoint, const GeomDet &det, float phiWindow)
 
bool overlapInR (const TrajectoryStateOnSurface &tsos, int index, double ymax, const std::vector< RingPar > &ringParams)
 
template<class T >
std::array< int, 3 > ringIndicesByCrossingProximity (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const int ringSize, const T &diskComponents, const std::vector< RingPar > &ringParams)
 

Function Documentation

◆ calculatePhiWindow()

float tkDetUtil::calculatePhiWindow ( const MeasurementEstimator::Local2DVector imaxDistance,
const TrajectoryStateOnSurface ts,
const Plane plane 
)

Definition at line 16 of file TkDetUtil.cc.

References funct::abs(), PV3DBase< T, PVType, FrameType >::barePhi(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), f, mps_fire::i, LIKELY, TrajectoryStateOnSurface::localPosition(), M_PI, WZElectronSkims53X_cff::max, particleFlowClusterHGC_cfi::maxDistance, SiStripPI::min, Plane::normalVector(), Geom::phiLess(), phimax, phimin, trackingPOGFilters_cfi::phiWindow, Geom::pi(), mathSSE::sqrt(), Surface::toGlobal(), tolerance, GloballyPositioned< T >::toLocal(), PV2DBase< T, PVType, FrameType >::x(), PV2DBase< T, PVType, FrameType >::y(), testProducerWithPsetDescEmpty_cfi::y1, and PV3DBase< T, PVType, FrameType >::z().

Referenced by computeWindowSize().

18  {
19  MeasurementEstimator::Local2DVector maxDistance(std::abs(imaxDistance.x()), std::abs(imaxDistance.y()));
20 
21  constexpr float tolerance = 1.e-6;
23  // std::cout << "plane z " << plane.normalVector() << std::endl;
24  float dphi = 0;
25  if LIKELY (std::abs(1.f - std::abs(plane.normalVector().z())) < tolerance) {
26  auto ori = plane.toLocal(GlobalPoint(0., 0., 0.));
27  auto xc = std::abs(start.x() - ori.x());
28  auto yc = std::abs(start.y() - ori.y());
29 
30  if (yc < maxDistance.y() && xc < maxDistance.x())
31  return M_PI;
32 
33  auto hori = yc > maxDistance.y(); // quadrant 1 (&2), otherwiase quadrant 1&4
34  auto y0 = hori ? yc + std::copysign(maxDistance.y(), xc - maxDistance.x()) : xc - maxDistance.x();
35  auto x0 = hori ? xc - maxDistance.x() : -yc - maxDistance.y();
36  auto y1 = hori ? yc - maxDistance.y() : xc - maxDistance.x();
37  auto x1 = hori ? xc + maxDistance.x() : -yc + maxDistance.y();
38 
39  auto sp = (x0 * x1 + y0 * y1) / std::sqrt((x0 * x0 + y0 * y0) * (x1 * x1 + y1 * y1));
40  sp = std::min(std::max(sp, -1.f), 1.f);
41  dphi = std::acos(sp);
42 
43  return dphi;
44  }
45 
46  // generic algo
47  float corners[] = {plane.toGlobal(LocalPoint(start.x() + maxDistance.x(), start.y() + maxDistance.y())).barePhi(),
48  plane.toGlobal(LocalPoint(start.x() - maxDistance.x(), start.y() + maxDistance.y())).barePhi(),
49  plane.toGlobal(LocalPoint(start.x() - maxDistance.x(), start.y() - maxDistance.y())).barePhi(),
50  plane.toGlobal(LocalPoint(start.x() + maxDistance.x(), start.y() - maxDistance.y())).barePhi()};
51 
52  float phimin = corners[0];
53  float phimax = phimin;
54  for (int i = 1; i < 4; i++) {
55  float cPhi = corners[i];
56  if (Geom::phiLess(cPhi, phimin)) {
57  phimin = cPhi;
58  }
59  if (Geom::phiLess(phimax, cPhi)) {
60  phimax = cPhi;
61  }
62  }
63  float phiWindow = phimax - phimin;
64  if (phiWindow < 0.) {
65  phiWindow += 2. * Geom::pi();
66  }
67  // std::cout << "phiWindow " << phiWindow << ' ' << dphi << ' ' << dphi-phiWindow << std::endl;
68  return phiWindow;
69  }
Definition: start.py:1
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
T z() const
Definition: PV3DBase.h:61
const double tolerance
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define LIKELY(x)
Definition: Likely.h:20
T x() const
Definition: PV2DBase.h:43
LocalPoint toLocal(const GlobalPoint &gp) const
T barePhi() const
Definition: PV3DBase.h:65
T y() const
Definition: PV2DBase.h:44
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
#define M_PI
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
GlobalVector normalVector() const
Definition: Plane.h:41
constexpr double pi()
Definition: Pi.h:31

◆ computeDisk()

template<class T >
BoundDisk* tkDetUtil::computeDisk ( const std::vector< const T *> &  structures)

Definition at line 236 of file TkDetUtil.h.

References mps_fire::i, WZElectronSkims53X_cff::max, SiStripPI::min, makeMuonMisalignmentScenario::rot, SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

Referenced by Phase2EndcapLayerDoubleDisk::computeDisk(), Phase2EndcapSubDisk::computeDisk(), Phase2EndcapLayer::computeDisk(), and TECLayer::TECLayer().

236  {
237  float theRmin = structures.front()->specificSurface().innerRadius();
238  float theRmax = structures.front()->specificSurface().outerRadius();
239  float theZmin = structures.front()->position().z() - structures.front()->surface().bounds().thickness() / 2;
240  float theZmax = structures.front()->position().z() + structures.front()->surface().bounds().thickness() / 2;
241 
242  for (typename std::vector<const T*>::const_iterator i = structures.begin(); i != structures.end(); i++) {
243  float rmin = (**i).specificSurface().innerRadius();
244  float rmax = (**i).specificSurface().outerRadius();
245  float zmin = (**i).position().z() - (**i).surface().bounds().thickness() / 2.;
246  float zmax = (**i).position().z() + (**i).surface().bounds().thickness() / 2.;
247  theRmin = std::min(theRmin, rmin);
248  theRmax = std::max(theRmax, rmax);
249  theZmin = std::min(theZmin, zmin);
250  theZmax = std::max(theZmax, zmax);
251  }
252 
253  float zPos = (theZmax + theZmin) / 2.;
254  Plane::PositionType pos(0., 0., zPos);
256 
257  return new BoundDisk(pos, rot, new SimpleDiskBounds(theRmin, theRmax, theZmin - zPos, theZmax - zPos));
258  }
Disk BoundDisk
Definition: BoundDisk.h:54

◆ computeWindowSize()

float tkDetUtil::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
)

Definition at line 10 of file TkDetUtil.cc.

References calculatePhiWindow(), particleFlowClusterHGC_cfi::maxDistance, MeasurementEstimator::maximalLocalDisplacement(), and GeomDet::surface().

Referenced by TECLayer::groupedCompatibleDetsV(), TIDRing::groupedCompatibleDetsV(), CompositeTECWedge::groupedCompatibleDetsV(), Phase2EndcapSingleRing::groupedCompatibleDetsV(), and Phase2EndcapRing::groupedCompatibleDetsV().

10  {
11  const Plane& startPlane = det->surface();
12  auto maxDistance = est.maximalLocalDisplacement(tsos, startPlane);
13  return std::copysign(calculatePhiWindow(maxDistance, tsos, startPlane), maxDistance.x());
14  }
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
Definition: Plane.h:16
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
float calculatePhiWindow(const MeasurementEstimator::Local2DVector &imaxDistance, const TrajectoryStateOnSurface &ts, const Plane &plane)
Definition: TkDetUtil.cc:16

◆ computeYdirWindowSize()

float tkDetUtil::computeYdirWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
)

Definition at line 71 of file TkDetUtil.cc.

References particleFlowClusterHGC_cfi::maxDistance, MeasurementEstimator::maximalLocalDisplacement(), and GeomDet::surface().

Referenced by Phase2EndcapSubDisk::computeWindowSize(), Phase2EndcapLayer::computeWindowSize(), and groupedCompatibleDetsV().

73  {
74  const Plane& startPlane = det->surface();
76  return maxDistance.y();
77  }
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
Definition: Plane.h:16
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37

◆ fillRingParametersFromDisk()

RingPar tkDetUtil::fillRingParametersFromDisk ( const BoundDisk ringDisk)

Definition at line 124 of file TkDetUtil.cc.

References funct::abs(), tkDetUtil::RingPar::theRingR, tkDetUtil::RingPar::thetaRingMax, and tkDetUtil::RingPar::thetaRingMin.

Referenced by Phase2EndcapSubDisk::fillRingPars(), and Phase2EndcapLayer::fillRingPars().

124  {
125  float ringMinZ = std::abs(ringDisk.position().z()) - ringDisk.bounds().thickness() / 2.;
126  float ringMaxZ = std::abs(ringDisk.position().z()) + ringDisk.bounds().thickness() / 2.;
127  RingPar tempPar;
128  tempPar.thetaRingMin = ringDisk.innerRadius() / ringMaxZ;
129  tempPar.thetaRingMax = ringDisk.outerRadius() / ringMinZ;
130  tempPar.theRingR = (ringDisk.innerRadius() + ringDisk.outerRadius()) / 2.;
131  return tempPar;
132  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ findThreeClosest()

std::array< int, 3 > tkDetUtil::findThreeClosest ( const std::vector< RingPar > &  ringParams,
const std::vector< GlobalPoint > &  ringCrossing,
const int  ringSize 
)

Definition at line 79 of file TkDetUtil.cc.

References funct::abs(), mps_fire::i, perp(), and pfIsolationCalculator_cfi::ringSize.

Referenced by ringIndicesByCrossingProximity().

81  {
82  std::array<int, 3> theBins = {{-1, -1, -1}};
83  theBins[0] = 0;
84  float initialR = ringParams[0].theRingR;
85  float rDiff0 = std::abs(ringCrossing[0].perp() - initialR);
86  float rDiff1 = -1.;
87  float rDiff2 = -1.;
88  for (int i = 1; i < ringSize; i++) {
89  float ringR = ringParams[i].theRingR;
90  float testDiff = std::abs(ringCrossing[i].perp() - ringR);
91  if (testDiff < rDiff0) {
92  rDiff2 = rDiff1;
93  rDiff1 = rDiff0;
94  rDiff0 = testDiff;
95  theBins[2] = theBins[1];
96  theBins[1] = theBins[0];
97  theBins[0] = i;
98  } else if (rDiff1 < 0 || testDiff < rDiff1) {
99  rDiff2 = rDiff1;
100  rDiff1 = testDiff;
101  theBins[2] = theBins[1];
102  theBins[1] = i;
103  } else if (rDiff2 < 0 || testDiff < rDiff2) {
104  rDiff2 = testDiff;
105  theBins[2] = i;
106  }
107  }
108 
109  return theBins;
110  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T perp() const
Magnitude of transverse component.

◆ groupedCompatibleDetsV()

template<class T >
void tkDetUtil::groupedCompatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result,
const int  ringSize,
const std::vector< const T *> &  diskComponents,
const std::vector< RingPar > &  ringParams 
)

Definition at line 100 of file TkDetUtil.h.

References funct::abs(), DetGroupMerger::addSameLevel(), alongMomentum, computeYdirWindowSize(), EcalPhiSymFlatTableProducers_cfi::fill, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), mps_fire::i, eostools::move(), DetGroupMerger::orderAndMergeTwoLevels(), overlapInR(), position, Propagator::propagationDirection(), mps_fire::result, ringIndicesByCrossingProximity(), pfIsolationCalculator_cfi::ringSize, and PV3DBase< T, PVType, FrameType >::z().

Referenced by Phase2EndcapLayer::groupedCompatibleDetsV(), and Phase2EndcapSubDisk::groupedCompatibleDetsV().

106  {
107  std::array<int, 3> const& ringIndices =
108  ringIndicesByCrossingProximity(startingState, prop, ringSize, diskComponents, ringParams);
109  if (ringIndices[0] == -1 || ringIndices[1] == -1 || ringIndices[2] == -1) {
110  edm::LogError("TkDetLayers") << "TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
111  return;
112  }
113 
114  //order is: rings in front = 0; rings in back = 1
115  //rings should be already ordered in r
116  //if the layer has 1 ring, it does not matter
117  //FIXME: to be optimized once the geometry is stable
118  std::vector<int> ringOrder(ringSize);
119  std::fill(ringOrder.begin(), ringOrder.end(), 1);
120  if (ringSize > 1) {
121  if (std::abs(diskComponents[0]->position().z()) < std::abs(diskComponents[1]->position().z())) {
122  for (int i = 0; i < ringSize; i++) {
123  if (i % 2 == 0)
124  ringOrder[i] = 0;
125  }
126  } else if (std::abs(diskComponents[0]->position().z()) > std::abs(diskComponents[1]->position().z())) {
127  std::fill(ringOrder.begin(), ringOrder.end(), 0);
128  for (int i = 0; i < ringSize; i++) {
129  if (i % 2 == 0)
130  ringOrder[i] = 1;
131  }
132  } else {
133  throw DetLayerException("Rings in Endcap Layer have same z position, no idea how to order them!");
134  }
135  }
136 
137  auto index = [&ringIndices, &ringOrder](int i) { return ringOrder[ringIndices[i]]; };
138 
139  std::vector<DetGroup> closestResult;
140  diskComponents[ringIndices[0]]->groupedCompatibleDetsV(startingState, prop, est, closestResult);
141  // if the closest is empty, use the next one and exit: inherited from TID !
142  if (closestResult.empty()) {
143  diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, result);
144  return;
145  }
146 
147  DetGroupElement closestGel(closestResult.front().front());
148  float rWindow = computeYdirWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
149 
150  // check if next ring and next next ring are found and if there is overlap
151 
152  bool ring1ok =
153  ringIndices[1] != -1 && overlapInR(closestGel.trajectoryState(), ringIndices[1], rWindow, ringParams);
154  bool ring2ok =
155  ringIndices[2] != -1 && overlapInR(closestGel.trajectoryState(), ringIndices[2], rWindow, ringParams);
156 
157  // look for the two rings in the same plane (are they only two?)
158 
159  // determine if we are propagating from in to out (0) or from out to in (1)
160 
161  int direction = 0;
162  if (startingState.globalPosition().z() * startingState.globalMomentum().z() > 0) {
163  if (prop.propagationDirection() == alongMomentum)
164  direction = 0;
165  else
166  direction = 1;
167  } else {
168  if (prop.propagationDirection() == alongMomentum)
169  direction = 1;
170  else
171  direction = 0;
172  }
173 
174  if ((index(0) == index(1)) && (index(0) == index(2))) {
175  edm::LogInfo("AllRingsInOnePlane") << " All rings: " << ringIndices[0] << " " << ringIndices[1] << " "
176  << ringIndices[2] << " in one plane. Only the first two will be considered";
177  ring2ok = false;
178  }
179 
180  if (index(0) == index(1)) {
181  if (ring1ok) {
182  std::vector<DetGroup> ring1res;
183  diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
184  DetGroupMerger::addSameLevel(std::move(ring1res), closestResult);
185  }
186  if (ring2ok) {
187  std::vector<DetGroup> ring2res;
188  diskComponents[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
190  std::move(closestResult), std::move(ring2res), result, index(0), direction);
191  return;
192  } else {
193  result.swap(closestResult);
194  return;
195  }
196  } else if (index(0) == index(2)) {
197  if (ring2ok) {
198  std::vector<DetGroup> ring2res;
199  diskComponents[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
200  DetGroupMerger::addSameLevel(std::move(ring2res), closestResult);
201  }
202  if (ring1ok) {
203  std::vector<DetGroup> ring1res;
204  diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
206  std::move(closestResult), std::move(ring1res), result, index(0), direction);
207  return;
208  } else {
209  result.swap(closestResult);
210  return;
211  }
212  } else {
213  std::vector<DetGroup> ring12res;
214  if (ring1ok) {
215  std::vector<DetGroup> ring1res;
216  diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
217  ring12res.swap(ring1res);
218  }
219  if (ring2ok) {
220  std::vector<DetGroup> ring2res;
221  diskComponents[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
222  DetGroupMerger::addSameLevel(std::move(ring2res), ring12res);
223  }
224  if (!ring12res.empty()) {
226  std::move(closestResult), std::move(ring12res), result, index(0), direction);
227  return;
228  } else {
229  result.swap(closestResult);
230  return;
231  }
232  }
233  }
Common base class.
bool overlapInR(const TrajectoryStateOnSurface &tsos, int index, double ymax, const std::vector< RingPar > &ringParams)
Definition: TkDetUtil.cc:112
T z() const
Definition: PV3DBase.h:61
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const int ringSize, const T &diskComponents, const std::vector< RingPar > &ringParams)
Definition: TkDetUtil.h:60
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
Log< level::Error, false > LogError
float computeYdirWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:71
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
GlobalPoint globalPosition() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Log< level::Info, false > LogInfo
GlobalVector globalMomentum() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
def move(src, dest)
Definition: eostools.py:511

◆ overlapInPhi() [1/2]

bool tkDetUtil::overlapInPhi ( float  phi,
const GeomDet det,
float  phiWindow 
)
inline

Definition at line 32 of file TkDetUtil.h.

References Geom::phiLess(), Surface::phiSpan(), trackingPOGFilters_cfi::phiWindow, rangesIntersect(), GeomDet::surface(), and x.

Referenced by overlapInPhi(), CompositeTECWedge::searchNeighbors(), Phase2EndcapSingleRing::searchNeighbors(), TIDRing::searchNeighbors(), and Phase2EndcapRing::searchNeighbors().

32  {
33  std::pair<float, float> phiRange(phi - phiWindow, phi + phiWindow);
34  return rangesIntersect(phiRange, det.surface().phiSpan(), [](auto x, auto y) { return Geom::phiLess(x, y); });
35  }
std::pair< float, float > const & phiSpan() const
Definition: Surface.h:90
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
bool rangesIntersect(const Range &a, const Range &b)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
float x

◆ overlapInPhi() [2/2]

bool tkDetUtil::overlapInPhi ( GlobalPoint  crossPoint,
const GeomDet det,
float  phiWindow 
)
inline

Definition at line 37 of file TkDetUtil.h.

References PV3DBase< T, PVType, FrameType >::barePhi(), overlapInPhi(), and trackingPOGFilters_cfi::phiWindow.

37  {
38  return overlapInPhi(crossPoint.barePhi(), det, phiWindow);
39  }
T barePhi() const
Definition: PV3DBase.h:65
bool overlapInPhi(GlobalPoint crossPoint, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.h:37

◆ overlapInR()

bool tkDetUtil::overlapInR ( const TrajectoryStateOnSurface tsos,
int  index,
double  ymax,
const std::vector< RingPar > &  ringParams 
)

Definition at line 112 of file TkDetUtil.cc.

References funct::abs(), f, TrajectoryStateOnSurface::globalPosition(), WZElectronSkims53X_cff::max, PV3DBase< T, PVType, FrameType >::perp(), L1TOccupancyClient_cfi::ymax, and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV(), Phase2EndcapSubDisk::overlapInR(), and Phase2EndcapLayer::overlapInR().

112  {
113  // assume "fixed theta window", i.e. margin in local y = r is changing linearly with z
114  float tsRadius = tsos.globalPosition().perp();
115  float thetamin =
116  (std::max(0., tsRadius - ymax)) / (std::abs(tsos.globalPosition().z()) + 10.f); // add 10 cm contingency
117  float thetamax = (tsRadius + ymax) / (std::abs(tsos.globalPosition().z()) - 10.f);
118 
119  // do the theta regions overlap ?
120 
121  return !(thetamin > ringParams[index].thetaRingMax || ringParams[index].thetaRingMin > thetamax);
122  }
T perp() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:61
GlobalPoint globalPosition() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]

◆ ringIndicesByCrossingProximity()

template<class T >
std::array<int, 3> tkDetUtil::ringIndicesByCrossingProximity ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const int  ringSize,
const T diskComponents,
const std::vector< RingPar > &  ringParams 
)

Definition at line 60 of file TkDetUtil.h.

References findThreeClosest(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), mps_fire::i, Propagator::propagationDirection(), pfIsolationCalculator_cfi::ringSize, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

64  {
65  typedef HelixForwardPlaneCrossing Crossing;
67 
68  HelixPlaneCrossing::PositionType startPos(startingState.globalPosition());
69  HelixPlaneCrossing::DirectionType startDir(startingState.globalMomentum());
71  float rho(startingState.transverseCurvature());
72 
73  // calculate the crossings with the ring surfaces
74  // rings are assumed to be sorted in R !
75 
76  Crossing myXing(startPos, startDir, rho, propDir);
77 
78  std::vector<GlobalPoint> ringCrossings;
79  ringCrossings.reserve(ringSize);
80 
81  for (int i = 0; i < ringSize; i++) {
82  const BoundDisk& theRing = static_cast<const BoundDisk&>(diskComponents[i]->surface());
83  std::pair<bool, double> pathlen = myXing.pathLength(theRing);
84  if (pathlen.first) {
85  ringCrossings.push_back(GlobalPoint(myXing.position(pathlen.second)));
86  } else {
87  // TO FIX.... perhaps there is something smarter to do
88  ringCrossings.push_back(GlobalPoint(0., 0., 0.));
89  }
90  }
91 
92  //find three closest rings to the crossing
93 
94  std::array<int, 3> closests = findThreeClosest(ringParams, ringCrossings, ringSize);
95 
96  return closests;
97  }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
PropagationDirection
std::array< int, 3 > findThreeClosest(const std::vector< RingPar > &ringParams, const std::vector< GlobalPoint > &ringCrossing, const int ringSize)
Definition: TkDetUtil.cc:79
GlobalPoint globalPosition() const
GlobalVector globalMomentum() const
Vector2DBase< float, LocalTag > Local2DVector