20 class DetGroupElementPerpLess {
24 return (a.front().det()->position().perp() < b.front().det()->position().perp());
31 vector<const GeomDet*>& outerDets,
32 vector<const GeomDet*>& innerDetBrothers,
33 vector<const GeomDet*>& outerDetBrothers):
35 theInnerDets(innerDets),theOuterDets(outerDets),theInnerDetBrothers(innerDetBrothers),theOuterDetBrothers(outerDetBrothers)
56 LogDebug(
"TkDetLayers") <<
"==== DEBUG Phase2OTBarrelRod =====" ;
57 for (vector<const GeomDet*>::const_iterator
i=
theInnerDets.begin();
59 LogDebug(
"TkDetLayers") <<
"inner Phase2OTBarrelRod's Det pos z,perp,eta,phi: " 60 << (**i).position().z() <<
" , " 61 << (**i).position().perp() <<
" , " 62 << (**i).position().eta() <<
" , " 63 << (**i).position().phi() ;
68 LogDebug(
"TkDetLayers") <<
"inner Phase2OTBarrelRod's Det Brother pos z,perp,eta,phi: " 69 << (**i).position().z() <<
" , " 70 << (**i).position().perp() <<
" , " 71 << (**i).position().eta() <<
" , " 72 << (**i).position().phi() ;
75 for (vector<const GeomDet*>::const_iterator
i=
theOuterDets.begin();
77 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det pos z,perp,eta,phi: " 78 << (**i).position().z() <<
" , " 79 << (**i).position().perp() <<
" , " 80 << (**i).position().eta() <<
" , " 81 << (**i).position().phi() ;
86 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det Brother pos z,perp,eta,phi: " 87 << (**i).position().z() <<
" , " 88 << (**i).position().perp() <<
" , " 89 << (**i).position().eta() <<
" , " 90 << (**i).position().phi() ;
92 LogDebug(
"TkDetLayers") <<
"==== end DEBUG Phase2OTBarrelRod =====" ;
103 const vector<const GeometricSearchDet*>&
105 throw DetLayerException(
"Phase2OTBarrelRod doesn't have GeometricSearchDet components");
108 pair<bool, TrajectoryStateOnSurface>
111 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2OTBarrelRod::compatible()!!" ;
112 return pair<bool,TrajectoryStateOnSurface>();
123 std::vector<DetGroup> &
result)
const{
127 if(! crossings.
isValid())
return;
129 std::vector<DetGroup> closestResult;
130 std::vector<DetGroup> closestBrotherResult;
131 addClosest( tsos, prop, est, crossings.
closest(), closestResult, closestBrotherResult);
132 if (closestResult.empty()){
133 std::vector<DetGroup> nextResult;
134 std::vector<DetGroup> nextBrotherResult;
135 addClosest( tsos, prop, est, crossings.
other(), nextResult, nextBrotherResult);
136 if(nextResult.empty())
return;
140 std::vector<DetGroup> closestCompleteResult;
143 std::vector<DetGroup> nextCompleteResult;
156 closestResult, closestBrotherResult,
false);
158 std::vector<DetGroup> closestCompleteResult;
162 std::vector<DetGroup> nextResult;
163 std::vector<DetGroup> nextBrotherResult;
165 nextResult, nextBrotherResult,
true);
167 std::vector<DetGroup> nextCompleteResult;
176 sort(result.begin(),result.end(),DetGroupElementPerpLess());
177 for (
auto& grp : result) {
178 if ( grp.empty() )
continue;
179 LogTrace(
"TkDetLayers") <<
"New group in Phase2OTBarrelRod made by : ";
180 for (
auto const & det : grp) {
181 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp() <<
" id:" << det.det()->geographicalId().rawId()
182 <<
" tsos at:" << det.trajectoryState().globalPosition();
200 std::pair<bool,double> outerPath = crossing.pathLength( *
theOuterPlane);
202 GlobalPoint gOuterPoint( crossing.position(outerPath.second));
204 std::pair<bool,double> innerPath = crossing.pathLength( *
theInnerPlane);
206 GlobalPoint gInnerPoint( crossing.position(innerPath.second));
217 if (innerDist < outerDist) {
234 vector<DetGroup>& brotherresult)
const 243 tsos, prop, est, brotherresult);
245 return firstgroup || brothergroup;
276 float localY = localCrossPoint.
y();
282 return (
std::abs(localY)-window) < relativeMargin*detHalfLength;
295 vector<DetGroup>& brotherresult,
296 bool checkClosest)
const 304 int negStartIndex = closestIndex-1;
305 int posStartIndex = closestIndex+1;
308 if (gCrossingPos.
z() < sRod[closestIndex]->surface().position().z()) {
309 posStartIndex = closestIndex;
312 negStartIndex = closestIndex;
317 for (
int idet=negStartIndex; idet >= 0; idet--) {
318 if (!
overlap( gCrossingPos, *sRod[idet], window))
break;
319 if (!
Adder::add( *sRod[idet], tsos, prop, est, result))
break;
321 Adder::add( *sBrotherRod[idet], tsos, prop, est, brotherresult);
323 for (
int idet=posStartIndex; idet < static_cast<int>(sRod.size()); idet++) {
324 if (!
overlap( gCrossingPos, *sRod[idet], window))
break;
325 if (!
Adder::add( *sRod[idet], tsos, prop, est, result))
break;
327 Adder::add( *sBrotherRod[idet], tsos, prop, est, brotherresult);
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
virtual float length() const =0
Phase2OTBarrelRod(std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets, std::vector< const GeomDet * > &innerDetBrothers, std::vector< const GeomDet * > &outerDetBrothers) __attribute__((cold))
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const override __attribute__((cold))
int closestDetIndex() const
BinFinderType theOuterBinFinder
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
Returns basic components, if any.
GlobalPoint globalPosition() const
const Bounds & bounds() const
const Plane & surface() const
The nominal surface of the GeomDet.
T binPosition(int ind) const override
the middle of the bin.
std::vector< const GeomDet * > theDets
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
const GlobalPoint & position() const
GeometricSearchDet::DetWithState DetWithState
virtual PropagationDirection propagationDirection() const final
BinFinderType theInnerBinFinder
LocalPoint toLocal(const GlobalPoint &gp) const
int subLayerIndex() const
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)
int binIndex(T z) const override
returns an index in the valid range for the bin closest to Z
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))
GenericBinFinderInZ< float, GeomDet > BinFinderType
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))
const std::vector< const GeomDet * > & subRodBrothers(int ind) const
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
ReferenceCountingPointer< Plane > theOuterPlane
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
void setPlane(Plane *plane)
Set the rod's plane.
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
const SubLayerCrossing & closest() const
GlobalVector globalMomentum() const
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
ReferenceCountingPointer< Plane > theInnerPlane
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)
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))
~Phase2OTBarrelRod() override __attribute__((cold))
const std::vector< const GeomDet * > & subRod(int ind) const
std::vector< const GeomDet * > theOuterDets
std::vector< const GeomDet * > theInnerDets
std::vector< const GeomDet * > theInnerDetBrothers
double transverseCurvature() const