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.

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 }

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

◆ ~BeamHaloNavigationSchool()

BeamHaloNavigationSchool::~BeamHaloNavigationSchool ( )
inlineoverride

Definition at line 12 of file BeamHaloNavigationSchool.cc.

12 { cleanMemory(); }

References SimpleNavigationSchool::cleanMemory().

Member Function Documentation

◆ addInward() [1/2]

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

Definition at line 185 of file BeamHaloNavigationSchool.cc.

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 }

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

◆ addInward() [2/2]

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

Definition at line 147 of file BeamHaloNavigationSchool.cc.

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 }

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

◆ establishInverseRelations()

void BeamHaloNavigationSchool::establishInverseRelations ( )
overrideprotectedvirtual

Reimplemented from SimpleNavigationSchool.

Definition at line 95 of file BeamHaloNavigationSchool.cc.

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 }

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

◆ linkOtherEndLayers()

void BeamHaloNavigationSchool::linkOtherEndLayers ( SymmetricLayerFinder symFinder)
protected

Definition at line 130 of file BeamHaloNavigationSchool.cc.

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 }

References LogDebug, and SymmetricLayerFinder::mirror().

◆ reachableFromHorizontal()

BeamHaloNavigationSchool::FDLC BeamHaloNavigationSchool::reachableFromHorizontal ( )
protected

Definition at line 217 of file BeamHaloNavigationSchool.cc.

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
226  sort(begin, end, isDetLessZ);
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 }

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

SimpleNavigationSchool::FDLI
FDLC::iterator FDLI
Definition: SimpleNavigationSchool.h:37
mps_fire.i
i
Definition: mps_fire.py:355
SimpleNavigationSchool::theBarrelLayers
BDLC theBarrelLayers
Definition: SimpleNavigationSchool.h:41
SimpleNavigationSchool::navigableLayers
StateType navigableLayers() override
Definition: SimpleNavigationSchool.cc:66
TkNavigationSchool::theField
const MagneticField * theField
Definition: TkNavigationSchool.h:21
edm::LogInfo
Definition: MessageLogger.h:254
SimpleNavigationSchool::theBarrelLength
float theBarrelLength
Definition: SimpleNavigationSchool.h:45
TkNavigationSchool::field
const MagneticField & field() const
Definition: TkNavigationSchool.h:17
end
#define end
Definition: vmac.h:39
GeomDetEnumerators::barrel
Definition: GeomDetEnumerators.h:9
SymmetricLayerFinder
Definition: SymmetricLayerFinder.h:17
NavigationSchool::nextLayers
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&... args) const
Definition: NavigationSchool.h:33
SimpleNavigationSchool::DLI
DLC::iterator DLI
Definition: SimpleNavigationSchool.h:35
NavigationSchool::theAllNavigableLayer
StateType theAllNavigableLayer
Definition: NavigationSchool.h:60
SimpleNavigationSchool::theLeftLayers
FDLC theLeftLayers
Definition: SimpleNavigationSchool.h:44
NavigationSchool::StateType
std::vector< NavigableLayer * > StateType
Definition: NavigationSchool.h:26
SimpleNavigationSchool::linkForwardLayers
virtual void linkForwardLayers(SymmetricLayerFinder &symFinder)
Definition: SimpleNavigationSchool.cc:137
SimpleNavigationSchool::FDLC
std::vector< const ForwardDetLayer * > FDLC
Definition: SimpleNavigationSchool.h:34
BeamHaloNavigationSchool::linkOtherEndLayers
void linkOtherEndLayers(SymmetricLayerFinder &symFinder)
Definition: BeamHaloNavigationSchool.cc:130
isDetLessZ
bool isDetLessZ(const GeometricSearchDet *a, const GeometricSearchDet *b)
Definition: DetLessZ.h:10
SimpleNavigationSchool::BDLC
std::vector< const BarrelDetLayer * > BDLC
Definition: SimpleNavigationSchool.h:33
SimpleNavigationSchool::DLC
std::vector< const DetLayer * > DLC
Definition: SimpleNavigationSchool.h:32
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
SymmetricLayerFinder::mirror
const ForwardDetLayer * mirror(const ForwardDetLayer *layer)
Definition: SymmetricLayerFinder.h:26
SimpleNavigableLayer::setCheckCrossingSide
void setCheckCrossingSide(bool docheck)
Definition: SimpleNavigableLayer.h:33
TkNavigationSchool::theTracker
const GeometricSearchTracker * theTracker
Definition: TkNavigationSchool.h:22
SimpleNavigableLayer::setInwardLinks
virtual void setInwardLinks(const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn))=0
SimpleNavigationSchool::BDLI
BDLC::iterator BDLI
Definition: SimpleNavigationSchool.h:36
NavigationSchool::theAllDetLayersInSystem
const std::vector< const DetLayer * > * theAllDetLayersInSystem
Definition: NavigationSchool.h:67
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
SimpleNavigableLayer
Definition: SimpleNavigableLayer.h:20
SimpleNavigationSchool::cleanMemory
void cleanMemory()
Definition: SimpleNavigationSchool.cc:53
SimpleNavigationSchool::theForwardLayers
FDLC theForwardLayers
Definition: SimpleNavigationSchool.h:42
BeamHaloNavigationSchool::addInward
void addInward(const DetLayer *det, const FDLC &news)
Definition: BeamHaloNavigationSchool.cc:185
outsideIn
Definition: NavigationDirection.h:4
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
BeamHaloNavigationSchool::reachableFromHorizontal
FDLC reachableFromHorizontal()
Definition: BeamHaloNavigationSchool.cc:217
GeometricSearchTracker::forwardLayers
std::vector< ForwardDetLayer const * > const & forwardLayers() const
Definition: GeometricSearchTracker.h:33
insideOut
Definition: NavigationDirection.h:4
GeometricSearchTracker::allLayers
std::vector< DetLayer const * > const & allLayers() const
Definition: GeometricSearchTracker.h:29
NavigableLayer::nextLayers
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const =0
BeamHaloNavigationSchool::establishInverseRelations
void establishInverseRelations() override
Definition: BeamHaloNavigationSchool.cc:95
NavigationSchool::setState
void setState(const StateType &state)
Definition: NavigationSchool.h:47
TkLayerLess
Definition: TkLayerLess.h:14
begin
#define begin
Definition: vmac.h:32
SimpleNavigationSchool::theRightLayers
FDLC theRightLayers
Definition: SimpleNavigationSchool.h:43