18 #include <boost/function.hpp>
34 CompositeTECWedge::CompositeTECWedge(vector<const GeomDet*>& innerDets,
35 vector<const GeomDet*>& outerDets):
36 theFrontDets(innerDets.
begin(),innerDets.
end()), theBackDets(outerDets.
begin(),outerDets.
end())
38 theDets.assign(theFrontDets.begin(),theFrontDets.end());
39 theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());
51 LogDebug(
"TkDetLayers") <<
"DEBUG INFO for CompositeTECWedge" <<
"\n"
52 <<
"TECWedge z, perp,innerRadius,outerR: "
55 << theDiskSector->innerRadius() <<
" , "
56 << theDiskSector->outerRadius() ;
59 for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin();
60 it!=theFrontDets.end(); it++){
61 LogDebug(
"TkDetLayers") <<
"frontDet phi,z,r: "
62 << (*it)->surface().position().phi() <<
" , "
63 << (*it)->surface().position().z() <<
" , "
64 << (*it)->surface().position().perp();
67 for(vector<const GeomDet*>::const_iterator it=theBackDets.begin();
68 it!=theBackDets.end(); it++){
69 LogDebug(
"TkDetLayers") <<
"backDet phi,z,r: "
70 << (*it)->surface().phi() <<
" , "
71 << (*it)->surface().position().z() <<
" , "
72 << (*it)->surface().position().perp() ;
79 CompositeTECWedge::~CompositeTECWedge(){
84 const vector<const GeometricSearchDet*>&
86 throw DetLayerException(
"CompositeTECWedge doesn't have GeometricSearchDet components");
90 pair<bool, TrajectoryStateOnSurface>
93 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of CompositeTECWedge::compatible()!!" ;
94 return pair<bool,TrajectoryStateOnSurface>();
102 std::vector<DetGroup> &
result)
const{
105 if(! crossings.
isValid())
return;
107 std::vector<DetGroup> closestResult;
108 addClosest( tsos, prop, est, crossings.
closest(), closestResult);
110 <<
"in CompositeTECWedge::groupedCompatibleDets,closestResult.size(): "
111 << closestResult.size() ;
113 if (closestResult.empty())
return;
118 searchNeighbors( tsos, prop, est, crossings.
closest(),
window,
119 closestResult,
false);
121 vector<DetGroup> nextResult;
122 searchNeighbors( tsos, prop, est, crossings.
other(),
window,
146 pair<bool,double> frontPath = crossing.pathLength( *theFrontSector);
149 GlobalPoint gFrontPoint( crossing.position(frontPath.second));
150 LogDebug(
"TkDetLayers") <<
"in TECWedge,front crossing r,z,phi: ("
151 << gFrontPoint.perp() <<
","
152 << gFrontPoint.z() <<
","
153 << gFrontPoint.phi() <<
")" ;
156 int frontIndex = findClosestDet(gFrontPoint,0);
159 pair<bool,double> backPath = crossing.pathLength( *theBackSector);
162 GlobalPoint gBackPoint( crossing.position(backPath.second));
164 <<
"in TECWedge,back crossing r,z,phi: ("
165 << gBackPoint.perp() <<
","
166 << gBackPoint.z() <<
","
167 << gBackPoint.phi() <<
")" << endl;
169 int backIndex = findClosestDet(gBackPoint,1);
173 double(theFrontDets[frontIndex]->surface().phi())));
180 double(theBackDets[backIndex]->surface().phi())));
187 if (frontDist < backDist) {
200 vector<DetGroup>& result)
const
202 const vector<const GeomDet*>& sWedge( subWedge( crossing.
subLayerIndex()));
205 <<
"in CompositeTECWedge,adding GeomDet at r,z,phi: ("
220 vector<DetGroup>& result,
221 bool checkClosest)
const
225 const vector<const GeomDet*>& sWedge( subWedge( crossing.
subLayerIndex()));
228 int negStartIndex = closestIndex-1;
229 int posStartIndex = closestIndex+1;
233 posStartIndex = closestIndex;
236 negStartIndex = closestIndex;
241 for (
int idet=negStartIndex; idet >= 0; idet--) {
244 if (!
Adder::add( *sWedge[idet], tsos, prop, est, result))
break;
246 for (
int idet=posStartIndex; idet < static_cast<int>(sWedge.size()); idet++) {
249 if (!
Adder::add( *sWedge[idet], tsos, prop, est, result))
break;
256 CompositeTECWedge::findClosestDet(
const GlobalPoint& startPos,
int sectorId)
const
258 vector<const GeomDet*> myDets = sectorId==0 ? theFrontDets : theBackDets;
261 float closeDist = fabs( (myDets.front()->toLocal(startPos)).
x());
262 for (
unsigned int i = 0;
i < myDets.size();
i++ ) {
263 float dist = (myDets[
i]->surface().toLocal(startPos)).
x();
264 if ( fabs(dist) < fabs(closeDist) ) {
static void orderAndMergeTwoLevels(const std::vector< DetGroup > &one, const std::vector< DetGroup > &two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
virtual PropagationDirection propagationDirection() const
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)
bool operator()(const GeomDet *a, const GeomDet *b)
static int position[TOTALCHAMBERS][3]
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)
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
const BoundPlane & surface() const
The nominal surface of the GeomDet.
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
double transverseCurvature() const