17 #include <boost/function.hpp>
18 #include <boost/bind.hpp>
40 std::vector<float> & boundaries) {
41 boundaries.resize(dets.size());
42 std::transform(dets.begin(), dets.end(), boundaries.begin(),
45 std::adjacent_difference(boundaries.begin(),boundaries.end(), boundaries.begin(),
Mean());
48 int findBin(std::vector<float>
const & boundaries,
float r) {
50 std::lower_bound(boundaries.begin()+1,boundaries.end(),
r)
51 -boundaries.begin()-1;
58 vector<const TECWedge*>& outerWedges) :
59 theFrontComps(innerWedges.
begin(),innerWedges.
end()),
60 theBackComps(outerWedges.
begin(),outerWedges.
end())
69 for(vector<const GeometricSearchDet*>::const_iterator it=
theComps.begin();
72 (**it).basicComponents().begin(),
73 (**it).basicComponents().end());
81 vector<const TECWedge*> allWedges;
82 allWedges.assign(innerWedges.begin(),innerWedges.end());
83 allWedges.insert(allWedges.end(),outerWedges.begin(),outerWedges.end());
90 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for CompositeTECPetal" ;
92 for(vector<const GeometricSearchDet*>::const_iterator it=
theFrontComps.begin();
94 LogDebug(
"TkDetLayers") <<
"frontWedge phi,z,r: "
95 << (*it)->surface().position().phi() <<
" , "
96 << (*it)->surface().position().z() <<
" , "
97 << (*it)->surface().position().perp() ;
100 for(vector<const GeometricSearchDet*>::const_iterator it=
theBackComps.begin();
102 LogDebug(
"TkDetLayers") <<
"backWedge phi,z,r: "
103 << (*it)->surface().position().phi() <<
" , "
104 << (*it)->surface().position().z() <<
" , "
105 << (*it)->surface().position().perp() ;
114 vector<const GeometricSearchDet*>::const_iterator
i;
121 pair<bool, TrajectoryStateOnSurface>
124 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of CompositeTECPetal::compatible()!!" ;
125 return pair<bool,TrajectoryStateOnSurface>();
133 std::vector<DetGroup> &
result)
const {
135 vector<DetGroup> closestResult;
138 if(! crossings.
isValid())
return;
141 LogDebug(
"TkDetLayers") <<
"in TECPetal, closestResult.size(): "<< closestResult.size();
143 if (closestResult.empty()){
144 vector<DetGroup> nextResult;
146 LogDebug(
"TkDetLayers") <<
"in TECPetal, nextResult.size(): "<< nextResult.size() ;
147 if(nextResult.empty())
return;
159 closestResult,
false);
161 vector<DetGroup> nextResult;
180 pair<bool,double> frontPath = crossing.pathLength( *
theFrontSector);
184 GlobalPoint gFrontPoint(crossing.position(frontPath.second));
186 <<
"in TECPetal,front crossing : r,z,phi: ("
187 << gFrontPoint.perp() <<
","
188 << gFrontPoint.z() <<
","
189 << gFrontPoint.phi() <<
")";
192 int frontIndex =
findBin(gFrontPoint.perp(),0);
193 float frontDist = fabs(
findPosition(frontIndex,0).
perp() - gFrontPoint.perp());
198 pair<bool,double> backPath = crossing.pathLength( *
theBackSector);
203 GlobalPoint gBackPoint( crossing.position(backPath.second));
205 <<
"in TECPetal,back crossing r,z,phi: ("
206 << gBackPoint.perp() <<
","
207 << gBackPoint.z() <<
","
208 << gBackPoint.phi() <<
")" ;
210 int backIndex =
findBin(gBackPoint.perp(),1);
211 float backDist = fabs(
findPosition(backIndex,1).
perp() - gBackPoint.perp());
217 if (frontDist < backDist) {
229 vector<DetGroup>&
result)
const
235 <<
"in TECPetal, adding Wedge at r,z,phi: ("
236 << det->position().perp() <<
","
237 << det->position().z() <<
","
238 << det->position().phi() <<
")" ;
240 <<
"wedge comps size: "
241 << det->basicComponents().size();
255 bool checkClosest)
const
262 int negStartIndex = closestIndex-1;
263 int posStartIndex = closestIndex+1;
266 if ( gCrossingPos.
perp() < sLayer[closestIndex]->position().perp() ) {
267 posStartIndex = closestIndex;
270 negStartIndex = closestIndex;
279 for (
int idet=negStartIndex; idet >= 0; idet--) {
282 if (!
overlap( gCrossingPos, neighborWedge, window))
break;
283 if (!
Adder::add( neighborWedge, tsos, prop, est, result))
break;
286 for (
int idet=posStartIndex; idet <theSize; idet++) {
289 if (!
overlap( gCrossingPos, neighborWedge, window))
break;
290 if (!
Adder::add( neighborWedge, tsos, prop, est, result))
break;
302 float tsRadius = gpos.
perp();
303 float thetamin = (
max((
float)0.,tsRadius-ymax))/(fabs(gpos.
z())+10.);
304 float thetamax = ( tsRadius + ymax)/(fabs(gpos.
z())-10.);
309 float thetaWedgeMin = wedgeSector.
innerRadius()/ wedgeMaxZ;
310 float thetaWedgeMax = wedgeSector.
outerRadius()/ wedgeMinZ;
314 return !( thetamin > thetaWedgeMax || thetaWedgeMin > thetamax);
341 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
T perp() const
Magnitude of transverse component.
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
float operator()(const GeometricSearchDet *a, const GeometricSearchDet *b) 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
void fillBoundaries(std::vector< const GeometricSearchDet * > const &dets, std::vector< float > &boundaries)
std::vector< const GeometricSearchDet * > theBackComps
int findBin(std::vector< float > const &boundaries, float r)
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
GlobalVector globalMomentum() const
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
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
const PositionType & position() const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
std::vector< float > theBackBoundaries
float operator()(float a, float b) const
double transverseCurvature() const