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);
113 <<
"in CompositeTECWedge::groupedCompatibleDets,closestResult.size(): "
114 << closestResult.size() ;
116 if (closestResult.empty())
return;
121 searchNeighbors( tsos, prop, est, crossings.
closest(),
window,
122 closestResult,
false);
124 std::vector<DetGroup> nextResult;
125 searchNeighbors( tsos, prop, est, crossings.
other(),
window,
148 HelixForwardPlaneCrossing crossing( startPos, startDir, rho, propDir);
150 pair<bool,double> frontPath = crossing.pathLength( *theFrontSector);
153 pair<bool,double> backPath = crossing.pathLength( *theBackSector);
156 GlobalPoint gFrontPoint( crossing.position(frontPath.second));
157 GlobalPoint gBackPoint( crossing.position(backPath.second));
161 <<
"in TECWedge,front crossing r,z,phi: ("
162 << gFrontPoint.perp() <<
","
163 << gFrontPoint.z() <<
","
164 << gFrontPoint.phi() <<
")" ;
167 <<
"in TECWedge,back crossing r,z,phi: ("
168 << gBackPoint.perp() <<
","
169 << gBackPoint.z() <<
","
170 << gBackPoint.phi() <<
")" << endl;
173 int frontIndex = findClosestDet(gFrontPoint,0);
176 int backIndex = findClosestDet(gBackPoint,1);
181 theFrontDets[frontIndex]->surface().phi()));
188 theBackDets[backIndex]->surface().phi()) );
195 if (frontDist < backDist) {
208 vector<DetGroup>& result)
const
210 const vector<const GeomDet*>& sWedge( subWedge( crossing.
subLayerIndex()));
213 <<
"in CompositeTECWedge,adding GeomDet at r,z,phi: ("
228 vector<DetGroup>& result,
229 bool checkClosest)
const
233 const vector<const GeomDet*>& sWedge( subWedge( crossing.
subLayerIndex()));
236 int negStartIndex = closestIndex-1;
237 int posStartIndex = closestIndex+1;
241 posStartIndex = closestIndex;
244 negStartIndex = closestIndex;
249 for (
int idet=negStartIndex; idet >= 0; idet--) {
252 if (!
Adder::add( *sWedge[idet], tsos, prop, est, result))
break;
254 for (
int idet=posStartIndex; idet < static_cast<int>(sWedge.size()); idet++) {
257 if (!
Adder::add( *sWedge[idet], tsos, prop, est, result))
break;
264 CompositeTECWedge::findClosestDet(
const GlobalPoint& startPos,
int sectorId)
const
266 vector<const GeomDet*>
const & myDets = sectorId==0 ? theFrontDets : theBackDets;
269 auto closeDist =
std::abs( (myDets.front()->toLocal(startPos)).
x());
270 for (
unsigned int i = 1;
i < myDets.size();
i++ ) {
272 if ( dist < closeDist ) {
int closestDetIndex() const
GlobalPoint globalPosition() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
bool overlapInPhi(float phi, const GeomDet &det, float phiWindow)
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 subLayerIndex() const
Abs< T >::type abs(const T &t)
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
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) __attribute__((hot))
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