17 void addInward(
const DetLayer* det,
const FDLC& news);
20 FDLC reachableFromHorizontal();
38 edm::LogInfo(
"BeamHaloNavigationSchool") <<
"*********Running BeamHaloNavigationSchool *********";
41 theTracker = theInputTracker;
42 theAllDetLayersInSystem = &theInputTracker->
allLayers();
43 theAllNavigableLayer.resize(theInputTracker->
allLayers().size(),
nullptr);
53 for (
auto const&
l : theTracker->forwardLayers()) {
54 theForwardLayers.push_back(
l);
58 find_if(theForwardLayers.begin(), theForwardLayers.end(), [](
auto const*
a) {
return a->position().z() >= 0.0; });
59 theLeftLayers =
FDLC(theForwardLayers.begin(), middle);
60 theRightLayers =
FDLC(middle, theForwardLayers.end());
68 linkForwardLayers(symFinder);
70 setState(navigableLayers());
72 LogDebug(
"BeamHaloNavigationSchool") <<
"inverse relation";
73 establishInverseRelations();
76 LogDebug(
"BeamHaloNavigationSchool") <<
"linkOtherEndLayer";
78 linkOtherEndLayers(symFinder);
82 SimpleNavigationSchool::StateType::iterator layerIt = allLayers.begin();
83 SimpleNavigationSchool::StateType::iterator layerIt_end = allLayers.end();
84 for (; layerIt != layerIt_end; ++layerIt) {
88 edm::LogError(
"BeamHaloNavigationSchool") <<
"navigable layer not casting to simplenavigablelayer.";
98 typedef map<const DetLayer*, vector<BarrelDetLayer const*>, less<const DetLayer*> > BarrelMapType;
99 typedef map<const DetLayer*, vector<ForwardDetLayer const*>, less<const DetLayer*> > ForwardMapType;
101 BarrelMapType reachedBarrelLayersMap;
102 ForwardMapType reachedForwardLayersMap;
104 for (
BDLI bli = theBarrelLayers.begin(); bli != theBarrelLayers.end(); bli++) {
106 for (
DLI i = reachedLC.begin();
i != reachedLC.end();
i++) {
107 reachedBarrelLayersMap[*
i].push_back(*bli);
111 for (
FDLI fli = theForwardLayers.begin(); fli != theForwardLayers.end(); fli++) {
113 for (
DLI i = reachedLC.begin();
i != reachedLC.end();
i++) {
114 reachedForwardLayersMap[*
i].push_back(*fli);
118 for (
auto const i : theTracker->allLayers()) {
119 SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[
i->seqNum()]);
120 if (!navigableLayer) {
122 <<
"a detlayer does not have a navigable layer, which is normal in beam halo navigation.";
124 if (navigableLayer) {
131 LogDebug(
"BeamHaloNavigationSchool") <<
"reachable from horizontal";
133 FDLC reachableFL = reachableFromHorizontal();
137 for (
FDLI fl = reachableFL.begin(); fl != reachableFL.end(); fl++) {
138 LogDebug(
"BeamHaloNavigationSchool") <<
"adding inward from right";
140 addInward(static_cast<DetLayer const*>(*fl), symFinder.
mirror(*fl));
142 LogDebug(
"BeamHaloNavigationSchool") <<
"adding inward from mirror of right (left?)";
143 addInward(static_cast<DetLayer const*>(symFinder.
mirror(*fl)), *fl);
149 SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[(det)->seqNum()]);
151 LogDebug(
"BeamHaloNavigationSchool") <<
"retreive the nextlayer outsidein";
155 LogDebug(
"BeamHaloNavigationSchool") <<
"split them barrel/forward";
159 for (DLC::iterator dli = inwardsLayers.begin(); dli != inwardsLayers.end(); dli++) {
161 inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
163 inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
165 LogDebug(
"BeamHaloNavigationSchool") <<
"add the new ones";
167 inwardsForward.push_back(
newF);
169 LogDebug(
"BeamHaloNavigationSchool") <<
"no duplicate please";
170 sort(inwardsForward.begin(), inwardsForward.end());
176 FDLI new_end =
unique(inwardsForward.begin(), inwardsForward.end());
178 inwardsForward.erase(new_end, inwardsForward.end());
180 LogDebug(
"BeamHaloNavigationSchool") <<
"set back the inward links (no duplicate)";
187 SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[(det)->seqNum()]);
189 LogDebug(
"BeamHaloNavigationSchool") <<
"retreive the nextlayer outsidein";
193 LogDebug(
"BeamHaloNavigationSchool") <<
"split them barrel/forward";
197 for (DLC::iterator dli = inwardsLayers.begin(); dli != inwardsLayers.end(); dli++) {
199 inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
201 inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
204 LogDebug(
"BeamHaloNavigationSchool") <<
"add the new ones";
206 inwardsForward.insert(inwardsForward.end(), news.begin(), news.end());
208 LogDebug(
"BeamHaloNavigationSchool") <<
"no duplicate please";
209 FDLI new_end =
unique(inwardsForward.begin(), inwardsForward.end());
210 inwardsForward.erase(new_end, inwardsForward.end());
212 LogDebug(
"BeamHaloNavigationSchool") <<
"set back the inward links (no duplicate)";
221 FDLC myRightLayers(theRightLayers);
222 FDLI begin = myRightLayers.begin();
223 FDLI end = myRightLayers.end();
230 begin = myRightLayers.begin();
231 end = myRightLayers.end();
234 reachableFL.push_back(*begin);
235 FDLI current = begin;
239 if ((**i).specificSurface().innerRadius() < (**current).specificSurface().innerRadius() ||
240 (**i).specificSurface().outerRadius() > (**current).specificSurface().outerRadius()) {
241 reachableFL.push_back(*
i);