17 #include <boost/function.hpp> 26 return (fabs(a.front().det()->position().z()) < fabs(b.front().det()->position().z()));
31 vector<const GeomDet*>& outerDets,
32 const vector<const GeomDet*>& innerDetBrothers,
33 const vector<const GeomDet*>& outerDetBrothers)
35 theFrontDets(innerDets.
begin(), innerDets.
end()),
36 theBackDets(outerDets.
begin(), outerDets.
end()),
37 theFrontDetBrothers(innerDetBrothers.
begin(), innerDetBrothers.
end()),
38 theBackDetBrothers(outerDetBrothers.
begin(), outerDetBrothers.
end()) {
57 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for Phase2EndcapRing";
59 LogDebug(
"TkDetLayers") <<
"frontDet detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , " 60 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , " 61 << (*it)->surface().position().perp();
67 LogDebug(
"TkDetLayers") <<
"frontDet brothers detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , " 68 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , " 69 << (*it)->surface().position().perp();
74 LogDebug(
"TkDetLayers") <<
"backDet detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , " 75 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , " 76 << (*it)->surface().position().perp();
81 LogDebug(
"TkDetLayers") <<
"backDet brothers detId,phi,z,r: " << (*it)->geographicalId().rawId() <<
" , " 82 << (*it)->surface().position().phi() <<
" , " << (*it)->surface().position().z() <<
" , " 83 << (*it)->surface().position().perp();
92 throw DetLayerException(
"Phase2EndcapRing doesn't have GeometricSearchDet components");
98 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2EndcapRing::compatible()!!";
99 return pair<bool, TrajectoryStateOnSurface>();
105 std::vector<DetGroup>&
result)
const {
111 std::vector<DetGroup> closestResult;
112 std::vector<DetGroup> closestBrotherResult;
113 addClosest(tsos, prop, est, crossings.
closest(), closestResult, closestBrotherResult);
114 if (closestResult.empty())
122 vector<DetGroup> closestCompleteResult;
124 std::move(closestResult),
std::move(closestBrotherResult), closestCompleteResult, 0, crossingSide);
126 vector<DetGroup> nextResult;
127 vector<DetGroup> nextBrotherResult;
130 vector<DetGroup> nextCompleteResult;
132 std::move(nextResult),
std::move(nextBrotherResult), nextCompleteResult, 0, crossingSide);
142 LogTrace(
"TkDetLayers") <<
"Number of groups : " << result.size() << std::endl;
143 for (
auto& grp : result) {
146 LogTrace(
"TkDetLayers") <<
"New group in Phase2EndcapRing made by : " << std::endl;
147 for (
auto const& det : grp) {
148 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp()
149 <<
" id:" << det.det()->geographicalId().rawId()
150 <<
" tsos at:" << det.trajectoryState().globalPosition() << std::endl;
164 pair<bool, double> frontPath = crossing.pathLength(*
theFrontDisk);
165 if (!frontPath.first)
168 pair<bool, double> backPath = crossing.pathLength(*
theBackDisk);
172 GlobalPoint gFrontPoint(crossing.position(frontPath.second));
173 GlobalPoint gBackPoint(crossing.position(backPath.second));
185 if (frontDist < backDist) {
197 vector<DetGroup>& brotherresult)
const {
207 return firstgroup || brothergroup;
216 vector<DetGroup>& brotherresult,
217 bool checkClosest)
const {
225 int negStartIndex = closestIndex - 1;
226 int posStartIndex = closestIndex + 1;
230 posStartIndex = closestIndex;
232 negStartIndex = closestIndex;
239 int half = sLayer.size() / 2;
240 for (
int idet = negStartIndex; idet >= negStartIndex - half; idet--) {
244 if (!
Adder::add(neighborDet, tsos, prop, est, result))
249 const GeomDet& neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
250 Adder::add(neighborBrotherDet, tsos, prop, est, brotherresult);
253 for (
int idet = posStartIndex; idet < posStartIndex + half; idet++) {
257 if (!
Adder::add(neighborDet, tsos, prop, est, result))
262 const GeomDet& neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
263 Adder::add(neighborBrotherDet, tsos, prop, est, brotherresult);
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
Returns basic components, if any.
GeometricSearchDet::DetWithState DetWithState
std::vector< const GeomDet * > theDets
std::vector< const GeomDet * > theFrontDets
int closestDetIndex() const
std::vector< const GeomDet * > theFrontDetBrothers
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
GlobalPoint globalPosition() const
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const override
std::vector< const GeomDet * > theBackDets
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)
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
virtual PropagationDirection propagationDirection() const final
int subLayerIndex() const
ReferenceCountingPointer< BoundDisk > theFrontDisk
BinFinderType theFrontBinFinder
Abs< T >::type abs(const T &t)
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
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
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 * >())