20 PixelBarrelLayer::PixelBarrelLayer(vector<const PixelRod*>& innerRods,
21 vector<const PixelRod*>& outerRods) :
22 theInnerComps(innerRods.
begin(),innerRods.
end()),
23 theOuterComps(outerRods.
begin(),outerRods.
end())
25 theComps.assign(theInnerComps.begin(),theInnerComps.end());
26 theComps.insert(theComps.end(),theOuterComps.begin(),theOuterComps.end());
28 for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
29 it!=theComps.end();it++){
30 theBasicComps.insert(theBasicComps.end(),
31 (**it).basicComponents().begin(),
32 (**it).basicComponents().end());
35 theInnerCylinder = cylinder( theInnerComps);
36 theOuterCylinder = cylinder( theOuterComps);
38 theInnerBinFinder = BinFinderType(theInnerComps.front()->position().phi(),
39 theInnerComps.size());
40 theOuterBinFinder = BinFinderType(theOuterComps.front()->position().phi(),
41 theOuterComps.size());
48 LogDebug(
"TkDetLayers") <<
"==== DEBUG PixelBarrelLayer =====" ;
49 LogDebug(
"TkDetLayers") <<
"PixelBarrelLayer innerCyl r,lenght: "
50 << theInnerCylinder->radius() <<
" , "
51 << theInnerCylinder->bounds().length();
53 LogDebug(
"TkDetLayers") <<
"PixelBarrelLayer outerCyl r,lenght: "
54 << theOuterCylinder->radius() <<
" , "
55 << theOuterCylinder->bounds().length();
58 for (vector<const GeometricSearchDet*>::const_iterator
i=theInnerComps.begin();
59 i != theInnerComps.end();
i++){
60 LogDebug(
"TkDetLayers") <<
"inner PixelRod pos z,perp,eta,phi: "
61 << (**i).position().z() <<
" , "
62 << (**i).position().perp() <<
" , "
63 << (**i).position().eta() <<
" , "
64 << (**i).position().phi() ;
67 for (vector<const GeometricSearchDet*>::const_iterator
i=theOuterComps.begin();
68 i != theOuterComps.end();
i++){
69 LogDebug(
"TkDetLayers") <<
"outer PixelRod pos z,perp,eta,phi: "
70 << (**i).position().z() <<
" , "
71 << (**i).position().perp() <<
" , "
72 << (**i).position().eta() <<
" , "
73 << (**i).position().phi() ;
75 LogDebug(
"TkDetLayers") <<
"==== end DEBUG PixelBarrelLayer =====" ;
79 PixelBarrelLayer::~PixelBarrelLayer(){
80 vector<const GeometricSearchDet*>::const_iterator
i;
81 for (i=theComps.begin(); i!=theComps.end(); i++) {
91 std::vector<DetGroup> &
result)
const {
92 vector<DetGroup> closestResult;
95 if(! crossings.
isValid())
return;
97 addClosest( tsos, prop, est, crossings.
closest(), closestResult);
98 if (closestResult.empty()) {
99 addClosest( tsos, prop, est, crossings.
other(),
result);
106 searchNeighbors( tsos, prop, est, crossings.
closest(),
window,
107 closestResult,
false);
109 vector<DetGroup> nextResult;
110 searchNeighbors( tsos, prop, est, crossings.
other(),
window,
129 propDir,*theInnerCylinder);
137 GlobalPoint gInnerPoint( innerCrossing.position());
138 int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.phi());
139 float innerDist = theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.
phi();
143 propDir,*theOuterCylinder);
150 GlobalPoint gOuterPoint( outerCrossing.position());
151 int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.phi());
152 float outerDist = theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.
phi() ;
155 innerDist *=
PhiLess()( theInnerBinFinder.binPosition(innerIndex),gInnerPoint.phi()) ? -1. : 1.;
156 outerDist *=
PhiLess()( theOuterBinFinder.binPosition(outerIndex),gOuterPoint.phi()) ? -1. : 1.;
157 if (innerDist < 0.) { innerDist += 2.*
Geom::pi();}
158 if (outerDist < 0.) { outerDist += 2.*
Geom::pi();}
161 if (innerDist < outerDist) {
173 vector<DetGroup>& result)
const
175 const vector<const GeometricSearchDet*>& sub( subLayer( crossing.
subLayerIndex()));
204 double phiWin =
min(fabs(phiStart-phi1),fabs(phiStart-phi2));
215 vector<DetGroup>& result,
216 bool checkClosest)
const
220 const vector<const GeometricSearchDet*>& sLayer( subLayer( crossing.
subLayerIndex()));
223 int negStartIndex = closestIndex-1;
224 int posStartIndex = closestIndex+1;
227 if (
PhiLess()( gCrossingPos.
phi(), sLayer[closestIndex]->position().
phi())) {
228 posStartIndex = closestIndex;
231 negStartIndex = closestIndex;
235 const BinFinderType& binFinder = (crossing.
subLayerIndex()==0 ? theInnerBinFinder : theOuterBinFinder);
238 int quarter = sLayer.size()/4;
239 for (
int idet=negStartIndex; idet >= negStartIndex - quarter; idet--) {
241 if (!
overlap( gCrossingPos, *neighborRod, window))
break;
242 if (!adder.
add( *neighborRod, tsos, prop, est, result))
break;
245 for (
int idet=posStartIndex; idet < posStartIndex + quarter; idet++) {
247 if (!
overlap( gCrossingPos, *neighborRod, window))
break;
248 if (!adder.
add( *neighborRod, tsos, prop, est, result))
break;
259 const float phiOffset = 0.00034;
264 pair<float,float> phiRange(crossPoint.phi()-phiWin, crossPoint.phi()+phiWin);
271 BoundCylinder* PixelBarrelLayer::cylinder(
const vector<const GeometricSearchDet*>& rods)
const
273 vector<const GeomDet*>
tmp;
274 for (vector<const GeometricSearchDet*>::const_iterator it=rods.begin(); it!=rods.end(); it++) {
275 tmp.insert(tmp.end(),(*it)->basicComponents().begin(),(*it)->basicComponents().end());
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
virtual void initialize()
int closestDetIndex() const
std::pair< float, float > const & phiSpan() const
LocalPoint localPosition() const
Geom::Phi< T > phi() const
GlobalPoint globalPosition() const
const Plane & surface() const
The nominal surface of the GeomDet.
virtual PropagationDirection propagationDirection() const GCC11_FINAL
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
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
bool rangesIntersect(const Range &a, const Range &b)
int subLayerIndex() const
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
const SubLayerCrossing & other() const
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result)
int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
returns 0 if barrel layer crossed from inside, 1 if from outside
std::vector< std::vector< double > > tmp
const SubLayerCrossing & closest() const
GlobalVector globalMomentum() const
static unsigned int const shift
float calculatePhiWindow(const MeasurementEstimator::Local2DVector &maxDistance, const TrajectoryStateOnSurface &ts, const Plane &plane)
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)
double transverseCurvature() const