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));
90 if (
i != theBarrelLayers.end() - 1) {
91 linkNextForwardLayer(*
i, rightFL);
95 if (
i + 2 < theBarrelLayers.end()) {
96 linkNextLargerLayer(
i, theBarrelLayers.end(), reachableBL);
99 theBarrelNLC.push_back(
108 for (
FDLI fli = theRightLayers.begin(); fli != theRightLayers.end(); fli++) {
109 if (length < (**fli).position().z() &&
radius < (**fli).specificSurface().outerRadius()) {
111 for (
FDLI fliNext = fli; fliNext != theRightLayers.end(); fliNext++) {
112 if ((**fliNext).position().z() < (**fli).position().z() &&
113 (**fliNext).specificSurface().innerRadius() < (**fli).specificSurface().outerRadius()) {
114 rightFL.push_back(*fliNext);
118 rightFL.push_back(*fli);
126 float length = (**(bli + 1)).surface().bounds().length();
130 if (length +
epsilon < (**i).surface().bounds().length()) {
131 reachableBL.push_back(*
i);
139 vector<FDLC> groups = splitForwardLayers();
141 LogDebug(
"TkNavigation") <<
"SimpleNavigationSchool, Forward groups size = " << groups.size();
142 for (vector<FDLC>::iterator
g = groups.begin();
g != groups.end();
g++) {
143 LogDebug(
"TkNavigation") <<
"group " <<
g - groups.begin() <<
" has " <<
g->size() <<
" layers ";
146 for (vector<FDLC>::iterator
group = groups.begin();
group != groups.end();
group++) {
152 linkNextBarrelLayer(*
i, reachableBL);
156 linkNextLayerInGroup(
i, *
group, reachableFL);
159 if (
group + 1 != groups.end()) {
160 linkOuterGroup(*
i, *(
group + 1), reachableFL);
164 linkWithinGroup(
i, *
group, reachableFL);
168 symFinder.
mirror(*
i), reachableBL, symFinder.
mirror(reachableFL), theField, 5.));
189 for (
BDLI bli = theBarrelLayers.begin(); bli != theBarrelLayers.end(); bli++) {
190 if (
outerRadius < (**bli).specificSurface().radius() && zpos < (**bli).surface().bounds().length() / 2.) {
191 reachableBL.push_back(*bli);
199 if (fli + 1 !=
group.end()) {
200 reachableFL.push_back(*(fli + 1));
203 float innerRThis = (**fli).specificSurface().innerRadius();
204 float innerRNext = (**(fli + 1)).specificSurface().innerRadius();
207 if (innerRNext > innerRThis +
epsilon) {
212 while ((fli +
i) !=
group.end()) {
213 if ((**(fli +
i)).specificSurface().innerRadius() < innerRNext +
epsilon) {
215 reachableFL.push_back(*(fli +
i));
229 return a->position().z() >= fl->
position().
z();
235 reachableFL.insert(reachableFL.end(),
first,
last);
241 if (biggerLayer !=
group.end() && biggerLayer != fl + 1) {
242 reachableFL.push_back(*biggerLayer);
248 float outerRadius = (**fl).specificSurface().outerRadius();
249 while (++fl !=
group.end()) {
260 FDLC myRightLayers(theRightLayers);
261 FDLI begin = myRightLayers.begin();
262 FDLI end = myRightLayers.end();
266 return a->specificSurface().innerRadius() <
b->specificSurface().innerRadius();
272 current.push_back(*begin);
275 LogDebug(
"TkNavigation") <<
"(**i).specificSurface().innerRadius() = " << (**i).specificSurface().innerRadius()
277 <<
"(**(i-1)).specificSurface().outerRadius()) = "
278 << (**(
i - 1)).specificSurface().outerRadius();
279 LogDebug(
"TkNavigation") <<
"(**i).specificSurface().position().z() = "
280 << (**i).specificSurface().position().z() << endl
281 <<
"(**(i-1)).specificSurface().position().z() = "
282 << (**(
i - 1)).specificSurface().position().z();
288 if ((**i).specificSurface().innerRadius() > (**(
i - 1)).specificSurface().outerRadius() ||
289 (theTracker->posPixelForwardLayers().back()->specificSurface().position().z() >
290 theTracker->posTidLayers().front()->specificSurface().position().z() &&
291 (**i).specificSurface().position().z() < (**(
i - 1)).specificSurface().position().z())) {
292 LogDebug(
"TkNavigation") <<
"found break between groups";
295 std::stable_sort(current.begin(), current.end(),
isDetLessZ);
297 result.push_back(current);
300 current.push_back(*
i);
302 result.push_back(current);
305 for (vector<FDLC>::iterator ivec =
result.begin(); ivec !=
result.end(); ivec++) {
306 std::stable_sort(ivec->begin(), ivec->end(),
isDetLessZ);
313 if (theBarrelLength < 1.) {
314 for (
BDLI i = theBarrelLayers.begin();
i != theBarrelLayers.end();
i++) {
315 theBarrelLength =
max(theBarrelLength, (**i).surface().bounds().length() / 2.f);
318 LogDebug(
"TkNavigation") <<
"The barrel length is " << theBarrelLength;
320 return theBarrelLength;
326 setState(navigableLayers());
330 typedef map<const DetLayer*, vector<const BarrelDetLayer*>, less<const DetLayer*> > BarrelMapType;
331 typedef map<const DetLayer*, vector<const ForwardDetLayer*>, less<const DetLayer*> > ForwardMapType;
333 BarrelMapType reachedBarrelLayersMap;
334 ForwardMapType reachedForwardLayersMap;
336 for (
auto bli : theBarrelLayers) {
337 auto reachedLC = nextLayers(*bli,
insideOut);
338 for (
auto i : reachedLC) {
339 reachedBarrelLayersMap[
i].push_back(bli);
343 for (
auto fli : theForwardLayers) {
344 auto reachedLC = nextLayers(*fli,
insideOut);
345 for (
auto i : reachedLC) {
346 reachedForwardLayersMap[
i].push_back(fli);
359 for (
auto nl : theAllNavigableLayer) {
362 auto navigableLayer = static_cast<SimpleNavigableLayer*>(nl);
363 auto dl = nl->detLayer();
364 navigableLayer->setInwardLinks(reachedBarrelLayersMap[dl], reachedForwardLayersMap[dl]);