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

Constructor & Destructor Documentation

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

Definition at line 35 of file BeamHaloNavigationSchool.cc.

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

36  {
37  edm::LogInfo("BeamHaloNavigationSchool") << "*********Running BeamHaloNavigationSchool *********";
38  theBarrelLength = 0;
39  theField = field;
40  theTracker = theInputTracker;
41  theAllDetLayersInSystem = &theInputTracker->allLayers();
42  theAllNavigableLayer.resize(theInputTracker->allLayers().size(), nullptr);
43 
44  // Get barrel layers
45  /*sideways does not need barrels*/
46  /* vector<BarrelDetLayer*> blc = theTracker->barrelLayers();
47  for ( vector<BarrelDetLayer*>::iterator i = blc.begin(); i != blc.end(); i++) {
48  theBarrelLayers.push_back( (*i) );
49  }*/
50 
51  // get forward layers
52  for (auto const& l : theTracker->forwardLayers()) {
53  theForwardLayers.push_back(l);
54  }
55 
56  FDLI middle =
57  find_if(theForwardLayers.begin(), theForwardLayers.end(), [](auto const* a) { return a->position().z() >= 0.0; });
58  theLeftLayers = FDLC(theForwardLayers.begin(), middle);
59  theRightLayers = FDLC(middle, theForwardLayers.end());
60 
62 
63  // only work on positive Z side; negative by mirror symmetry later
64  /*sideways does not need barrels*/
65  // linkBarrelLayers( symFinder);
66 
67  linkForwardLayers(symFinder);
68 
70 
71  LogDebug("BeamHaloNavigationSchool") << "inverse relation";
73 
74  //add the necessary inward links to end caps
75  LogDebug("BeamHaloNavigationSchool") << "linkOtherEndLayer";
76 
77  linkOtherEndLayers(symFinder);
78 
79  //set checkCrossing = false to all layers
81  SimpleNavigationSchool::StateType::iterator layerIt = allLayers.begin();
82  SimpleNavigationSchool::StateType::iterator layerIt_end = allLayers.end();
83  for (; layerIt != layerIt_end; ++layerIt) {
84  //convert to SimpleNavigableLayer
85  SimpleNavigableLayer* snl = dynamic_cast<SimpleNavigableLayer*>(*layerIt);
86  if (!snl) {
87  edm::LogError("BeamHaloNavigationSchool") << "navigable layer not casting to simplenavigablelayer.";
88  continue;
89  }
90  snl->setCheckCrossingSide(false);
91  }
92 }
#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:119
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 184 of file BeamHaloNavigationSchool.cc.

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

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

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

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

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

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

Definition at line 129 of file BeamHaloNavigationSchool.cc.

References LogDebug, and SymmetricLayerFinder::mirror().

129  {
130  LogDebug("BeamHaloNavigationSchool") << "reachable from horizontal";
131  //generally, on the right side, what are the forward layers reachable from the horizontal
132  FDLC reachableFL = reachableFromHorizontal();
133 
134  //even simpler navigation from end to end.
135  //for each of them
136  for (FDLI fl = reachableFL.begin(); fl != reachableFL.end(); fl++) {
137  LogDebug("BeamHaloNavigationSchool") << "adding inward from right";
138  //link it inward to the mirror reachable from horizontal
139  addInward(static_cast<DetLayer const*>(*fl), symFinder.mirror(*fl));
140 
141  LogDebug("BeamHaloNavigationSchool") << "adding inward from mirror of right (left?)";
142  addInward(static_cast<DetLayer const*>(symFinder.mirror(*fl)), *fl);
143  }
144 }
#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 216 of file BeamHaloNavigationSchool.cc.

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

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