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
 
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 9 of file BeamHaloNavigationSchool.cc.

Constructor & Destructor Documentation

◆ BeamHaloNavigationSchool()

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

Definition at line 36 of file BeamHaloNavigationSchool.cc.

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

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

◆ ~BeamHaloNavigationSchool()

BeamHaloNavigationSchool::~BeamHaloNavigationSchool ( )
inlineoverride

Member Function Documentation

◆ addInward() [1/2]

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

Definition at line 185 of file BeamHaloNavigationSchool.cc.

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

185  {
186  //get the navigable layer for this DetLayer
187  SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[(det)->seqNum()]);
188 
189  LogDebug("BeamHaloNavigationSchool") << "retreive the nextlayer outsidein";
190  //get the inward reachable layers.
191  DLC inwardsLayers(navigableLayer->nextLayers(outsideIn));
192 
193  LogDebug("BeamHaloNavigationSchool") << "split them barrel/forward";
194  // split barrel and forward layers
195  BDLC inwardsBarrel;
196  FDLC inwardsForward;
197  for (DLC::iterator dli = inwardsLayers.begin(); dli != inwardsLayers.end(); dli++) {
198  if ((**dli).location() == GeomDetEnumerators::barrel)
199  inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
200  else
201  inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
202  }
203 
204  LogDebug("BeamHaloNavigationSchool") << "add the new ones";
205  //add the other forward layers provided
206  inwardsForward.insert(inwardsForward.end(), news.begin(), news.end());
207 
208  LogDebug("BeamHaloNavigationSchool") << "no duplicate please";
209  FDLI new_end = unique(inwardsForward.begin(), inwardsForward.end());
210  inwardsForward.erase(new_end, inwardsForward.end());
211 
212  LogDebug("BeamHaloNavigationSchool") << "set back the inward links (no duplicate)";
213  // set them back to the navigable layer
214  navigableLayer->setInwardLinks(inwardsBarrel, inwardsForward, TkLayerLess(outsideIn, det));
215 }
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:24
StateType theAllNavigableLayer
std::vector< const ForwardDetLayer * > FDLC
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const =0
#define LogDebug(id)

◆ addInward() [2/2]

void BeamHaloNavigationSchool::addInward ( const DetLayer det,
const ForwardDetLayer newF 
)
protected

Definition at line 147 of file BeamHaloNavigationSchool.cc.

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

147  {
148  //get the navigable layer for this DetLayer
149  SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[(det)->seqNum()]);
150 
151  LogDebug("BeamHaloNavigationSchool") << "retreive the nextlayer outsidein";
152  //get the inward reachable layers.
153  DLC inwardsLayers(navigableLayer->nextLayers(outsideIn));
154 
155  LogDebug("BeamHaloNavigationSchool") << "split them barrel/forward";
156  // split barrel and forward layers
157  BDLC inwardsBarrel;
158  FDLC inwardsForward;
159  for (DLC::iterator dli = inwardsLayers.begin(); dli != inwardsLayers.end(); dli++) {
160  if ((**dli).location() == GeomDetEnumerators::barrel)
161  inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
162  else
163  inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
164  }
165  LogDebug("BeamHaloNavigationSchool") << "add the new ones";
166  //add the other forward layers provided
167  inwardsForward.push_back(newF);
168 
169  LogDebug("BeamHaloNavigationSchool") << "no duplicate please";
170  sort(inwardsForward.begin(), inwardsForward.end()); //if you don't sort, unique will not work
171  // FDLI read = inwardsForward.begin();
172  // std::stringstream showMe;
173  // for (;read !=inwardsForward.end();++read) showMe<<" layer p: "<<*read<<"\n";
174  // LogDebug("BeamHaloNavigationSchool")<<"list of layer pointers: \n"<<showMe.str();
175 
176  FDLI new_end = unique(inwardsForward.begin(), inwardsForward.end());
177  // if (new_end!=inwardsForward.end()) LogDebug("BeamHaloNavigationSchool")<<"removing duplicates here";
178  inwardsForward.erase(new_end, inwardsForward.end());
179 
180  LogDebug("BeamHaloNavigationSchool") << "set back the inward links (no duplicate)";
181  // set them back to the navigable layer
182  navigableLayer->setInwardLinks(inwardsBarrel, inwardsForward, TkLayerLess(outsideIn, det));
183 }
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:24
StateType theAllNavigableLayer
std::vector< const ForwardDetLayer * > FDLC
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const =0
#define LogDebug(id)

◆ establishInverseRelations()

void BeamHaloNavigationSchool::establishInverseRelations ( )
overrideprotectedvirtual

Reimplemented from SimpleNavigationSchool.

Definition at line 95 of file BeamHaloNavigationSchool.cc.

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

95  {
96  // find for each layer which are the barrel and forward
97  // layers that point to it
98  typedef map<const DetLayer*, vector<BarrelDetLayer const*>, less<const DetLayer*> > BarrelMapType;
99  typedef map<const DetLayer*, vector<ForwardDetLayer const*>, less<const DetLayer*> > ForwardMapType;
100 
101  BarrelMapType reachedBarrelLayersMap;
102  ForwardMapType reachedForwardLayersMap;
103 
104  for (BDLI bli = theBarrelLayers.begin(); bli != theBarrelLayers.end(); bli++) {
105  DLC reachedLC = nextLayers(**bli, insideOut);
106  for (DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
107  reachedBarrelLayersMap[*i].push_back(*bli);
108  }
109  }
110 
111  for (FDLI fli = theForwardLayers.begin(); fli != theForwardLayers.end(); fli++) {
112  DLC reachedLC = nextLayers(**fli, insideOut);
113  for (DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
114  reachedForwardLayersMap[*i].push_back(*fli);
115  }
116  }
117 
118  for (auto const i : theTracker->allLayers()) {
119  SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[i->seqNum()]);
120  if (!navigableLayer) {
121  edm::LogInfo("BeamHaloNavigationSchool")
122  << "a detlayer does not have a navigable layer, which is normal in beam halo navigation.";
123  }
124  if (navigableLayer) {
125  navigableLayer->setInwardLinks(reachedBarrelLayersMap[i], reachedForwardLayersMap[i], TkLayerLess(outsideIn, i));
126  }
127  }
128 }
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
Log< level::Info, false > LogInfo
const GeometricSearchTracker * theTracker

◆ linkOtherEndLayers()

void BeamHaloNavigationSchool::linkOtherEndLayers ( SymmetricLayerFinder symFinder)
protected

Definition at line 130 of file BeamHaloNavigationSchool.cc.

References LogDebug, and SymmetricLayerFinder::mirror().

130  {
131  LogDebug("BeamHaloNavigationSchool") << "reachable from horizontal";
132  //generally, on the right side, what are the forward layers reachable from the horizontal
133  FDLC reachableFL = reachableFromHorizontal();
134 
135  //even simpler navigation from end to end.
136  //for each of them
137  for (FDLI fl = reachableFL.begin(); fl != reachableFL.end(); fl++) {
138  LogDebug("BeamHaloNavigationSchool") << "adding inward from right";
139  //link it inward to the mirror reachable from horizontal
140  addInward(static_cast<DetLayer const*>(*fl), symFinder.mirror(*fl));
141 
142  LogDebug("BeamHaloNavigationSchool") << "adding inward from mirror of right (left?)";
143  addInward(static_cast<DetLayer const*>(symFinder.mirror(*fl)), *fl);
144  }
145 }
const ForwardDetLayer * mirror(const ForwardDetLayer *layer)
std::vector< const ForwardDetLayer * > FDLC
void addInward(const DetLayer *det, const FDLC &news)
#define LogDebug(id)

◆ reachableFromHorizontal()

BeamHaloNavigationSchool::FDLC BeamHaloNavigationSchool::reachableFromHorizontal ( )
protected

Definition at line 217 of file BeamHaloNavigationSchool.cc.

References mps_fire::i, isDetLessZ(), and jetUpdater_cfi::sort.

217  {
218  //determine which is the list of forward layers that can be reached from inside-out
219  //at horizontal direction
220 
221  FDLC myRightLayers(theRightLayers);
222  FDLI begin = myRightLayers.begin();
223  FDLI end = myRightLayers.end();
224 
225  //sort along Z to be sure
227 
228  FDLC reachableFL;
229 
230  begin = myRightLayers.begin();
231  end = myRightLayers.end();
232 
233  //the first one is always reachable
234  reachableFL.push_back(*begin);
235  FDLI current = begin;
236  for (FDLI i = begin + 1; i != end; i++) {
237  //is the previous layer NOT masking this one
238  //inner radius smaller OR outer radius bigger
239  if ((**i).specificSurface().innerRadius() < (**current).specificSurface().innerRadius() ||
240  (**i).specificSurface().outerRadius() > (**current).specificSurface().outerRadius()) { //not masked
241  reachableFL.push_back(*i);
242  current = i;
243  }
244  }
245  return reachableFL;
246 }
bool isDetLessZ(const GeometricSearchDet *a, const GeometricSearchDet *b)
Definition: DetLessZ.h:9
std::vector< const ForwardDetLayer * > FDLC