23 bool operator()(
const pair<vector<DetGroup>
const *,
int> &
a,
const pair<vector<DetGroup>
const *,
int> &
b)
const {
24 if(
a.second==2) {
return true;}
25 else if(
a.second==0) {
26 if(
b.second==2)
return false;
27 if(
b.second==1)
return true;
43 for(vector<const GeometricSearchDet*>::const_iterator it=
theComps.begin();
46 (**it).basicComponents().begin(),
47 (**it).basicComponents().end());
51 LogDebug(
"TkDetLayers") <<
"==== DEBUG TIDLayer =====" ;
52 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: "
64 float theRmin = rings.front()->specificSurface().
innerRadius();
65 float theRmax = rings.front()->specificSurface().outerRadius();
66 float theZmin = rings.front()->position().z() -
67 rings.front()->surface().bounds().thickness()/2;
68 float theZmax = rings.front()->position().z() +
69 rings.front()->surface().bounds().thickness()/2;
71 for (vector<const TIDRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
72 float rmin = (**i).specificSurface().innerRadius();
73 float rmax = (**i).specificSurface().outerRadius();
74 float zmin = (**i).position().z() - (**i).surface().bounds().thickness()/2.;
75 float zmax = (**i).position().z() + (**i).surface().bounds().thickness()/2.;
76 theRmin =
min( theRmin, rmin);
77 theRmax =
max( theRmax, rmax);
78 theZmin =
min( theZmin, zmin);
79 theZmax =
max( theZmax, zmax);
82 float zPos = (theZmax+theZmin)/2.;
87 theZmin-zPos, theZmax-zPos));
93 vector<const GeometricSearchDet*>::const_iterator
i;
106 std::vector<DetGroup> &
result)
const
109 if ( ringIndices.size()!=3 ) {
110 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : ringIndices.size() = "
111 << ringIndices.size() <<
" and not =3!!" ;
115 vector<DetGroup> closestResult;
116 vector<DetGroup> nextResult;
117 vector<DetGroup> nextNextResult;
118 vector<vector<DetGroup> > groupsAtRingLevel;
120 theComps[ringIndices[0]]->groupedCompatibleDetsV( startingState, prop, est, closestResult);
121 if ( closestResult.empty() ){
122 theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, result);
126 groupsAtRingLevel.push_back(closestResult);
129 float rWindow =
computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
130 if(!
overlapInR(closestGel.trajectoryState(),ringIndices[1],rWindow)) {
131 result.swap(closestResult);
136 theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, nextResult);
137 if(nextResult.empty()) {
138 result.swap(closestResult);
141 groupsAtRingLevel.push_back(nextResult);
143 if(!
overlapInR(closestGel.trajectoryState(),ringIndices[2],rWindow) ) {
149 theComps[ringIndices[2]]->groupedCompatibleDetsV( startingState, prop, est, nextNextResult);
150 if(nextNextResult.empty()) {
156 groupsAtRingLevel.push_back(nextNextResult);
177 Crossing myXing( startPos, startDir,
rho, propDir );
182 for (
int i = 0;
i < 3 ;
i++ ) {
184 pair<bool,double> pathlen = myXing.pathLength( theRing);
185 if ( pathlen.first ) {
186 ringCrossings[
i] =
GlobalPoint( myXing.position(pathlen.second ));
198 if ( closestIndex<0 || nextIndex<0 )
return vector<int>();
199 int nextNextIndex = -1;
200 for(
int i=0;
i<3 ;
i++){
201 if(
i!= closestIndex &&
i!=nextIndex) {
208 indices.push_back(closestIndex);
209 indices.push_back(nextIndex);
210 indices.push_back(nextNextIndex);
225 return maxDistance.
y();
229 void mergeOutward(vector< pair<vector<DetGroup>
const *,
int> >
const & groupPlusIndex,
230 std::vector<DetGroup> &
result ) {
232 Merger::orderAndMergeTwoLevels(*groupPlusIndex[0].
first,
233 *groupPlusIndex[1].first,result,1,1);
234 int size = groupPlusIndex.size();
236 std::vector<DetGroup>
tmp;
238 Merger::orderAndMergeTwoLevels(tmp,*groupPlusIndex[2].
first,result,1,1);
243 void mergeInward(vector< pair<vector<DetGroup>
const *,
int> >
const & groupPlusIndex,
244 std::vector<DetGroup> & result ) {
246 int size = groupPlusIndex.size();
249 Merger::orderAndMergeTwoLevels(*groupPlusIndex[1].
first,
250 *groupPlusIndex[0].first,result,1,1);
252 std::vector<DetGroup>
tmp;
253 Merger::orderAndMergeTwoLevels(*groupPlusIndex[2].
first,
254 *groupPlusIndex[1].first,tmp,1,1);
255 Merger::orderAndMergeTwoLevels(tmp,*groupPlusIndex[0].
first,result,1,1);
263 const vector<vector<DetGroup> > & groups,
264 const vector<int> & indices,
265 std::vector<DetGroup> & result )
267 vector< pair<vector<DetGroup>
const *,
int> > groupPlusIndex;
269 for(
unsigned int i=0;
i<groups.size();
i++){
270 groupPlusIndex.push_back(pair<vector<DetGroup>
const *,
int>(&groups[
i],indices[i]) );
279 mergeOutward(groupPlusIndex,result);
281 mergeInward(groupPlusIndex,result);
285 mergeOutward(groupPlusIndex,result);
287 mergeInward(groupPlusIndex,result);
297 float initialR = 0.5*( theFrontRing.
innerRadius() +
299 float rDiff = fabs( ringCrossing[0].
perp() - initialR);
300 for (
int i = 1;
i < 3 ;
i++){
304 float testDiff = fabs( ringCrossing[
i].
perp() - ringR);
305 if ( theBin<0 || testDiff<rDiff ) {
317 int firstIndexToCheck = (closest != 0)? 0 : 1;
322 float rDiff = fabs( ringCrossing[0].
perp() - initialR);
323 int theBin = firstIndexToCheck;
324 for (
int i = firstIndexToCheck+1;
i < 3 ;
i++){
329 float testDiff = fabs( ringCrossing[
i].
perp() - ringR);
330 if ( testDiff<rDiff ) {
347 float thetamax = ( tsRadius + ymax)/(fabs(tsos.
globalPosition().
z())-10.);
352 float thetaRingMin = ringDisk.
innerRadius()/ ringMaxZ;
353 float thetaRingMax = ringDisk.
outerRadius()/ ringMinZ;
357 return !( thetamin > thetaRingMax || thetaRingMin > thetamax);
int findClosest(const GlobalPoint[3]) const
virtual PropagationDirection propagationDirection() const
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
TIDLayer(std::vector< const TIDRing * > &rings)
virtual std::vector< int > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
void setSurface(BoundDisk *cp)
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
Vector2DBase< float, LocalTag > Local2DVector
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
std::vector< const GeomDet * > theBasicComps
int findNextIndex(const GlobalPoint[3], int) const
virtual float thickness() const =0
virtual BoundDisk * computeDisk(const std::vector< const TIDRing * > &rings) const
const T & max(const T &a, const T &b)
virtual const BoundDisk & specificSurface() const
static void orderAndMergeLevels(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const std::vector< std::vector< DetGroup > > &groups, const std::vector< int > &indices, std::vector< DetGroup > &result)
bool operator()(const pair< vector< DetGroup > const *, int > &a, const pair< vector< DetGroup >const *, int > &b) const
const Bounds & bounds() const
bool overlapInR(const TrajectoryStateOnSurface &tsos, int i, double ymax) const
std::vector< const GeometricSearchDet * > theComps
virtual const Surface::PositionType & position() const
Returns position of the surface.
std::vector< std::vector< double > > tmp
T perp() const
Magnitude of transverse component.
GlobalVector globalMomentum() const
float outerRadius() const
The outer radius of the disk.
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
float innerRadius() const
The inner radius of the disk.
const PositionType & position() const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
tuple size
Write out results.
double transverseCurvature() const