CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions
BeamHaloNavigationSchool Class Referencefinal
Inheritance diagram for BeamHaloNavigationSchool:
SimpleNavigationSchool NavigationSchool

Public Member Functions

 BeamHaloNavigationSchool (const GeometricSearchTracker *theTracker, const MagneticField *field)
 
 ~BeamHaloNavigationSchool ()
 
- Public Member Functions inherited from SimpleNavigationSchool
virtual StateType navigableLayers () override
 
 SimpleNavigationSchool ()
 
 SimpleNavigationSchool (const GeometricSearchTracker *theTracker, const MagneticField *field)
 
 ~SimpleNavigationSchool ()
 
- 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 ()
 
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
 
BNLCType theBarrelNLC
 
const MagneticFieldtheField
 
FDLC theForwardLayers
 
FNLCType theForwardNLC
 
FDLC theLeftLayers
 
FDLC theRightLayers
 
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 39 of file BeamHaloNavigationSchool.cc.

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

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

Member Function Documentation

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

Definition at line 206 of file BeamHaloNavigationSchool.cc.

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

206  {
207  //get the navigable layer for this DetLayer
208  SimpleNavigableLayer* navigableLayer =
209  dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[(det)->seqNum()]);
210 
211  LogDebug("BeamHaloNavigationSchool")<<"retreive the nextlayer outsidein";
212  //get the inward reachable layers.
213  DLC inwardsLayers(navigableLayer->nextLayers(outsideIn));
214 
215  LogDebug("BeamHaloNavigationSchool")<<"split them barrel/forward";
216  // split barrel and forward layers
217  BDLC inwardsBarrel;
218  FDLC inwardsForward;
219  for ( DLC::iterator dli=inwardsLayers.begin();dli!=inwardsLayers.end();dli++)
220  {
221  if ((**dli).location()==GeomDetEnumerators::barrel)
222  inwardsBarrel.push_back(static_cast<const BarrelDetLayer*>(*dli));
223  else
224  inwardsForward.push_back(static_cast<const ForwardDetLayer*>(*dli));
225  }
226 
227  LogDebug("BeamHaloNavigationSchool")<<"add the new ones";
228  //add the other forward layers provided
229  inwardsForward.insert( inwardsForward.end(), news.begin(), news.end());
230 
231  LogDebug("BeamHaloNavigationSchool")<<"no duplicate please";
232  FDLI new_end =unique(inwardsForward.begin(),inwardsForward.end());
233  inwardsForward.erase(new_end,inwardsForward.end());
234 
235  LogDebug("BeamHaloNavigationSchool")<<"set back the inward links (no duplicate)";
236  // set them back to the navigable layer
237  navigableLayer->setInwardLinks( inwardsBarrel, inwardsForward, TkLayerLess(outsideIn, det));
238 }
#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
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 165 of file BeamHaloNavigationSchool.cc.

References GeomDetEnumerators::barrel, LogDebug, NavigableLayer::nextLayers(), outsideIn, SimpleNavigableLayer::setInwardLinks(), and python.multivaluedict::sort().

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

Reimplemented from SimpleNavigationSchool.

Definition at line 102 of file BeamHaloNavigationSchool.cc.

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

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

Definition at line 141 of file BeamHaloNavigationSchool.cc.

References LogDebug, and SymmetricLayerFinder::mirror().

141  {
142 
143  LogDebug("BeamHaloNavigationSchool")<<"reachable from horizontal";
144  //generally, on the right side, what are the forward layers reachable from the horizontal
145  FDLC reachableFL= reachableFromHorizontal();
146 
147  //even simpler navigation from end to end.
148  //for each of them
149  for (FDLI fl=reachableFL.begin();fl!=reachableFL.end();fl++)
150  {
151  LogDebug("BeamHaloNavigationSchool")<<"adding inward from right";
152  //link it inward to the mirror reachable from horizontal
153  addInward(static_cast<DetLayer const*>(*fl),symFinder.mirror(*fl));
154 
155  LogDebug("BeamHaloNavigationSchool")<<"adding inward from mirror of right (left?)";
156  addInward(static_cast<DetLayer const*>(symFinder.mirror(*fl)),*fl);
157  }
158 
159 
160 
161 
162 }
#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 241 of file BeamHaloNavigationSchool.cc.

References begin, cond::rpcobimon::current, end, i, and python.multivaluedict::sort().

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