25 return (fabs(a.front().det()->position().z()) < fabs(b.front().det()->position().z()));
30 vector<const GeomDet*>& outerDets,
31 const vector<const GeomDet*>& innerDetBrothers,
32 const vector<const GeomDet*>& outerDetBrothers)
34 theFrontDets(innerDets.
begin(), innerDets.
end()),
35 theBackDets(outerDets.
begin(), outerDets.
end()),
36 theFrontDetBrothers(innerDetBrothers.
begin(), innerDetBrothers.
end()),
37 theBackDetBrothers(outerDetBrothers.
begin(), outerDetBrothers.
end()) {
56 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for Phase2EndcapRing";
58 LogDebug(
"TkDetLayers") <<
"frontDet detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , "
59 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , "
60 << (*it)->surface().position().perp();
66 LogDebug(
"TkDetLayers") <<
"frontDet brothers detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , "
67 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , "
68 << (*it)->surface().position().perp();
73 LogDebug(
"TkDetLayers") <<
"backDet detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , "
74 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , "
75 << (*it)->surface().position().perp();
80 LogDebug(
"TkDetLayers") <<
"backDet brothers detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , "
81 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , "
82 << (*it)->surface().position().perp();
91 throw DetLayerException(
"Phase2EndcapRing doesn't have GeometricSearchDet components");
97 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2EndcapRing::compatible()!!";
98 return pair<bool, TrajectoryStateOnSurface>();
104 std::vector<DetGroup>&
result)
const {
110 std::vector<DetGroup> closestResult;
111 std::vector<DetGroup> closestBrotherResult;
112 addClosest(tsos, prop, est, crossings.
closest(), closestResult, closestBrotherResult);
113 if (closestResult.empty())
119 searchNeighbors(tsos, prop, est, crossings.
closest(), phiWindow, closestResult, closestBrotherResult,
false);
121 vector<DetGroup> closestCompleteResult;
123 std::move(closestResult),
std::move(closestBrotherResult), closestCompleteResult, 0, crossingSide);
125 vector<DetGroup> nextResult;
126 vector<DetGroup> nextBrotherResult;
127 searchNeighbors(tsos, prop, est, crossings.
other(), phiWindow, nextResult, nextBrotherResult,
true);
129 vector<DetGroup> nextCompleteResult;
131 std::move(nextResult),
std::move(nextBrotherResult), nextCompleteResult, 0, crossingSide);
141 LogTrace(
"TkDetLayers") <<
"Number of groups : " << result.size() << std::endl;
142 for (
auto& grp : result) {
145 LogTrace(
"TkDetLayers") <<
"New group in Phase2EndcapRing made by : " << std::endl;
146 for (
auto const& det : grp) {
147 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp()
148 <<
" id:" << det.det()->geographicalId().rawId()
149 <<
" tsos at:" << det.trajectoryState().globalPosition() << std::endl;
163 pair<bool, double> frontPath = crossing.pathLength(*
theFrontDisk);
164 if (!frontPath.first)
167 pair<bool, double> backPath = crossing.pathLength(*
theBackDisk);
171 GlobalPoint gFrontPoint(crossing.position(frontPath.second));
172 GlobalPoint gBackPoint(crossing.position(backPath.second));
184 if (frontDist < backDist) {
196 vector<DetGroup>& brotherresult)
const {
206 return firstgroup || brothergroup;
215 vector<DetGroup>& brotherresult,
216 bool checkClosest)
const {
224 int negStartIndex = closestIndex - 1;
225 int posStartIndex = closestIndex + 1;
229 posStartIndex = closestIndex;
231 negStartIndex = closestIndex;
238 int half = sLayer.size() / 2;
239 for (
int idet = negStartIndex; idet >= negStartIndex - half; idet--) {
243 if (!
Adder::add(neighborDet, tsos, prop, est, result))
248 const GeomDet& neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
249 Adder::add(neighborBrotherDet, tsos, prop, est, brotherresult);
252 for (
int idet = posStartIndex; idet < posStartIndex + half; idet++) {
256 if (!
Adder::add(neighborDet, tsos, prop, est, result))
261 const GeomDet& neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
262 Adder::add(neighborBrotherDet, tsos, prop, est, brotherresult);
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
Returns basic components, if any.
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
std::vector< const GeomDet * > theDets
std::vector< const GeomDet * > theFrontDets
int closestDetIndex() const
std::vector< const GeomDet * > theFrontDetBrothers
GlobalPoint globalPosition() const
std::vector< const GeomDet * > theBackDets
virtual PropagationDirection propagationDirection() const final
Log< level::Error, false > LogError
bool overlapInPhi(float phi, const GeomDet &det, float phiWindow)
const std::vector< const GeomDet * > & subLayer(int ind) const
const GlobalPoint & position() const
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
int subLayerIndex() const
ReferenceCountingPointer< BoundDisk > theFrontDisk
BinFinderType theFrontBinFinder
Abs< T >::type abs(const T &t)
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
ReferenceCountingPointer< BoundDisk > theDisk
const std::vector< const GeomDet * > & subLayerBrothers(int ind) const
std::vector< const GeomDet * > theBackDetBrothers
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))
bool phiLess(float phi1, float phi2)
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))
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
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))
const SubLayerCrossing & closest() const
GlobalVector globalMomentum() const
~Phase2EndcapRing() override
bool operator()(DetGroup a, DetGroup b)
PeriodicBinFinderInPhi< float > BinFinderType
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
BinFinderType theBackBinFinder
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const override
ReferenceCountingPointer< BoundDisk > theBackDisk
double transverseCurvature() const
Phase2EndcapRing(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 * >())