1 #ifndef TkDetLayers_TkDetUtil_h 2 #define TkDetLayers_TkDetUtil_h 24 #pragma GCC visibility push(hidden) 52 const std::vector<GlobalPoint>& ringCrossing,
63 const T& diskComponents,
64 const std::vector<RingPar>& ringParams) {
76 Crossing myXing(startPos, startDir, rho, propDir);
78 std::vector<GlobalPoint> ringCrossings;
83 std::pair<bool, double> pathlen = myXing.pathLength(theRing);
85 ringCrossings.push_back(
GlobalPoint(myXing.position(pathlen.second)));
103 std::vector<DetGroup>&
result,
105 const std::vector<const T*>& diskComponents,
106 const std::vector<RingPar>& ringParams) {
107 std::array<int, 3>
const& ringIndices =
109 if (ringIndices[0] == -1 || ringIndices[1] == -1 || ringIndices[2] == -1) {
110 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
118 std::vector<int> ringOrder(
ringSize);
119 std::fill(ringOrder.begin(), ringOrder.end(), 1);
127 std::fill(ringOrder.begin(), ringOrder.end(), 0);
133 throw DetLayerException(
"Rings in Endcap Layer have same z position, no idea how to order them!");
137 auto index = [&ringIndices, &ringOrder](
int i) {
return ringOrder[ringIndices[
i]]; };
139 std::vector<DetGroup> closestResult;
140 diskComponents[ringIndices[0]]->groupedCompatibleDetsV(startingState, prop, est, closestResult);
142 if (closestResult.empty()) {
143 diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est,
result);
153 ringIndices[1] != -1 &&
overlapInR(closestGel.trajectoryState(), ringIndices[1], rWindow, ringParams);
155 ringIndices[2] != -1 &&
overlapInR(closestGel.trajectoryState(), ringIndices[2], rWindow, ringParams);
175 edm::LogInfo(
"AllRingsInOnePlane") <<
" All rings: " << ringIndices[0] <<
" " << ringIndices[1] <<
" " 176 << ringIndices[2] <<
" in one plane. Only the first two will be considered";
182 std::vector<DetGroup> ring1res;
183 diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
187 std::vector<DetGroup> ring2res;
188 diskComponents[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
193 result.swap(closestResult);
198 std::vector<DetGroup> ring2res;
199 diskComponents[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
203 std::vector<DetGroup> ring1res;
204 diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
209 result.swap(closestResult);
213 std::vector<DetGroup> ring12res;
215 std::vector<DetGroup> ring1res;
216 diskComponents[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
217 ring12res.swap(ring1res);
220 std::vector<DetGroup> ring2res;
221 diskComponents[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
224 if (!ring12res.empty()) {
229 result.swap(closestResult);
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;
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.;
253 float zPos = (theZmax + theZmin) / 2.;
262 #pragma GCC visibility pop 263 #endif // TkDetLayers_TkDetUtil_h
bool overlapInR(const TrajectoryStateOnSurface &tsos, int index, double ymax, const std::vector< RingPar > &ringParams)
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)
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const int ringSize, const T &diskComponents, const std::vector< RingPar > &ringParams)
Global3DPoint GlobalPoint
virtual PropagationDirection propagationDirection() const final
Log< level::Error, false > LogError
bool overlapInPhi(float phi, const GeomDet &det, float phiWindow)
std::array< int, 3 > findThreeClosest(const std::vector< RingPar > &ringParams, const std::vector< GlobalPoint > &ringCrossing, const int ringSize)
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
float computeYdirWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
GlobalPoint globalPosition() const
Abs< T >::type abs(const T &t)
std::pair< float, float > const & phiSpan() const
RingPar fillRingParametersFromDisk(const BoundDisk &ringDisk)
bool phiLess(float phi1, float phi2)
Log< level::Info, false > LogInfo
bool rangesIntersect(const Range &a, const Range &b)
const Plane & surface() const
The nominal surface of the GeomDet.
BoundDisk * computeDisk(const std::vector< const T *> &structures)
double transverseCurvature() const
GlobalVector globalMomentum() const
static int position[264][3]
Vector2DBase< float, LocalTag > Local2DVector
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
float calculatePhiWindow(const MeasurementEstimator::Local2DVector &imaxDistance, const TrajectoryStateOnSurface &ts, const Plane &plane)