19 class DetGroupElementPerpLess {
22 return (
a.front().det()->position().perp() <
b.front().det()->position().perp());
28 vector<const GeomDet*>& outerDets,
29 const vector<const GeomDet*>& innerDetBrothers,
30 const 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();
65 LogDebug(
"TkDetLayers") <<
"==== with stacks =====";
67 LogDebug(
"TkDetLayers") <<
"==== without stacks =====";
70 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det pos z,perp,eta,phi: " << (**i).position().z() <<
" , " 71 << (**i).position().perp() <<
" , " << (**i).position().eta() <<
" , " 72 << (**i).position().phi();
76 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det Brother pos z,perp,eta,phi: " << (**i).position().z()
77 <<
" , " << (**i).position().perp() <<
" , " << (**i).position().eta() <<
" , " 78 << (**i).position().phi();
80 LogDebug(
"TkDetLayers") <<
"==== end DEBUG Phase2OTBarrelRod =====";
87 throw DetLayerException(
"Phase2OTBarrelRod doesn't have GeometricSearchDet components");
93 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2OTBarrelRod::compatible()!!";
94 return pair<bool, TrajectoryStateOnSurface>();
100 std::vector<DetGroup>&
result)
const {
106 std::vector<DetGroup> closestResult;
107 std::vector<DetGroup> closestBrotherResult;
108 addClosest(tsos, prop, est, crossings.
closest(), closestResult, closestBrotherResult);
109 if (closestResult.empty()) {
110 std::vector<DetGroup> nextResult;
111 std::vector<DetGroup> nextBrotherResult;
112 addClosest(tsos, prop, est, crossings.
other(), nextResult, nextBrotherResult);
113 if (nextResult.empty())
118 std::vector<DetGroup> closestCompleteResult;
120 std::move(closestResult),
std::move(closestBrotherResult), closestCompleteResult, 0, crossingSide);
121 std::vector<DetGroup> nextCompleteResult;
123 std::move(nextResult),
std::move(nextBrotherResult), nextCompleteResult, 0, crossingSide);
134 std::vector<DetGroup> closestCompleteResult;
136 std::move(closestResult),
std::move(closestBrotherResult), closestCompleteResult, 0, crossingSide);
138 std::vector<DetGroup> nextResult;
139 std::vector<DetGroup> nextBrotherResult;
142 std::vector<DetGroup> nextCompleteResult;
144 std::move(nextResult),
std::move(nextBrotherResult), nextCompleteResult, 0, crossingSide);
152 for (
auto& grp :
result) {
155 LogTrace(
"TkDetLayers") <<
"New group in Phase2OTBarrelRod made by : ";
156 for (
auto const& det : grp) {
157 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp()
158 <<
" id:" << det.det()->geographicalId().rawId()
159 <<
" tsos at:" << det.trajectoryState().globalPosition();
172 std::pair<bool, double> outerPath = crossing.pathLength(*
theOuterPlane);
173 if (!outerPath.first)
175 GlobalPoint gOuterPoint(crossing.position(outerPath.second));
177 std::pair<bool, double> innerPath = crossing.pathLength(*
theInnerPlane);
178 if (!innerPath.first)
180 GlobalPoint gInnerPoint(crossing.position(innerPath.second));
190 if (innerDist < outerDist) {
202 vector<DetGroup>& brotherresult)
const {
213 return firstgroup || brothergroup;
228 constexpr
float relativeMargin = 1.01;
236 float localY = localCrossPoint.
y();
242 return (
std::abs(localY) -
window) < relativeMargin * detHalfLength;
253 vector<DetGroup>& brotherresult,
254 bool checkClosest)
const {
261 int negStartIndex = closestIndex - 1;
262 int posStartIndex = closestIndex + 1;
265 if (gCrossingPos.
z() < sRod[closestIndex]->surface().position().z()) {
266 posStartIndex = closestIndex;
268 negStartIndex = closestIndex;
273 for (
int idet = negStartIndex; idet >= 0; idet--) {
281 Adder::add(*sBrotherRod[idet], tsos, prop, est, brotherresult);
283 for (
int idet = posStartIndex; idet < static_cast<int>(sRod.size()); idet++) {
291 Adder::add(*sBrotherRod[idet], tsos, prop, est, brotherresult);
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
virtual float length() const =0
BinFinderType theOuterBinFinder
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
virtual PropagationDirection propagationDirection() const final
Log< level::Error, false > LogError
LocalPoint toLocal(const GlobalPoint &gp) const
const std::vector< const GeomDet * > & subRod(int ind) const
std::vector< const GeomDet * > theDets
GeometricSearchDet::DetWithState DetWithState
GlobalPoint globalPosition() const
BinFinderType theInnerBinFinder
const GlobalPoint & position() const
int closestDetIndex() const
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const override __attribute__((cold))
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
int binIndex(T z) const override
returns an index in the valid range for the bin closest to Z
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)
const SubLayerCrossing & closest() const
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))
int subLayerIndex() const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
Phase2OTBarrelRod(std::vector< const GeomDet *> &innerDets, std::vector< const GeomDet *> &outerDets, const std::vector< const GeomDet *> &innerDetBrothers=std::vector< const GeomDet *>(), const std::vector< const GeomDet *> &outerDetBrothers=std::vector< const GeomDet *>()) __attribute__((cold))
const SubLayerCrossing & other() const
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
Returns basic components, if any.
const Plane & surface() const
The nominal surface of the GeomDet.
const std::vector< const GeomDet * > & subRodBrothers(int ind) const
ReferenceCountingPointer< Plane > theOuterPlane
double transverseCurvature() const
GlobalVector globalMomentum() const
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))
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
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))
T binPosition(int ind) const override
the middle of the bin.
std::vector< const GeomDet * > theOuterDets
std::vector< const GeomDet * > theInnerDets
std::vector< const GeomDet * > theInnerDetBrothers
const Bounds & bounds() const