19 class DetGroupElementPerpLess {
22 return (a.front().det()->position().perp() < b.front().det()->position().perp());
28 vector<const GeomDet*>& outerDets,
29 vector<const GeomDet*>& innerDetBrothers,
30 vector<const GeomDet*>& outerDetBrothers)
32 theInnerDets(innerDets),
33 theOuterDets(outerDets),
34 theInnerDetBrothers(innerDetBrothers),
35 theOuterDetBrothers(outerDetBrothers) {
52 LogDebug(
"TkDetLayers") <<
"==== DEBUG Phase2OTBarrelRod =====";
54 LogDebug(
"TkDetLayers") <<
"inner Phase2OTBarrelRod's Det pos z,perp,eta,phi: " << (**i).position().z() <<
" , " 55 << (**i).position().perp() <<
" , " << (**i).position().eta() <<
" , " 56 << (**i).position().phi();
60 LogDebug(
"TkDetLayers") <<
"inner Phase2OTBarrelRod's Det Brother pos z,perp,eta,phi: " << (**i).position().z()
61 <<
" , " << (**i).position().perp() <<
" , " << (**i).position().eta() <<
" , " 62 << (**i).position().phi();
66 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det pos z,perp,eta,phi: " << (**i).position().z() <<
" , " 67 << (**i).position().perp() <<
" , " << (**i).position().eta() <<
" , " 68 << (**i).position().phi();
72 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det Brother pos z,perp,eta,phi: " << (**i).position().z()
73 <<
" , " << (**i).position().perp() <<
" , " << (**i).position().eta() <<
" , " 74 << (**i).position().phi();
76 LogDebug(
"TkDetLayers") <<
"==== end DEBUG Phase2OTBarrelRod =====";
83 throw DetLayerException(
"Phase2OTBarrelRod doesn't have GeometricSearchDet components");
89 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2OTBarrelRod::compatible()!!";
90 return pair<bool, TrajectoryStateOnSurface>();
96 std::vector<DetGroup>&
result)
const {
102 std::vector<DetGroup> closestResult;
103 std::vector<DetGroup> closestBrotherResult;
104 addClosest(tsos, prop, est, crossings.
closest(), closestResult, closestBrotherResult);
105 if (closestResult.empty()) {
106 std::vector<DetGroup> nextResult;
107 std::vector<DetGroup> nextBrotherResult;
108 addClosest(tsos, prop, est, crossings.
other(), nextResult, nextBrotherResult);
109 if (nextResult.empty())
114 std::vector<DetGroup> closestCompleteResult;
116 std::move(closestResult),
std::move(closestBrotherResult), closestCompleteResult, 0, crossingSide);
117 std::vector<DetGroup> nextCompleteResult;
119 std::move(nextResult),
std::move(nextBrotherResult), nextCompleteResult, 0, crossingSide);
130 std::vector<DetGroup> closestCompleteResult;
132 std::move(closestResult),
std::move(closestBrotherResult), closestCompleteResult, 0, crossingSide);
134 std::vector<DetGroup> nextResult;
135 std::vector<DetGroup> nextBrotherResult;
138 std::vector<DetGroup> nextCompleteResult;
140 std::move(nextResult),
std::move(nextBrotherResult), nextCompleteResult, 0, crossingSide);
147 sort(result.begin(), result.end(), DetGroupElementPerpLess());
148 for (
auto& grp : result) {
151 LogTrace(
"TkDetLayers") <<
"New group in Phase2OTBarrelRod made by : ";
152 for (
auto const& det : grp) {
153 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp()
154 <<
" id:" << det.det()->geographicalId().rawId()
155 <<
" tsos at:" << det.trajectoryState().globalPosition();
168 std::pair<bool, double> outerPath = crossing.pathLength(*
theOuterPlane);
169 if (!outerPath.first)
171 GlobalPoint gOuterPoint(crossing.position(outerPath.second));
173 std::pair<bool, double> innerPath = crossing.pathLength(*
theInnerPlane);
174 if (!innerPath.first)
176 GlobalPoint gInnerPoint(crossing.position(innerPath.second));
186 if (innerDist < outerDist) {
198 vector<DetGroup>& brotherresult)
const {
206 return firstgroup || brothergroup;
229 float localY = localCrossPoint.y();
235 return (
std::abs(localY) - window) < relativeMargin * detHalfLength;
246 vector<DetGroup>& brotherresult,
247 bool checkClosest)
const {
254 int negStartIndex = closestIndex - 1;
255 int posStartIndex = closestIndex + 1;
258 if (gCrossingPos.
z() < sRod[closestIndex]->surface().position().z()) {
259 posStartIndex = closestIndex;
261 negStartIndex = closestIndex;
266 for (
int idet = negStartIndex; idet >= 0; idet--) {
267 if (!
overlap(gCrossingPos, *sRod[idet], window))
269 if (!
Adder::add(*sRod[idet], tsos, prop, est, result))
272 Adder::add(*sBrotherRod[idet], tsos, prop, est, brotherresult);
274 for (
int idet = posStartIndex; idet < static_cast<int>(sRod.size()); idet++) {
275 if (!
overlap(gCrossingPos, *sRod[idet], window))
277 if (!
Adder::add(*sRod[idet], tsos, prop, est, result))
280 Adder::add(*sBrotherRod[idet], tsos, prop, est, brotherresult);
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
virtual float length() const =0
Phase2OTBarrelRod(std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets, std::vector< const GeomDet * > &innerDetBrothers, std::vector< const GeomDet * > &outerDetBrothers) __attribute__((cold))
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const override __attribute__((cold))
int closestDetIndex() const
BinFinderType theOuterBinFinder
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
Returns basic components, if any.
constexpr uint16_t localY(uint16_t py)
GlobalPoint globalPosition() const
const Bounds & bounds() const
const Plane & surface() const
The nominal surface of the GeomDet.
T binPosition(int ind) const override
the middle of the bin.
std::vector< const GeomDet * > theDets
const GlobalPoint & position() const
GeometricSearchDet::DetWithState DetWithState
virtual PropagationDirection propagationDirection() const final
BinFinderType theInnerBinFinder
LocalPoint toLocal(const GlobalPoint &gp) const
int subLayerIndex() const
Abs< T >::type abs(const T &t)
std::vector< const GeomDet * > theOuterDetBrothers
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
int binIndex(T z) const override
returns an index in the valid range for the bin closest to Z
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, std::vector< DetGroup > &brotherresult, bool checkClosest) const __attribute__((hot))
const SubLayerCrossing & other() const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
const std::vector< const GeomDet * > & subRodBrothers(int ind) const
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
ReferenceCountingPointer< Plane > theOuterPlane
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
void setPlane(Plane *plane)
Set the rod's plane.
GenericBinFinderInZ< float, GeomDet > BinFinderType
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
const SubLayerCrossing & closest() const
GlobalVector globalMomentum() const
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
ReferenceCountingPointer< Plane > theInnerPlane
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result, std::vector< DetGroup > &brotherresult) const __attribute__((hot))
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
~Phase2OTBarrelRod() override __attribute__((cold))
const std::vector< const GeomDet * > & subRod(int ind) const
std::vector< const GeomDet * > theOuterDets
std::vector< const GeomDet * > theInnerDets
std::vector< const GeomDet * > theInnerDetBrothers
double transverseCurvature() const