17 #include <boost/function.hpp>
18 #include <boost/bind.hpp>
35 float operator()(
float a,
float b)
const {
40 void fillBoundaries(std::vector<const GeometricSearchDet*>
const & dets,
41 std::vector<float> & boundaries) {
42 boundaries.resize(dets.size());
46 std::adjacent_difference(boundaries.begin(),boundaries.end(), boundaries.begin(),
Mean());
49 int findBin(std::vector<float>
const & boundaries,
float r) {
51 std::lower_bound(boundaries.begin()+1,boundaries.end(),
r)
52 -boundaries.begin()-1;
59 vector<const TECWedge*>& outerWedges) :
60 theFrontComps(innerWedges.
begin(),innerWedges.
end()),
61 theBackComps(outerWedges.
begin(),outerWedges.
end())
70 for(vector<const GeometricSearchDet*>::const_iterator it=
theComps.begin();
73 (**it).basicComponents().begin(),
74 (**it).basicComponents().end());
82 vector<const TECWedge*> allWedges;
83 allWedges.assign(innerWedges.begin(),innerWedges.end());
84 allWedges.insert(allWedges.end(),outerWedges.begin(),outerWedges.end());
91 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for CompositeTECPetal" ;
93 for(vector<const GeometricSearchDet*>::const_iterator it=
theFrontComps.begin();
95 LogDebug(
"TkDetLayers") <<
"frontWedge phi,z,r: "
96 << (*it)->surface().position().phi() <<
" , "
97 << (*it)->surface().position().z() <<
" , "
98 << (*it)->surface().position().perp() ;
101 for(vector<const GeometricSearchDet*>::const_iterator it=
theBackComps.begin();
103 LogDebug(
"TkDetLayers") <<
"backWedge phi,z,r: "
104 << (*it)->surface().position().phi() <<
" , "
105 << (*it)->surface().position().z() <<
" , "
106 << (*it)->surface().position().perp() ;
115 vector<const GeometricSearchDet*>::const_iterator
i;
122 pair<bool, TrajectoryStateOnSurface>
125 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of CompositeTECPetal::compatible()!!" ;
126 return pair<bool,TrajectoryStateOnSurface>();
134 std::vector<DetGroup> &
result)
const {
136 vector<DetGroup> closestResult;
139 if(! crossings.
isValid())
return;
142 LogDebug(
"TkDetLayers") <<
"in TECPetal, closestResult.size(): "<< closestResult.size();
144 if (closestResult.empty()){
145 vector<DetGroup> nextResult;
147 LogDebug(
"TkDetLayers") <<
"in TECPetal, nextResult.size(): "<< nextResult.size() ;
148 if(nextResult.empty())
return;
160 closestResult,
false);
162 vector<DetGroup> nextResult;
181 pair<bool,double> frontPath = crossing.pathLength( *
theFrontSector);
185 GlobalPoint gFrontPoint(crossing.position(frontPath.second));
187 <<
"in TECPetal,front crossing : r,z,phi: ("
188 << gFrontPoint.perp() <<
","
189 << gFrontPoint.z() <<
","
190 << gFrontPoint.phi() <<
")";
193 int frontIndex =
findBin(gFrontPoint.perp(),0);
194 float frontDist = fabs(
findPosition(frontIndex,0).
perp() - gFrontPoint.perp());
199 pair<bool,double> backPath = crossing.pathLength( *
theBackSector);
204 GlobalPoint gBackPoint( crossing.position(backPath.second));
206 <<
"in TECPetal,back crossing r,z,phi: ("
207 << gBackPoint.perp() <<
","
208 << gBackPoint.z() <<
","
209 << gBackPoint.phi() <<
")" ;
211 int backIndex =
findBin(gBackPoint.perp(),1);
212 float backDist = fabs(
findPosition(backIndex,1).
perp() - gBackPoint.perp());
218 if (frontDist < backDist) {
230 vector<DetGroup>&
result)
const
236 <<
"in TECPetal, adding Wedge at r,z,phi: ("
237 << det->position().perp() <<
","
238 << det->position().z() <<
","
239 << det->position().phi() <<
")" ;
241 <<
"wedge comps size: "
242 << det->basicComponents().size();
256 bool checkClosest)
const
263 int negStartIndex = closestIndex-1;
264 int posStartIndex = closestIndex+1;
267 if ( gCrossingPos.
perp() < sLayer[closestIndex]->position().perp() ) {
268 posStartIndex = closestIndex;
271 negStartIndex = closestIndex;
280 for (
int idet=negStartIndex; idet >= 0; idet--) {
283 if (!
overlap( gCrossingPos, neighborWedge, window))
break;
284 if (!
Adder::add( neighborWedge, tsos, prop, est, result))
break;
287 for (
int idet=posStartIndex; idet <theSize; idet++) {
290 if (!
overlap( gCrossingPos, neighborWedge, window))
break;
291 if (!
Adder::add( neighborWedge, tsos, prop, est, result))
break;
303 float tsRadius = gpos.
perp();
304 float thetamin = (
max((
float)0.,tsRadius-ymax))/(fabs(gpos.
z())+10.);
305 float thetamax = ( tsRadius + ymax)/(fabs(gpos.
z())-10.);
310 float thetaWedgeMin = wedgeSector.
innerRadius()/ wedgeMaxZ;
311 float thetaWedgeMax = wedgeSector.
outerRadius()/ wedgeMinZ;
315 return !( thetamin > thetaWedgeMax || thetaWedgeMin > thetamax);
342 return (diskSector[index])->position();
std::vector< float > theFrontBoundaries
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
static void orderAndMergeTwoLevels(const std::vector< DetGroup > &one, const std::vector< DetGroup > &two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
int findBin(float R, int layer) const
std::vector< const GeometricSearchDet * > theFrontComps
virtual float thickness() const
float innerRadius() const
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
virtual PropagationDirection propagationDirection() const
int closestDetIndex() const
const std::vector< const GeometricSearchDet * > & subLayer(int ind) const
GlobalPoint globalPosition() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
std::vector< const GeometricSearchDet * > theComps
static bool overlap(const GlobalPoint &gpos, const GeometricSearchDet &rod, float window)
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const
DiskSectorBounds const & bounds() const
const GlobalPoint & position() const
int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
CompositeTECPetal(std::vector< const TECWedge * > &innerWedges, std::vector< const TECWedge * > &outerWedges)
const T & max(const T &a, const T &b)
float outerRadius() const
int subLayerIndex() const
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
std::vector< const GeometricSearchDet * > theBackComps
static float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
const SubLayerCrossing & other() const
ReferenceCountingPointer< BoundDiskSector > theFrontSector
GlobalPoint findPosition(int index, int diskSectorIndex) const
virtual const Surface::PositionType & position() const
Returns position of the surface.
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
ReferenceCountingPointer< BoundDiskSector > theBackSector
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result)
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const
ReferenceCountingPointer< BoundDiskSector > theDiskSector
const SubLayerCrossing & closest() const
T perp() const
Magnitude of transverse component.
GlobalVector globalMomentum() const
const BoundPlane & surface() const
The nominal surface of the GeomDet.
std::vector< const GeomDet * > theBasicComps
virtual void groupedCompatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
const PositionType & position() const
std::vector< float > theBackBoundaries
double transverseCurvature() const