18 void addInward(
const DetLayer * det,
const FDLC& news);
21 FDLC reachableFromHorizontal();
42 edm::LogInfo(
"BeamHaloNavigationSchool")<<
"*********Running BeamHaloNavigationSchool *********";
43 theBarrelLength = 0;theField = field; theTracker = theInputTracker;
44 theAllDetLayersInSystem=&theInputTracker->
allLayers();
45 theAllNavigableLayer.resize(theInputTracker->
allLayers().size(),
nullptr);
58 for(
auto const&
l : theTracker->forwardLayers()) {
59 theForwardLayers.push_back(
l);
62 FDLI middle = find_if( theForwardLayers.begin(), theForwardLayers.end(),
64 theLeftLayers =
FDLC( theForwardLayers.begin(), middle);
65 theRightLayers =
FDLC( middle, theForwardLayers.end());
73 linkForwardLayers( symFinder);
75 setState(navigableLayers());
77 LogDebug(
"BeamHaloNavigationSchool")<<
"inverse relation";
78 establishInverseRelations();
82 LogDebug(
"BeamHaloNavigationSchool")<<
"linkOtherEndLayer";
84 linkOtherEndLayers( symFinder);
88 SimpleNavigationSchool::StateType::iterator layerIt=allLayers.begin();
89 SimpleNavigationSchool::StateType::iterator layerIt_end=allLayers.end();
90 for (;layerIt!=layerIt_end;++layerIt)
95 edm::LogError(
"BeamHaloNavigationSchool")<<
"navigable layer not casting to simplenavigablelayer.";
106 typedef map<const DetLayer*, vector<BarrelDetLayer const*>, less<const DetLayer*> > BarrelMapType;
107 typedef map<const DetLayer*, vector<ForwardDetLayer const*>, less<const DetLayer*> > ForwardMapType;
110 BarrelMapType reachedBarrelLayersMap;
111 ForwardMapType reachedForwardLayersMap;
113 for (
BDLI bli = theBarrelLayers.begin();
114 bli!=theBarrelLayers.end(); bli++) {
116 for (
DLI i = reachedLC.begin();
i != reachedLC.end();
i++) {
117 reachedBarrelLayersMap[*
i].push_back( *bli);
121 for (
FDLI fli = theForwardLayers.begin();
122 fli!=theForwardLayers.end(); fli++) {
124 for (
DLI i = reachedLC.begin();
i != reachedLC.end();
i++) {
125 reachedForwardLayersMap[*
i].push_back( *fli);
130 for (
auto const i : theTracker->allLayers()) {
133 if (!navigableLayer) {
edm::LogInfo(
"BeamHaloNavigationSchool")<<
"a detlayer does not have a navigable layer, which is normal in beam halo navigation.";}
143 LogDebug(
"BeamHaloNavigationSchool")<<
"reachable from horizontal";
145 FDLC reachableFL= reachableFromHorizontal();
149 for (
FDLI fl=reachableFL.begin();fl!=reachableFL.end();fl++)
151 LogDebug(
"BeamHaloNavigationSchool")<<
"adding inward from right";
153 addInward(static_cast<DetLayer const*>(*fl),symFinder.
mirror(*fl));
155 LogDebug(
"BeamHaloNavigationSchool")<<
"adding inward from mirror of right (left?)";
156 addInward(static_cast<DetLayer const*>(symFinder.
mirror(*fl)),*fl);
170 LogDebug(
"BeamHaloNavigationSchool")<<
"retreive the nextlayer outsidein";
174 LogDebug(
"BeamHaloNavigationSchool")<<
"split them barrel/forward";
178 for ( DLC::iterator dli=inwardsLayers.begin();dli!=inwardsLayers.end();dli++)
185 LogDebug(
"BeamHaloNavigationSchool")<<
"add the new ones";
187 inwardsForward.push_back(newF);
189 LogDebug(
"BeamHaloNavigationSchool")<<
"no duplicate please";
190 sort(inwardsForward.begin(),inwardsForward.end());
196 FDLI new_end =unique(inwardsForward.begin(),inwardsForward.end());
198 inwardsForward.erase(new_end,inwardsForward.end());
200 LogDebug(
"BeamHaloNavigationSchool")<<
"set back the inward links (no duplicate)";
211 LogDebug(
"BeamHaloNavigationSchool")<<
"retreive the nextlayer outsidein";
215 LogDebug(
"BeamHaloNavigationSchool")<<
"split them barrel/forward";
219 for ( DLC::iterator dli=inwardsLayers.begin();dli!=inwardsLayers.end();dli++)
227 LogDebug(
"BeamHaloNavigationSchool")<<
"add the new ones";
229 inwardsForward.insert( inwardsForward.end(), news.begin(), news.end());
231 LogDebug(
"BeamHaloNavigationSchool")<<
"no duplicate please";
232 FDLI new_end =unique(inwardsForward.begin(),inwardsForward.end());
233 inwardsForward.erase(new_end,inwardsForward.end());
235 LogDebug(
"BeamHaloNavigationSchool")<<
"set back the inward links (no duplicate)";
246 FDLC myRightLayers( theRightLayers);
248 FDLI end = myRightLayers.end();
255 begin = myRightLayers.begin();
256 end = myRightLayers.end();
259 reachableFL.push_back(*begin);
265 if ((**i).specificSurface().innerRadius() < (**current).specificSurface().innerRadius() ||
266 (**i).specificSurface().outerRadius() > (**current).specificSurface().outerRadius())
268 reachableFL.push_back(*
i);
std::vector< DetLayer const * > const & allLayers() const
std::vector< const BarrelDetLayer * > BDLC
BeamHaloNavigationSchool(const GeometricSearchTracker *theTracker, const MagneticField *field)
FDLC reachableFromHorizontal()
virtual void setInwardLinks(const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn))=0
const ForwardDetLayer * mirror(const ForwardDetLayer *layer)
std::vector< const DetLayer * > DLC
std::vector< NavigableLayer * > StateType
void establishInverseRelations()
virtual void establishInverseRelations()
std::vector< const ForwardDetLayer * > FDLC
void setCheckCrossingSide(bool docheck)
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const =0
~BeamHaloNavigationSchool()
#define DEFINE_EDM_PLUGIN(factory, type, name)
void linkOtherEndLayers(SymmetricLayerFinder &symFinder)
void addInward(const DetLayer *det, const FDLC &news)