38 inline void mergeOutward(
std::array<vector<DetGroup>, 3>& groups, std::vector<DetGroup>&
result) {
40 Merger::orderAndMergeTwoLevels(
std::move(groups[0]),
std::move(groups[1]), result, 1, 1);
41 if (!groups[2].
empty()) {
42 std::vector<DetGroup>
tmp;
48 inline void mergeInward(
std::array<vector<DetGroup>, 3>& groups, std::vector<DetGroup>& result) {
50 Merger::orderAndMergeTwoLevels(
std::move(groups[2]),
std::move(groups[1]), result, 1, 1);
51 if (!groups[0].
empty()) {
52 std::vector<DetGroup>
tmp;
61 std::vector<DetGroup>& result) {
65 mergeOutward(groups, result);
67 mergeInward(groups, result);
70 mergeOutward(groups, result);
72 mergeInward(groups, result);
80 if (not theComponents) {
81 auto temp = std::make_unique<std::vector<const GeometricSearchDet*>>();
83 for (
auto c : theComps)
85 std::vector<const GeometricSearchDet*>* expected =
nullptr;
86 if (theComponents.compare_exchange_strong(expected,
temp.get())) {
92 return *theComponents;
97 float ringMinZ =
std::abs(ringDisk.position().z()) - ringDisk.bounds().thickness() / 2.;
98 float ringMaxZ =
std::abs(ringDisk.position().z()) + ringDisk.bounds().thickness() / 2.;
99 ringPars[
i].thetaRingMin = ringDisk.innerRadius() / ringMaxZ;
100 ringPars[
i].thetaRingMax = ringDisk.outerRadius() / ringMinZ;
101 ringPars[
i].theRingR = (ringDisk.innerRadius() + ringDisk.outerRadius()) / 2.;
108 if (rings.size() != 3)
112 for (
int i = 0;
i != 3; ++
i) {
119 LogDebug(
"TkDetLayers") <<
"==== DEBUG TIDLayer =====";
120 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: " << this->
position().perp() <<
" , " 121 << this->
position().z() <<
" , " << this->specificSurface().bounds().thickness() <<
" , " 122 << this->specificSurface().innerRadius() <<
" , " << this->specificSurface().outerRadius();
126 float theRmin = rings.front()->specificSurface().innerRadius();
127 float theRmax = rings.front()->specificSurface().outerRadius();
128 float theZmin = rings.front()->position().z() - rings.front()->surface().bounds().thickness() / 2;
129 float theZmax = rings.front()->position().z() + rings.front()->surface().bounds().thickness() / 2;
131 for (vector<const TIDRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
132 float rmin = (**i).specificSurface().innerRadius();
133 float rmax = (**i).specificSurface().outerRadius();
134 float zmin = (**i).position().z() - (**i).surface().bounds().thickness() / 2.;
135 float zmax = (**i).position().z() + (**i).surface().bounds().thickness() / 2.;
136 theRmin =
min(theRmin, rmin);
137 theRmax =
max(theRmax, rmax);
138 theZmin =
min(theZmin, zmin);
139 theZmax =
max(theZmax, zmax);
142 float zPos = (theZmax + theZmin) / 2.;
159 std::vector<DetGroup>&
result)
const {
161 if (ringIndices[0] == -1) {
162 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
166 std::array<vector<DetGroup>, 3> groupsAtRingLevel;
169 #ifdef __INTEL_COMPILER 170 const int ringOrder[3]{1, 2, 0};
174 auto index = [&ringIndices, &ringOrder](
int i) {
return ringOrder[ringIndices[
i]]; };
176 auto& closestResult = groupsAtRingLevel[
index(0)];
178 if (closestResult.empty()) {
184 float rWindow =
computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
186 if (!
overlapInR(closestGel.trajectoryState(), ringIndices[1], rWindow)) {
187 result.swap(closestResult);
191 auto& nextResult = groupsAtRingLevel[
index(1)];
193 if (nextResult.empty()) {
194 result.swap(closestResult);
198 if (!
overlapInR(closestGel.trajectoryState(), ringIndices[2], rWindow)) {
200 orderAndMergeLevels(closestGel.trajectoryState(), prop, groupsAtRingLevel,
result);
204 auto& nextNextResult = groupsAtRingLevel[
index(2)];
206 if (nextNextResult.empty()) {
208 orderAndMergeLevels(closestGel.trajectoryState(), prop, groupsAtRingLevel,
result);
213 orderAndMergeLevels(closestGel.trajectoryState(), prop, groupsAtRingLevel,
result);
229 Crossing myXing(startPos, startDir,
rho, propDir);
234 for (
int i = 0;
i < 3;
i++) {
236 pair<bool, double> pathlen = myXing.pathLength(theRing);
238 ringCrossings[
i] =
GlobalPoint(myXing.position(pathlen.second));
250 if (closestIndex < 0 || nextIndex < 0)
251 return std::array<int, 3>{{-1, -1, -1}};
252 int nextNextIndex = -1;
253 for (
int i = 0;
i < 3;
i++) {
254 if (
i != closestIndex &&
i != nextIndex) {
260 std::array<int, 3>
indices{{closestIndex, nextIndex, nextNextIndex}};
269 return maxDistance.
y();
275 float rDiff =
std::abs(ringCrossing[0].
perp() - initialR);
276 for (
int i = 1;
i < 3;
i++) {
279 if (testDiff < rDiff) {
288 int firstIndexToCheck = (closest != 0) ? 0 : 1;
290 float rDiff =
std::abs(ringCrossing[firstIndexToCheck].
perp() - initialR);
291 int theBin = firstIndexToCheck;
292 for (
int i = firstIndexToCheck + 1;
i < 3;
i++) {
296 if (testDiff < rDiff) {
TkRotation< Scalar > RotationType
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
std::vector< GeomDet const * > theBasicComps
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
Global3DPoint GlobalPoint
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
GlobalPoint globalPosition() const
const BoundSurface & surface() const override
The surface of the GeometricSearchDet.
const Plane & surface() const
The nominal surface of the GeomDet.
Point3DBase< Scalar, GlobalTag > PositionType
virtual PropagationDirection propagationDirection() const final
TIDLayer(std::vector< const TIDRing * > &rings) __attribute__((cold))
Abs< T >::type abs(const T &t)
GeometricSearchDet::DetWithState DetWithState
std::atomic< std::vector< const GeometricSearchDet * > * > theComponents
void fillRingPars(int i) __attribute__((cold))
~TIDLayer() override __attribute__((cold))
bool overlapInR(const TrajectoryStateOnSurface &tsos, int i, double ymax) const __attribute__((hot))
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
T perp() const
Magnitude of transverse component.
GlobalVector globalMomentum() const
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
static int position[264][3]
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
Vector2DBase< float, LocalTag > Local2DVector
BoundDisk * computeDisk(const std::vector< const TIDRing * > &rings) const __attribute__((cold))
const TIDRing * theComps[3]
int findClosest(const GlobalPoint[3]) const __attribute__((hot))
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
int findNextIndex(const GlobalPoint[3], int) const __attribute__((hot))
const std::vector< const GeomDet * > & basicComponents() const override
double transverseCurvature() const