26 theAllDetLayersInSystem = &theTracker->allLayers();
27 theAllNavigableLayer.resize(theTracker->allLayers().size(),
nullptr);
30 for (
auto i : theTracker->barrelLayers()) {
31 theBarrelLayers.push_back(
i);
35 for (
auto i : theTracker->forwardLayers()) {
36 theForwardLayers.push_back(
i);
40 return a->position().z() >= 0.0;
42 theLeftLayers =
FDLC(theForwardLayers.begin(), middle);
43 theRightLayers =
FDLC(middle, theForwardLayers.end());
48 linkBarrelLayers(symFinder);
49 linkForwardLayers(symFinder);
50 establishInverseRelations();
55 for (vector<SimpleBarrelNavigableLayer*>::const_iterator
ib = theBarrelNLC.begin();
ib != theBarrelNLC.end();
ib++) {
59 for (vector<SimpleForwardNavigableLayer*>::const_iterator ifl = theForwardNLC.begin(); ifl != theForwardNLC.end();
63 theForwardNLC.clear();
68 for (vector<SimpleBarrelNavigableLayer*>::const_iterator
ib = theBarrelNLC.begin();
ib != theBarrelNLC.end();
ib++) {
71 for (vector<SimpleForwardNavigableLayer*>::const_iterator ifl = theForwardNLC.begin(); ifl != theForwardNLC.end();
80 for (
BDLI i = theBarrelLayers.begin();
i != theBarrelLayers.end();
i++) {
86 if (
i + 1 != theBarrelLayers.end()) {
87 reachableBL.push_back(*(
i + 1));
91 if (
i != theBarrelLayers.end() - 1) {
92 linkNextForwardLayer(*
i, rightFL);
96 if (
i + 2 < theBarrelLayers.end()) {
97 linkNextLargerLayer(
i, theBarrelLayers.end(), reachableBL);
100 theBarrelNLC.push_back(
109 for (
FDLI fli = theRightLayers.begin(); fli != theRightLayers.end(); fli++) {
110 if (length < (**fli).position().z() &&
radius < (**fli).specificSurface().outerRadius()) {
112 for (
FDLI fliNext = fli; fliNext != theRightLayers.end(); fliNext++) {
113 if ((**fliNext).position().z() < (**fli).position().z() &&
114 (**fliNext).specificSurface().innerRadius() < (**fli).specificSurface().outerRadius()) {
115 rightFL.push_back(*fliNext);
119 rightFL.push_back(*fli);
127 float length = (**(bli + 1)).surface().bounds().length();
131 if (length +
epsilon < (**i).surface().bounds().length()) {
132 reachableBL.push_back(*
i);
140 vector<FDLC> groups = splitForwardLayers();
142 LogDebug(
"TkNavigation") <<
"SimpleNavigationSchool, Forward groups size = " << groups.size();
143 for (vector<FDLC>::iterator
g = groups.begin();
g != groups.end();
g++) {
144 LogDebug(
"TkNavigation") <<
"group " <<
g - groups.begin() <<
" has " <<
g->size() <<
" layers ";
147 for (vector<FDLC>::iterator
group = groups.begin();
group != groups.end();
group++) {
153 linkNextBarrelLayer(*
i, reachableBL);
157 linkNextLayerInGroup(
i, *
group, reachableFL);
160 if (
group + 1 != groups.end()) {
161 linkOuterGroup(*
i, *(
group + 1), reachableFL);
165 linkWithinGroup(
i, *
group, reachableFL);
169 symFinder.
mirror(*
i), reachableBL, symFinder.
mirror(reachableFL), theField, 5.));
190 for (
BDLI bli = theBarrelLayers.begin(); bli != theBarrelLayers.end(); bli++) {
191 if (
outerRadius < (**bli).specificSurface().radius() && zpos < (**bli).surface().bounds().length() / 2.) {
192 reachableBL.push_back(*bli);
200 if (fli + 1 !=
group.end()) {
201 reachableFL.push_back(*(fli + 1));
204 float innerRThis = (**fli).specificSurface().innerRadius();
205 float innerRNext = (**(fli + 1)).specificSurface().innerRadius();
208 if (innerRNext > innerRThis +
epsilon) {
213 while ((fli +
i) !=
group.end()) {
214 if ((**(fli +
i)).specificSurface().innerRadius() < innerRNext +
epsilon) {
216 reachableFL.push_back(*(fli +
i));
230 return a->position().z() >= fl->
position().
z();
236 reachableFL.insert(reachableFL.end(),
first,
last);
242 if (biggerLayer !=
group.end() && biggerLayer != fl + 1) {
243 reachableFL.push_back(*biggerLayer);
249 float outerRadius = (**fl).specificSurface().outerRadius();
250 while (++fl !=
group.end()) {
261 FDLC myRightLayers(theRightLayers);
262 FDLI begin = myRightLayers.begin();
263 FDLI end = myRightLayers.end();
267 return a->specificSurface().innerRadius() <
b->specificSurface().innerRadius();
273 current.push_back(*begin);
276 LogDebug(
"TkNavigation") <<
"(**i).specificSurface().innerRadius() = " << (**i).specificSurface().innerRadius()
278 <<
"(**(i-1)).specificSurface().outerRadius()) = "
279 << (**(
i - 1)).specificSurface().outerRadius();
280 LogDebug(
"TkNavigation") <<
"(**i).specificSurface().position().z() = "
281 << (**i).specificSurface().position().z() << endl
282 <<
"(**(i-1)).specificSurface().position().z() = "
283 << (**(
i - 1)).specificSurface().position().z();
289 if ((**i).specificSurface().innerRadius() > (**(
i - 1)).specificSurface().outerRadius() ||
290 (theTracker->posPixelForwardLayers().back()->specificSurface().position().z() >
291 theTracker->posTidLayers().front()->specificSurface().position().z() &&
292 (**i).specificSurface().position().z() < (**(
i - 1)).specificSurface().position().z())) {
293 LogDebug(
"TkNavigation") <<
"found break between groups";
296 std::stable_sort(current.begin(), current.end(),
isDetLessZ);
298 result.push_back(current);
301 current.push_back(*
i);
303 result.push_back(current);
306 for (vector<FDLC>::iterator ivec =
result.begin(); ivec !=
result.end(); ivec++) {
307 std::stable_sort(ivec->begin(), ivec->end(),
isDetLessZ);
314 if (theBarrelLength < 1.) {
315 for (
BDLI i = theBarrelLayers.begin();
i != theBarrelLayers.end();
i++) {
316 theBarrelLength =
max(theBarrelLength, (**i).surface().bounds().length() / 2.f);
319 LogDebug(
"TkNavigation") <<
"The barrel length is " << theBarrelLength;
321 return theBarrelLength;
327 setState(navigableLayers());
331 typedef map<const DetLayer*, vector<const BarrelDetLayer*>, less<const DetLayer*> > BarrelMapType;
332 typedef map<const DetLayer*, vector<const ForwardDetLayer*>, less<const DetLayer*> > ForwardMapType;
334 BarrelMapType reachedBarrelLayersMap;
335 ForwardMapType reachedForwardLayersMap;
337 for (
auto bli : theBarrelLayers) {
338 auto reachedLC = nextLayers(*bli,
insideOut);
339 for (
auto i : reachedLC) {
340 reachedBarrelLayersMap[
i].push_back(bli);
344 for (
auto fli : theForwardLayers) {
345 auto reachedLC = nextLayers(*fli,
insideOut);
346 for (
auto i : reachedLC) {
347 reachedForwardLayersMap[
i].push_back(fli);
360 for (
auto nl : theAllNavigableLayer) {
363 auto navigableLayer = static_cast<SimpleNavigableLayer*>(nl);
364 auto dl = nl->detLayer();
365 navigableLayer->setInwardLinks(reachedBarrelLayersMap[dl], reachedForwardLayersMap[dl]);