CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions
BeamHaloNavigationSchool Class Referencefinal
Inheritance diagram for BeamHaloNavigationSchool:
SimpleNavigationSchool TkNavigationSchool NavigationSchool

Public Member Functions

 BeamHaloNavigationSchool (const GeometricSearchTracker *theTracker, const MagneticField *field)
 
 ~BeamHaloNavigationSchool () override
 
- Public Member Functions inherited from SimpleNavigationSchool
StateType navigableLayers () override
 
 SimpleNavigationSchool ()
 
 SimpleNavigationSchool (const GeometricSearchTracker *tracker, const MagneticField *field)
 
 ~SimpleNavigationSchool () override
 
- Public Member Functions inherited from TkNavigationSchool
const MagneticFieldfield () const
 
const GeometricSearchTrackersearchTracker () const
 
 TkNavigationSchool (const GeometricSearchTracker *tracker, const MagneticField *field)
 
- Public Member Functions inherited from NavigationSchool
const std::vector< const DetLayer * > & allLayersInSystem () const
 
template<typename... Args>
std::vector< const DetLayer * > compatibleLayers (const DetLayer &detLayer, Args &&...args) const
 Returns all layers compatible. More...
 
 NavigationSchool ()
 
template<typename... Args>
std::vector< const DetLayer * > nextLayers (const DetLayer &detLayer, Args &&...args) const
 NavigationDirection. More...
 
virtual ~NavigationSchool ()
 

Protected Member Functions

void addInward (const DetLayer *det, const FDLC &news)
 
void addInward (const DetLayer *det, const ForwardDetLayer *newF)
 
void establishInverseRelations () override
 
void linkOtherEndLayers (SymmetricLayerFinder &symFinder)
 
FDLC reachableFromHorizontal ()
 
- Protected Member Functions inherited from SimpleNavigationSchool
virtual float barrelLength ()
 
void cleanMemory ()
 
virtual void linkBarrelLayers (SymmetricLayerFinder &symFinder)
 
virtual void linkForwardLayers (SymmetricLayerFinder &symFinder)
 
virtual void linkNextBarrelLayer (ForwardDetLayer const *fl, BDLC &)
 
virtual void linkNextForwardLayer (BarrelDetLayer const *, FDLC &)
 
virtual void linkNextLargerLayer (BDLI, BDLI, BDLC &)
 
virtual void linkNextLayerInGroup (FDLI fli, const FDLC &group, FDLC &reachableFL)
 
virtual void linkOuterGroup (ForwardDetLayer const *fl, const FDLC &group, FDLC &reachableFL)
 
virtual void linkWithinGroup (FDLI fl, const FDLC &group, FDLC &reachableFL)
 
virtual ConstFDLI outerRadiusIncrease (FDLI fl, const FDLC &group)
 
virtual std::vector< FDLCsplitForwardLayers ()
 
- Protected Member Functions inherited from NavigationSchool
void setState (const StateType &state)
 

Additional Inherited Members

- Public Types inherited from NavigationSchool
typedef std::vector< NavigableLayer * > StateType
 
- Protected Types inherited from SimpleNavigationSchool
typedef std::vector< const BarrelDetLayer * > BDLC
 
typedef BDLC::iterator BDLI
 
typedef std::vector< SimpleBarrelNavigableLayer * > BNLCType
 
typedef BDLC::const_iterator ConstBDLI
 
typedef FDLC::const_iterator ConstFDLI
 
typedef std::vector< const DetLayer * > DLC
 
typedef DLC::iterator DLI
 
typedef std::vector< const ForwardDetLayer * > FDLC
 
typedef FDLC::iterator FDLI
 
typedef std::vector< SimpleForwardNavigableLayer * > FNLCType
 
- Protected Attributes inherited from SimpleNavigationSchool
BDLC theBarrelLayers
 
float theBarrelLength =0
 
BNLCType theBarrelNLC
 
FDLC theForwardLayers
 
FNLCType theForwardNLC
 
FDLC theLeftLayers
 
FDLC theRightLayers
 
- Protected Attributes inherited from TkNavigationSchool
const MagneticFieldtheField
 
const GeometricSearchTrackertheTracker
 
- Protected Attributes inherited from NavigationSchool
const std::vector< const DetLayer * > * theAllDetLayersInSystem
 
StateType theAllNavigableLayer
 

Detailed Description

Concrete navigation school for the Tracker, connecting disks only for traversing tracks : moslty beam halo muon

Definition at line 8 of file BeamHaloNavigationSchool.cc.

Constructor & Destructor Documentation

BeamHaloNavigationSchool::BeamHaloNavigationSchool ( const GeometricSearchTracker theTracker,
const MagneticField field 
)

Definition at line 38 of file BeamHaloNavigationSchool.cc.

References a, GeometricSearchTracker::allLayers(), checklumidiff::l, LogDebug, and SimpleNavigableLayer::setCheckCrossingSide().

40 {
41  edm::LogInfo("BeamHaloNavigationSchool")<<"*********Running BeamHaloNavigationSchool *********";
42  theBarrelLength = 0;theField = field; theTracker = theInputTracker;
43  theAllDetLayersInSystem=&theInputTracker->allLayers();
44  theAllNavigableLayer.resize(theInputTracker->allLayers().size(),nullptr);
45 
46 
47 
48 
49  // Get barrel layers
50  /*sideways does not need barrels*/
51  /* vector<BarrelDetLayer*> blc = theTracker->barrelLayers();
52  for ( vector<BarrelDetLayer*>::iterator i = blc.begin(); i != blc.end(); i++) {
53  theBarrelLayers.push_back( (*i) );
54  }*/
55 
56  // get forward layers
57  for( auto const& l : theTracker->forwardLayers()) {
58  theForwardLayers.push_back(l);
59  }
60 
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());
65 
67 
68  // only work on positive Z side; negative by mirror symmetry later
69  /*sideways does not need barrels*/
70  // linkBarrelLayers( symFinder);
71 
72  linkForwardLayers( symFinder);
73 
75 
76  LogDebug("BeamHaloNavigationSchool")<<"inverse relation";
78 
79 
80  //add the necessary inward links to end caps
81  LogDebug("BeamHaloNavigationSchool")<<"linkOtherEndLayer";
82 
83  linkOtherEndLayers( symFinder);
84 
85  //set checkCrossing = false to all layers
87  SimpleNavigationSchool::StateType::iterator layerIt=allLayers.begin();
88  SimpleNavigationSchool::StateType::iterator layerIt_end=allLayers.end();
89  for (;layerIt!=layerIt_end;++layerIt)
90  {
91  //convert to SimpleNavigableLayer
92  SimpleNavigableLayer* snl=dynamic_cast<SimpleNavigableLayer*>(*layerIt);
93  if (!snl){
94  edm::LogError("BeamHaloNavigationSchool")<<"navigable layer not casting to simplenavigablelayer.";
95  continue;}
96  snl->setCheckCrossingSide(false);
97  }
98 
99 }
#define LogDebug(id)
std::vector< ForwardDetLayer const * > const & forwardLayers() const
StateType navigableLayers() override
StateType theAllNavigableLayer
std::vector< NavigableLayer * > StateType
virtual void linkForwardLayers(SymmetricLayerFinder &symFinder)
std::vector< const ForwardDetLayer * > FDLC
const std::vector< const DetLayer * > * theAllDetLayersInSystem
const MagneticField & field() const
void setCheckCrossingSide(bool docheck)
double a
Definition: hdecay.h:121
void linkOtherEndLayers(SymmetricLayerFinder &symFinder)
void setState(const StateType &state)
const MagneticField * theField
BeamHaloNavigationSchool::~BeamHaloNavigationSchool ( )
inlineoverride

Member Function Documentation

void BeamHaloNavigationSchool::addInward ( const DetLayer det,
const FDLC news 
)
protected

Definition at line 205 of file BeamHaloNavigationSchool.cc.

References GeomDetEnumerators::barrel, LogDebug, NavigableLayer::nextLayers(), outsideIn, SimpleNavigableLayer::setInwardLinks(), and tier0::unique().

Referenced by addInward(), and linkOtherEndLayers().

205  {
206  //get the navigable layer for this DetLayer
207  SimpleNavigableLayer* navigableLayer =
208  dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[(det)->seqNum()]);
209 
210  LogDebug("BeamHaloNavigationSchool")<<"retreive the nextlayer outsidein";
211  //get the inward reachable layers.
212  DLC inwardsLayers(navigableLayer->nextLayers(outsideIn));
213 
214  LogDebug("BeamHaloNavigationSchool")<<"split them barrel/forward";
215  // split barrel and forward layers
216  BDLC inwardsBarrel;
217  FDLC inwardsForward;
218  for ( DLC::iterator dli=inwardsLayers.begin();dli!=inwardsLayers.end();dli++)
219  {
220  if ((**dli).location()==GeomDetEnumerators::barrel)
221  inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
222  else
223  inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
224  }
225 
226  LogDebug("BeamHaloNavigationSchool")<<"add the new ones";
227  //add the other forward layers provided
228  inwardsForward.insert( inwardsForward.end(), news.begin(), news.end());
229 
230  LogDebug("BeamHaloNavigationSchool")<<"no duplicate please";
231  FDLI new_end =unique(inwardsForward.begin(),inwardsForward.end());
232  inwardsForward.erase(new_end,inwardsForward.end());
233 
234  LogDebug("BeamHaloNavigationSchool")<<"set back the inward links (no duplicate)";
235  // set them back to the navigable layer
236  navigableLayer->setInwardLinks( inwardsBarrel, inwardsForward, TkLayerLess(outsideIn, det));
237 }
#define LogDebug(id)
std::vector< const BarrelDetLayer * > BDLC
virtual void setInwardLinks(const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn))=0
std::vector< const DetLayer * > DLC
def unique(seq, keepstr=True)
Definition: tier0.py:25
StateType theAllNavigableLayer
std::vector< const ForwardDetLayer * > FDLC
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const =0
void BeamHaloNavigationSchool::addInward ( const DetLayer det,
const ForwardDetLayer newF 
)
protected

Definition at line 164 of file BeamHaloNavigationSchool.cc.

References addInward(), GeomDetEnumerators::barrel, LogDebug, NavigableLayer::nextLayers(), outsideIn, SimpleNavigableLayer::setInwardLinks(), and tier0::unique().

164  {
165  //get the navigable layer for this DetLayer
166  SimpleNavigableLayer* navigableLayer =
167  dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[(det)->seqNum()]);
168 
169  LogDebug("BeamHaloNavigationSchool")<<"retreive the nextlayer outsidein";
170  //get the inward reachable layers.
171  DLC inwardsLayers(navigableLayer->nextLayers(outsideIn));
172 
173  LogDebug("BeamHaloNavigationSchool")<<"split them barrel/forward";
174  // split barrel and forward layers
175  BDLC inwardsBarrel;
176  FDLC inwardsForward;
177  for ( DLC::iterator dli=inwardsLayers.begin();dli!=inwardsLayers.end();dli++)
178  {
179  if ((**dli).location()==GeomDetEnumerators::barrel)
180  inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
181  else
182  inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
183  }
184  LogDebug("BeamHaloNavigationSchool")<<"add the new ones";
185  //add the other forward layers provided
186  inwardsForward.push_back(newF);
187 
188  LogDebug("BeamHaloNavigationSchool")<<"no duplicate please";
189  sort(inwardsForward.begin(),inwardsForward.end()); //if you don't sort, unique will not work
190  // FDLI read = inwardsForward.begin();
191  // std::stringstream showMe;
192  // for (;read !=inwardsForward.end();++read) showMe<<" layer p: "<<*read<<"\n";
193  // LogDebug("BeamHaloNavigationSchool")<<"list of layer pointers: \n"<<showMe.str();
194 
195  FDLI new_end =unique(inwardsForward.begin(),inwardsForward.end());
196  // if (new_end!=inwardsForward.end()) LogDebug("BeamHaloNavigationSchool")<<"removing duplicates here";
197  inwardsForward.erase(new_end,inwardsForward.end());
198 
199  LogDebug("BeamHaloNavigationSchool")<<"set back the inward links (no duplicate)";
200  // set them back to the navigable layer
201  navigableLayer->setInwardLinks( inwardsBarrel, inwardsForward, TkLayerLess(outsideIn, det));
202 }
#define LogDebug(id)
std::vector< const BarrelDetLayer * > BDLC
virtual void setInwardLinks(const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn))=0
std::vector< const DetLayer * > DLC
def unique(seq, keepstr=True)
Definition: tier0.py:25
StateType theAllNavigableLayer
std::vector< const ForwardDetLayer * > FDLC
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const =0
void BeamHaloNavigationSchool::establishInverseRelations ( )
overrideprotectedvirtual

Reimplemented from SimpleNavigationSchool.

Definition at line 101 of file BeamHaloNavigationSchool.cc.

References mps_fire::i, insideOut, linkOtherEndLayers(), outsideIn, and SimpleNavigableLayer::setInwardLinks().

101  {
102 
103  // find for each layer which are the barrel and forward
104  // layers that point to it
105  typedef map<const DetLayer*, vector<BarrelDetLayer const*>, less<const DetLayer*> > BarrelMapType;
106  typedef map<const DetLayer*, vector<ForwardDetLayer const*>, less<const DetLayer*> > ForwardMapType;
107 
108 
109  BarrelMapType reachedBarrelLayersMap;
110  ForwardMapType reachedForwardLayersMap;
111 
112  for ( BDLI bli = theBarrelLayers.begin();
113  bli!=theBarrelLayers.end(); bli++) {
114  DLC reachedLC = nextLayers(**bli, insideOut);
115  for ( DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
116  reachedBarrelLayersMap[*i].push_back( *bli);
117  }
118  }
119 
120  for ( FDLI fli = theForwardLayers.begin();
121  fli!=theForwardLayers.end(); fli++) {
122  DLC reachedLC = nextLayers(**fli, insideOut);
123  for ( DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
124  reachedForwardLayersMap[*i].push_back( *fli);
125  }
126  }
127 
128 
129  for ( auto const i : theTracker->allLayers()) {
130  SimpleNavigableLayer* navigableLayer =
131  dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[i->seqNum()]);
132  if (!navigableLayer) {edm::LogInfo("BeamHaloNavigationSchool")<<"a detlayer does not have a navigable layer, which is normal in beam halo navigation.";}
133  if (navigableLayer){navigableLayer->setInwardLinks( reachedBarrelLayersMap[i],reachedForwardLayersMap[i], TkLayerLess(outsideIn, i) );}
134  }
135 
136 }
std::vector< DetLayer const * > const & allLayers() const
virtual void setInwardLinks(const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn))=0
std::vector< const DetLayer * > DLC
StateType theAllNavigableLayer
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
NavigationDirection.
const GeometricSearchTracker * theTracker
void BeamHaloNavigationSchool::linkOtherEndLayers ( SymmetricLayerFinder symFinder)
protected

Definition at line 140 of file BeamHaloNavigationSchool.cc.

References addInward(), LogDebug, and SymmetricLayerFinder::mirror().

Referenced by establishInverseRelations().

140  {
141 
142  LogDebug("BeamHaloNavigationSchool")<<"reachable from horizontal";
143  //generally, on the right side, what are the forward layers reachable from the horizontal
144  FDLC reachableFL= reachableFromHorizontal();
145 
146  //even simpler navigation from end to end.
147  //for each of them
148  for (FDLI fl=reachableFL.begin();fl!=reachableFL.end();fl++)
149  {
150  LogDebug("BeamHaloNavigationSchool")<<"adding inward from right";
151  //link it inward to the mirror reachable from horizontal
152  addInward(static_cast<DetLayer const*>(*fl),symFinder.mirror(*fl));
153 
154  LogDebug("BeamHaloNavigationSchool")<<"adding inward from mirror of right (left?)";
155  addInward(static_cast<DetLayer const*>(symFinder.mirror(*fl)),*fl);
156  }
157 
158 
159 
160 
161 }
#define LogDebug(id)
const ForwardDetLayer * mirror(const ForwardDetLayer *layer)
std::vector< const ForwardDetLayer * > FDLC
void addInward(const DetLayer *det, const FDLC &news)
BeamHaloNavigationSchool::FDLC BeamHaloNavigationSchool::reachableFromHorizontal ( )
protected

Definition at line 240 of file BeamHaloNavigationSchool.cc.

References begin, DEFINE_EDM_PLUGIN, end, mps_fire::i, and isDetLessZ().

241 {
242  //determine which is the list of forward layers that can be reached from inside-out
243  //at horizontal direction
244 
245  FDLC myRightLayers( theRightLayers);
246  FDLI begin = myRightLayers.begin();
247  FDLI end = myRightLayers.end();
248 
249  //sort along Z to be sure
250  sort(begin, end, isDetLessZ);
251 
252  FDLC reachableFL;
253 
254  begin = myRightLayers.begin();
255  end = myRightLayers.end();
256 
257  //the first one is always reachable
258  reachableFL.push_back(*begin);
259  FDLI current = begin;
260  for (FDLI i = begin+1; i!= end; i++)
261  {
262  //is the previous layer NOT masking this one
263  //inner radius smaller OR outer radius bigger
264  if ((**i).specificSurface().innerRadius() < (**current).specificSurface().innerRadius() ||
265  (**i).specificSurface().outerRadius() > (**current).specificSurface().outerRadius())
266  { //not masked
267  reachableFL.push_back(*i);
268  current=i;
269  }
270  }
271  return reachableFL;
272 }
bool isDetLessZ(const GeometricSearchDet *a, const GeometricSearchDet *b)
Definition: DetLessZ.h:10
#define end
Definition: vmac.h:39
std::vector< const ForwardDetLayer * > FDLC
#define begin
Definition: vmac.h:32