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)
55 LogDebug(
"TkDetLayers") <<
"==== DEBUG Phase2OTBarrelRod =====" ;
56 for (vector<const GeomDet*>::const_iterator
i=
theInnerDets.begin();
58 LogDebug(
"TkDetLayers") <<
"inner Phase2OTBarrelRod's Det pos z,perp,eta,phi: "
59 << (**i).position().z() <<
" , "
60 << (**i).position().perp() <<
" , "
61 << (**i).position().eta() <<
" , "
62 << (**i).position().phi() ;
67 LogDebug(
"TkDetLayers") <<
"inner Phase2OTBarrelRod's Det Brother pos z,perp,eta,phi: "
68 << (**i).position().z() <<
" , "
69 << (**i).position().perp() <<
" , "
70 << (**i).position().eta() <<
" , "
71 << (**i).position().phi() ;
74 for (vector<const GeomDet*>::const_iterator
i=
theOuterDets.begin();
76 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det pos z,perp,eta,phi: "
77 << (**i).position().z() <<
" , "
78 << (**i).position().perp() <<
" , "
79 << (**i).position().eta() <<
" , "
80 << (**i).position().phi() ;
85 LogDebug(
"TkDetLayers") <<
"outer Phase2OTBarrelRod's Det Brother pos z,perp,eta,phi: "
86 << (**i).position().z() <<
" , "
87 << (**i).position().perp() <<
" , "
88 << (**i).position().eta() <<
" , "
89 << (**i).position().phi() ;
91 LogDebug(
"TkDetLayers") <<
"==== end DEBUG Phase2OTBarrelRod =====" ;
102 const vector<const GeometricSearchDet*>&
104 throw DetLayerException(
"Phase2OTBarrelRod doesn't have GeometricSearchDet components");
107 pair<bool, TrajectoryStateOnSurface>
110 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of Phase2OTBarrelRod::compatible()!!" ;
111 return pair<bool,TrajectoryStateOnSurface>();
122 std::vector<DetGroup> &
result)
const{
126 if(! crossings.
isValid())
return;
128 std::vector<DetGroup> closestResult;
129 std::vector<DetGroup> closestBrotherResult;
130 addClosest( tsos, prop, est, crossings.
closest(), closestResult, closestBrotherResult);
131 if (closestResult.empty()){
132 std::vector<DetGroup> nextResult;
133 std::vector<DetGroup> nextBrotherResult;
134 addClosest( tsos, prop, est, crossings.
other(), nextResult, nextBrotherResult);
135 if(nextResult.empty())
return;
139 std::vector<DetGroup> closestCompleteResult;
142 std::vector<DetGroup> nextCompleteResult;
155 closestResult, closestBrotherResult,
false);
157 std::vector<DetGroup> closestCompleteResult;
161 std::vector<DetGroup> nextResult;
162 std::vector<DetGroup> nextBrotherResult;
164 nextResult, nextBrotherResult,
true);
166 std::vector<DetGroup> nextCompleteResult;
175 sort(result.begin(),result.end(),DetGroupElementPerpLess());
176 for (
auto& grp : result) {
177 if ( grp.empty() )
continue;
178 LogTrace(
"TkDetLayers") <<
"New group in Phase2OTBarrelLayer made by : ";
179 for (
auto const & det : grp) {
180 LogTrace(
"TkDetLayers") <<
" geom det at r: " << det.det()->position().perp() <<
" id:" << det.det()->geographicalId().rawId()
181 <<
" tsos at:" << det.trajectoryState().globalPosition();
199 std::pair<bool,double> outerPath = crossing.pathLength( *
theOuterPlane);
201 GlobalPoint gOuterPoint( crossing.position(outerPath.second));
203 std::pair<bool,double> innerPath = crossing.pathLength( *
theInnerPlane);
205 GlobalPoint gInnerPoint( crossing.position(innerPath.second));
216 if (innerDist < outerDist) {
233 vector<DetGroup>& brotherresult)
const
242 tsos, prop, est, brotherresult);
244 return firstgroup || brothergroup;
275 float localY = localCrossPoint.
y();
281 return (
std::abs(localY)-window) < relativeMargin*detHalfLength;
294 vector<DetGroup>& brotherresult,
295 bool checkClosest)
const
303 int negStartIndex = closestIndex-1;
304 int posStartIndex = closestIndex+1;
307 if (gCrossingPos.
z() < sRod[closestIndex]->surface().position().z()) {
308 posStartIndex = closestIndex;
311 negStartIndex = closestIndex;
316 for (
int idet=negStartIndex; idet >= 0; idet--) {
317 if (!
overlap( gCrossingPos, *sRod[idet], window))
break;
318 if (!
Adder::add( *sRod[idet], tsos, prop, est, result))
break;
320 Adder::add( *sBrotherRod[idet], tsos, prop, est, brotherresult);
322 for (
int idet=posStartIndex; idet < static_cast<int>(sRod.size()); idet++) {
323 if (!
overlap( gCrossingPos, *sRod[idet], window))
break;
324 if (!
Adder::add( *sRod[idet], tsos, prop, est, result))
break;
326 Adder::add( *sBrotherRod[idet], tsos, prop, est, brotherresult);
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
virtual float length() const =0
int closestDetIndex() const
BinFinderType theOuterBinFinder
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
~Phase2OTBarrelRod() __attribute__((cold))
GlobalPoint globalPosition() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
const Bounds & bounds() const
virtual PropagationDirection propagationDirection() const final
const Plane & surface() const
The nominal surface of the GeomDet.
virtual T binPosition(int ind) const
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
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
BinFinderType theInnerBinFinder
LocalPoint toLocal(const GlobalPoint &gp) const
int subLayerIndex() const
Abs< T >::type abs(const T &t)
std::vector< const GeomDet * > theOuterDetBrothers
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const __attribute__((cold))
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
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
virtual const std::vector< const GeometricSearchDet * > & components() const __attribute__((cold))
Returns basic components, if any.
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
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
ReferenceCountingPointer< Plane > theInnerPlane
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
virtual int binIndex(T z) const
returns an index in the valid range for the bin closest to Z
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))
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