21 FDLC reachableFromHorizontal();
41 edm::LogInfo(
"BeamHaloNavigationSchool")<<
"*********Running BeamHaloNavigationSchool *********";
42 theBarrelLength = 0;theField = field; theTracker = theInputTracker;
43 theAllDetLayersInSystem=&theInputTracker->
allLayers();
44 theAllNavigableLayer.resize(theInputTracker->
allLayers().size(),
nullptr);
57 for(
auto const&
l : theTracker->forwardLayers()) {
58 theForwardLayers.push_back(
l);
61 FDLI middle = find_if( theForwardLayers.begin(), theForwardLayers.end(),
62 [](
auto const*
a){
return a->position().z() >= 0.0; });
63 theLeftLayers =
FDLC( theForwardLayers.begin(), middle);
64 theRightLayers =
FDLC( middle, theForwardLayers.end());
72 linkForwardLayers( symFinder);
74 setState(navigableLayers());
76 LogDebug(
"BeamHaloNavigationSchool")<<
"inverse relation";
77 establishInverseRelations();
81 LogDebug(
"BeamHaloNavigationSchool")<<
"linkOtherEndLayer";
83 linkOtherEndLayers( symFinder);
87 SimpleNavigationSchool::StateType::iterator layerIt=allLayers.begin();
88 SimpleNavigationSchool::StateType::iterator layerIt_end=allLayers.end();
89 for (;layerIt!=layerIt_end;++layerIt)
94 edm::LogError(
"BeamHaloNavigationSchool")<<
"navigable layer not casting to simplenavigablelayer.";
105 typedef map<const DetLayer*, vector<BarrelDetLayer const*>, less<const DetLayer*> > BarrelMapType;
106 typedef map<const DetLayer*, vector<ForwardDetLayer const*>, less<const DetLayer*> > ForwardMapType;
109 BarrelMapType reachedBarrelLayersMap;
110 ForwardMapType reachedForwardLayersMap;
112 for (
BDLI bli = theBarrelLayers.begin();
113 bli!=theBarrelLayers.end(); bli++) {
115 for (
DLI i = reachedLC.begin();
i != reachedLC.end();
i++) {
116 reachedBarrelLayersMap[*
i].push_back( *bli);
120 for (
FDLI fli = theForwardLayers.begin();
121 fli!=theForwardLayers.end(); fli++) {
123 for (
DLI i = reachedLC.begin();
i != reachedLC.end();
i++) {
124 reachedForwardLayersMap[*
i].push_back( *fli);
129 for (
auto const i : theTracker->allLayers()) {
132 if (!navigableLayer) {
edm::LogInfo(
"BeamHaloNavigationSchool")<<
"a detlayer does not have a navigable layer, which is normal in beam halo navigation.";}
142 LogDebug(
"BeamHaloNavigationSchool")<<
"reachable from horizontal";
144 FDLC reachableFL= reachableFromHorizontal();
148 for (
FDLI fl=reachableFL.begin();fl!=reachableFL.end();fl++)
150 LogDebug(
"BeamHaloNavigationSchool")<<
"adding inward from right";
152 addInward(static_cast<DetLayer const*>(*fl),symFinder.
mirror(*fl));
154 LogDebug(
"BeamHaloNavigationSchool")<<
"adding inward from mirror of right (left?)";
155 addInward(static_cast<DetLayer const*>(symFinder.
mirror(*fl)),*fl);
169 LogDebug(
"BeamHaloNavigationSchool")<<
"retreive the nextlayer outsidein";
173 LogDebug(
"BeamHaloNavigationSchool")<<
"split them barrel/forward";
177 for ( DLC::iterator dli=inwardsLayers.begin();dli!=inwardsLayers.end();dli++)
180 inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
182 inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
184 LogDebug(
"BeamHaloNavigationSchool")<<
"add the new ones";
186 inwardsForward.push_back(newF);
188 LogDebug(
"BeamHaloNavigationSchool")<<
"no duplicate please";
189 sort(inwardsForward.begin(),inwardsForward.end());
195 FDLI new_end =
unique(inwardsForward.begin(),inwardsForward.end());
197 inwardsForward.erase(new_end,inwardsForward.end());
199 LogDebug(
"BeamHaloNavigationSchool")<<
"set back the inward links (no duplicate)";
210 LogDebug(
"BeamHaloNavigationSchool")<<
"retreive the nextlayer outsidein";
214 LogDebug(
"BeamHaloNavigationSchool")<<
"split them barrel/forward";
218 for ( DLC::iterator dli=inwardsLayers.begin();dli!=inwardsLayers.end();dli++)
221 inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
223 inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
226 LogDebug(
"BeamHaloNavigationSchool")<<
"add the new ones";
228 inwardsForward.insert( inwardsForward.end(), news.begin(), news.end());
230 LogDebug(
"BeamHaloNavigationSchool")<<
"no duplicate please";
231 FDLI new_end =
unique(inwardsForward.begin(),inwardsForward.end());
232 inwardsForward.erase(new_end,inwardsForward.end());
234 LogDebug(
"BeamHaloNavigationSchool")<<
"set back the inward links (no duplicate)";
245 FDLC myRightLayers( theRightLayers);
247 FDLI end = myRightLayers.end();
254 begin = myRightLayers.begin();
255 end = myRightLayers.end();
258 reachableFL.push_back(*begin);
264 if ((**i).specificSurface().innerRadius() < (**current).specificSurface().innerRadius() ||
265 (**i).specificSurface().outerRadius() > (**current).specificSurface().outerRadius())
267 reachableFL.push_back(*
i);
std::vector< DetLayer const * > const & allLayers() const
std::vector< const BarrelDetLayer * > BDLC
BeamHaloNavigationSchool(const GeometricSearchTracker *theTracker, const MagneticField *field)
void establishInverseRelations() override
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
bool isDetLessZ(const GeometricSearchDet *a, const GeometricSearchDet *b)
def unique(seq, keepstr=True)
std::vector< NavigableLayer * > StateType
virtual void establishInverseRelations()
std::vector< const ForwardDetLayer * > FDLC
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const =0
void setCheckCrossingSide(bool docheck)
#define DEFINE_EDM_PLUGIN(factory, type, name)
void linkOtherEndLayers(SymmetricLayerFinder &symFinder)
void addInward(const DetLayer *det, const FDLC &news)
~BeamHaloNavigationSchool() override