18 #include <boost/function.hpp>
36 CompositeTECWedge::CompositeTECWedge(vector<const GeomDet*>& innerDets,
37 vector<const GeomDet*>& outerDets):
38 theFrontDets(innerDets.
begin(),innerDets.
end()), theBackDets(outerDets.
begin(),outerDets.
end())
40 theDets.assign(theFrontDets.begin(),theFrontDets.end());
41 theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());
45 std::sort( theFrontDets.begin(), theFrontDets.end(), DetPhiLess() );
46 std::sort( theBackDets.begin(), theBackDets.end(), DetPhiLess() );
53 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for CompositeTECWedge" <<
"\n"
54 <<
"TECWedge z, perp,innerRadius,outerR: "
57 << theDiskSector->innerRadius() <<
" , "
58 << theDiskSector->outerRadius() ;
61 for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin();
62 it!=theFrontDets.end(); it++){
63 LogDebug(
"TkDetLayers") <<
"frontDet phi,z,r: "
64 << (*it)->surface().position().phi() <<
" , "
65 << (*it)->surface().position().z() <<
" , "
66 << (*it)->surface().position().perp();
69 for(vector<const GeomDet*>::const_iterator it=theBackDets.begin();
70 it!=theBackDets.end(); it++){
71 LogDebug(
"TkDetLayers") <<
"backDet phi,z,r: "
72 << (*it)->surface().phi() <<
" , "
73 << (*it)->surface().position().z() <<
" , "
74 << (*it)->surface().position().perp() ;
81 CompositeTECWedge::~CompositeTECWedge(){
86 const vector<const GeometricSearchDet*>&
88 throw DetLayerException(
"CompositeTECWedge doesn't have GeometricSearchDet components");
92 pair<bool, TrajectoryStateOnSurface>
95 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of CompositeTECWedge::compatible()!!" ;
96 return pair<bool,TrajectoryStateOnSurface>();
104 std::vector<DetGroup> &
result)
const{
107 if(! crossings.
isValid())
return;
109 std::vector<DetGroup> closestResult;
110 addClosest( tsos, prop, est, crossings.
closest(), closestResult);
112 <<
"in CompositeTECWedge::groupedCompatibleDets,closestResult.size(): "
113 << closestResult.size() ;
115 if (closestResult.empty())
return;
120 searchNeighbors( tsos, prop, est, crossings.
closest(),
window,
121 closestResult,
false);
123 vector<DetGroup> nextResult;
124 searchNeighbors( tsos, prop, est, crossings.
other(),
window,
146 HelixForwardPlaneCrossing crossing( startPos, startDir,
rho, propDir);
148 pair<bool,double> frontPath = crossing.pathLength( *theFrontSector);
151 GlobalPoint gFrontPoint( crossing.position(frontPath.second));
152 LogDebug(
"TkDetLayers") <<
"in TECWedge,front crossing r,z,phi: ("
153 << gFrontPoint.perp() <<
","
154 << gFrontPoint.z() <<
","
155 << gFrontPoint.phi() <<
")" ;
158 int frontIndex = findClosestDet(gFrontPoint,0);
161 pair<bool,double> backPath = crossing.pathLength( *theBackSector);
164 GlobalPoint gBackPoint( crossing.position(backPath.second));
166 <<
"in TECWedge,back crossing r,z,phi: ("
167 << gBackPoint.perp() <<
","
168 << gBackPoint.z() <<
","
169 << gBackPoint.phi() <<
")" << endl;
171 int backIndex = findClosestDet(gBackPoint,1);
175 double(theFrontDets[frontIndex]->surface().phi())));
182 double(theBackDets[backIndex]->surface().phi())));
189 if (frontDist < backDist) {
202 vector<DetGroup>& result)
const
204 const vector<const GeomDet*>& sWedge( subWedge( crossing.
subLayerIndex()));
207 <<
"in CompositeTECWedge,adding GeomDet at r,z,phi: ("
222 vector<DetGroup>& result,
223 bool checkClosest)
const
227 const vector<const GeomDet*>& sWedge( subWedge( crossing.
subLayerIndex()));
230 int negStartIndex = closestIndex-1;
231 int posStartIndex = closestIndex+1;
235 posStartIndex = closestIndex;
238 negStartIndex = closestIndex;
243 for (
int idet=negStartIndex; idet >= 0; idet--) {
246 if (!
Adder::add( *sWedge[idet], tsos, prop, est, result))
break;
248 for (
int idet=posStartIndex; idet < static_cast<int>(sWedge.size()); idet++) {
251 if (!
Adder::add( *sWedge[idet], tsos, prop, est, result))
break;
258 CompositeTECWedge::findClosestDet(
const GlobalPoint& startPos,
int sectorId)
const
260 vector<const GeomDet*>
const & myDets = sectorId==0 ? theFrontDets : theBackDets;
263 float closeDist = fabs( (myDets.front()->toLocal(startPos)).
x());
264 for (
unsigned int i = 0;
i < myDets.size();
i++ ) {
265 float dist = (myDets[
i]->surface().toLocal(startPos)).
x();
266 if ( fabs(dist) < fabs(closeDist) ) {
int closestDetIndex() const
double deltaPhi(float phi1, float phi2)
GlobalPoint globalPosition() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
const Plane & surface() const
The nominal surface of the GeomDet.
static int position[TOTALCHAMBERS][3]
virtual PropagationDirection propagationDirection() const GCC11_FINAL
const GlobalPoint & position() const
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
int subLayerIndex() const
bool overlapInPhi(const GlobalPoint &crossPoint, const GeomDet &det, float phiWindow)
Abs< T >::type abs(const T &t)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
bool phiLess(float phi1, float phi2)
const SubLayerCrossing & other() const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result)
const SubLayerCrossing & closest() const
GlobalVector globalMomentum() const
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