17 #include <boost/function.hpp> 27 return (fabs(a.front().det()->position().z()) < fabs(b.front().det()->position().z()));
32 vector<const GeomDet*>& outerDets,
33 const vector<const GeomDet*>& innerDetBrothers,
34 const vector<const GeomDet*>& outerDetBrothers):
36 theFrontDets(innerDets.
begin(),innerDets.
end()),
37 theBackDets(outerDets.
begin(),outerDets.
end()),
38 theFrontDetBrothers(innerDetBrothers.
begin(),innerDetBrothers.
end()),
39 theBackDetBrothers(outerDetBrothers.
begin(),outerDetBrothers.
end())
63 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for Phase2EndcapRing" ;
64 for(vector<const GeomDet*>::const_iterator it=
theFrontDets.begin();
66 LogDebug(
"TkDetLayers") <<
"frontDet detId,phi,z,r: " 67 << (*it)->geographicalId().rawId() <<
" , " 68 << (*it)->surface().position().phi() <<
" , " 69 << (*it)->surface().position().z() <<
" , " 70 << (*it)->surface().position().perp() ;
76 LogDebug(
"TkDetLayers") <<
"frontDet brothers detId,phi,z,r: " 77 << (*it)->geographicalId().rawId() <<
" , " 78 << (*it)->surface().position().phi() <<
" , " 79 << (*it)->surface().position().z() <<
" , " 80 << (*it)->surface().position().perp() ;
84 for(vector<const GeomDet*>::const_iterator it=
theBackDets.begin();
86 LogDebug(
"TkDetLayers") <<
"backDet detId,phi,z,r: " 87 << (*it)->geographicalId().rawId() <<
" , " 88 << (*it)->surface().position().phi() <<
" , " 89 << (*it)->surface().position().z() <<
" , " 90 << (*it)->surface().position().perp() ;
96 LogDebug(
"TkDetLayers") <<
"backDet brothers detId,phi,z,r: " 97 << (*it)->geographicalId().rawId() <<
" , " 98 << (*it)->surface().position().phi() <<
" , " 99 << (*it)->surface().position().z() <<
" , " 100 << (*it)->surface().position().perp() ;
111 const vector<const GeometricSearchDet*>&
114 throw DetLayerException(
"Phase2EndcapRing doesn't have GeometricSearchDet components");
118 pair<bool, TrajectoryStateOnSurface>
121 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2EndcapRing::compatible()!!" ;
122 return pair<bool,TrajectoryStateOnSurface>();
131 std::vector<DetGroup>&
result)
const 135 if(! crossings.
isValid())
return;
138 std::vector<DetGroup> closestResult;
139 std::vector<DetGroup> closestBrotherResult;
140 addClosest( tsos, prop, est, crossings.
closest(), closestResult,closestBrotherResult);
141 if (closestResult.empty())
return;
147 closestResult, closestBrotherResult,
false);
149 vector<DetGroup> closestCompleteResult;
153 vector<DetGroup> nextResult;
154 vector<DetGroup> nextBrotherResult;
156 nextResult, nextBrotherResult,
true);
158 vector<DetGroup> nextCompleteResult;
170 LogTrace(
"TkDetLayers") <<
"Number of groups : " << result.size() << std::endl;
171 for (
auto& grp : result) {
172 if ( grp.empty() )
continue;
173 LogTrace(
"TkDetLayers") <<
"New group in Phase2EndcapRing made by : " << std::endl;
174 for (
auto const & det : grp) {
175 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp() <<
" id:" << det.det()->geographicalId().rawId()
176 <<
" tsos at:" << det.trajectoryState().globalPosition() << std::endl;
194 pair<bool,double> frontPath = crossing.pathLength( *
theFrontDisk);
197 pair<bool,double> backPath = crossing.pathLength( *
theBackDisk);
200 GlobalPoint gFrontPoint(crossing.position(frontPath.second));
201 GlobalPoint gBackPoint( crossing.position(backPath.second));
217 if (frontDist < backDist) {
230 vector<DetGroup>& brotherresult)
const 240 return firstgroup || brothergroup;
251 vector<DetGroup>& brotherresult,
252 bool checkClosest)
const 261 int negStartIndex = closestIndex-1;
262 int posStartIndex = closestIndex+1;
266 posStartIndex = closestIndex;
269 negStartIndex = closestIndex;
276 int half = sLayer.size()/2;
277 for (
int idet=negStartIndex; idet >= negStartIndex - half; idet--) {
280 if (!
Adder::add( neighborDet, tsos, prop, est, result))
break;
283 const GeomDet & neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
284 Adder::add( neighborBrotherDet, tsos, prop, est, brotherresult);
287 for (
int idet=posStartIndex; idet < posStartIndex + half; idet++) {
290 if (!
Adder::add( neighborDet, tsos, prop, est, result))
break;
293 const GeomDet & neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
294 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
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
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 * >())