18 #include <boost/function.hpp> 28 return (fabs(a.front().det()->position().z()) < fabs(b.front().det()->position().z()));
33 vector<const GeomDet*>& outerDets,
34 const vector<const GeomDet*>& innerDetBrothers,
35 const vector<const GeomDet*>& outerDetBrothers):
37 theFrontDets(innerDets.
begin(),innerDets.
end()),
38 theBackDets(outerDets.
begin(),outerDets.
end()),
39 theFrontDetBrothers(innerDetBrothers.
begin(),innerDetBrothers.
end()),
40 theBackDetBrothers(outerDetBrothers.
begin(),outerDetBrothers.
end())
64 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for Phase2EndcapRing" ;
65 for(vector<const GeomDet*>::const_iterator it=
theFrontDets.begin();
67 LogDebug(
"TkDetLayers") <<
"frontDet detId,phi,z,r: " 68 << (*it)->geographicalId().rawId() <<
" , " 69 << (*it)->surface().position().phi() <<
" , " 70 << (*it)->surface().position().z() <<
" , " 71 << (*it)->surface().position().perp() ;
77 LogDebug(
"TkDetLayers") <<
"frontDet brothers detId,phi,z,r: " 78 << (*it)->geographicalId().rawId() <<
" , " 79 << (*it)->surface().position().phi() <<
" , " 80 << (*it)->surface().position().z() <<
" , " 81 << (*it)->surface().position().perp() ;
85 for(vector<const GeomDet*>::const_iterator it=
theBackDets.begin();
87 LogDebug(
"TkDetLayers") <<
"backDet detId,phi,z,r: " 88 << (*it)->geographicalId().rawId() <<
" , " 89 << (*it)->surface().position().phi() <<
" , " 90 << (*it)->surface().position().z() <<
" , " 91 << (*it)->surface().position().perp() ;
97 LogDebug(
"TkDetLayers") <<
"backDet brothers detId,phi,z,r: " 98 << (*it)->geographicalId().rawId() <<
" , " 99 << (*it)->surface().position().phi() <<
" , " 100 << (*it)->surface().position().z() <<
" , " 101 << (*it)->surface().position().perp() ;
112 const vector<const GeometricSearchDet*>&
115 throw DetLayerException(
"Phase2EndcapRing doesn't have GeometricSearchDet components");
119 pair<bool, TrajectoryStateOnSurface>
122 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2EndcapRing::compatible()!!" ;
123 return pair<bool,TrajectoryStateOnSurface>();
132 std::vector<DetGroup>&
result)
const 136 if(! crossings.
isValid())
return;
139 std::vector<DetGroup> closestResult;
140 std::vector<DetGroup> closestBrotherResult;
141 addClosest( tsos, prop, est, crossings.
closest(), closestResult,closestBrotherResult);
142 if (closestResult.empty())
return;
148 closestResult, closestBrotherResult,
false);
150 vector<DetGroup> closestCompleteResult;
154 vector<DetGroup> nextResult;
155 vector<DetGroup> nextBrotherResult;
157 nextResult, nextBrotherResult,
true);
159 vector<DetGroup> nextCompleteResult;
171 LogTrace(
"TkDetLayers") <<
"Number of groups : " << result.size() << std::endl;
172 for (
auto& grp : result) {
173 if ( grp.empty() )
continue;
174 LogTrace(
"TkDetLayers") <<
"New group in Phase2EndcapRing made by : " << std::endl;
175 for (
auto const & det : grp) {
176 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp() <<
" id:" << det.det()->geographicalId().rawId()
177 <<
" tsos at:" << det.trajectoryState().globalPosition() << std::endl;
195 pair<bool,double> frontPath = crossing.pathLength( *
theFrontDisk);
198 pair<bool,double> backPath = crossing.pathLength( *
theBackDisk);
201 GlobalPoint gFrontPoint(crossing.position(frontPath.second));
202 GlobalPoint gBackPoint( crossing.position(backPath.second));
218 if (frontDist < backDist) {
231 vector<DetGroup>& brotherresult)
const 241 return firstgroup || brothergroup;
252 vector<DetGroup>& brotherresult,
253 bool checkClosest)
const 262 int negStartIndex = closestIndex-1;
263 int posStartIndex = closestIndex+1;
267 posStartIndex = closestIndex;
270 negStartIndex = closestIndex;
277 int half = sLayer.size()/2;
278 for (
int idet=negStartIndex; idet >= negStartIndex - half; idet--) {
281 if (!
Adder::add( neighborDet, tsos, prop, est, result))
break;
284 const GeomDet & neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
285 Adder::add( neighborBrotherDet, tsos, prop, est, brotherresult);
288 for (
int idet=posStartIndex; idet < posStartIndex + half; idet++) {
291 if (!
Adder::add( neighborDet, tsos, prop, est, result))
break;
294 const GeomDet & neighborBrotherDet = *sBrotherLayer[binFinder.
binIndex(idet)];
295 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 * >())