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 Reference

#include <BeamHaloNavigationSchool.h>

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 12 of file BeamHaloNavigationSchool.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file BeamHaloNavigationSchool.cc.

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

19 {
20  edm::LogInfo("BeamHaloNavigationSchool")<<"*********Running BeamHaloNavigationSchool *********";
21  theBarrelLength = 0;theField = field; theTracker = theInputTracker;
22  theAllDetLayersInSystem=&theInputTracker->allLayers();
23  theAllNavigableLayer.resize(theInputTracker->allLayers().size(),nullptr);
24 
25 
26 
27 
28  // Get barrel layers
29  /*sideways does not need barrels*/
30  /* vector<BarrelDetLayer*> blc = theTracker->barrelLayers();
31  for ( vector<BarrelDetLayer*>::iterator i = blc.begin(); i != blc.end(); i++) {
32  theBarrelLayers.push_back( (*i) );
33  }*/
34 
35  // get forward layers
36  for( auto const& l : theTracker->forwardLayers()) {
37  theForwardLayers.push_back(l);
38  }
39 
40  FDLI middle = find_if( theForwardLayers.begin(), theForwardLayers.end(),
41  not1(DetBelowZ(0)));
42  theLeftLayers = FDLC( theForwardLayers.begin(), middle);
43  theRightLayers = FDLC( middle, theForwardLayers.end());
44 
46 
47  // only work on positive Z side; negative by mirror symmetry later
48  /*sideways does not need barrels*/
49  // linkBarrelLayers( symFinder);
50 
51  linkForwardLayers( symFinder);
52 
54 
55  LogDebug("BeamHaloNavigationSchool")<<"inverse relation";
57 
58 
59  //add the necessary inward links to end caps
60  LogDebug("BeamHaloNavigationSchool")<<"linkOtherEndLayer";
61 
62  linkOtherEndLayers( symFinder);
63 
64  //set checkCrossing = false to all layers
66  SimpleNavigationSchool::StateType::iterator layerIt=allLayers.begin();
67  SimpleNavigationSchool::StateType::iterator layerIt_end=allLayers.end();
68  for (;layerIt!=layerIt_end;++layerIt)
69  {
70  //convert to SimpleNavigableLayer
71  SimpleNavigableLayer* snl=dynamic_cast<SimpleNavigableLayer*>(*layerIt);
72  if (!snl){
73  edm::LogError("BeamHaloNavigationSchool")<<"navigable layer not casting to simplenavigablelayer.";
74  continue;}
75  snl->setCheckCrossingSide(false);
76  }
77 
78 }
#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 184 of file BeamHaloNavigationSchool.cc.

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

184  {
185  //get the navigable layer for this DetLayer
186  SimpleNavigableLayer* navigableLayer =
187  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  {
199  if ((**dli).location()==GeomDetEnumerators::barrel)
200  inwardsBarrel.push_back((BarrelDetLayer*)*dli);
201  else
202  inwardsForward.push_back((ForwardDetLayer*)*dli);
203  }
204 
205  LogDebug("BeamHaloNavigationSchool")<<"add the new ones";
206  //add the other forward layers provided
207  inwardsForward.insert( inwardsForward.end(), news.begin(), news.end());
208 
209  LogDebug("BeamHaloNavigationSchool")<<"no duplicate please";
210  FDLI new_end =unique(inwardsForward.begin(),inwardsForward.end());
211  inwardsForward.erase(new_end,inwardsForward.end());
212 
213  LogDebug("BeamHaloNavigationSchool")<<"set back the inward links (no duplicate)";
214  // set them back to the navigable layer
215  navigableLayer->setInwardLinks( inwardsBarrel, inwardsForward, TkLayerLess(outsideIn, det));
216 }
#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 143 of file BeamHaloNavigationSchool.cc.

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

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

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

80  {
81 
82  // find for each layer which are the barrel and forward
83  // layers that point to it
84  typedef map<const DetLayer*, vector<BarrelDetLayer const*>, less<const DetLayer*> > BarrelMapType;
85  typedef map<const DetLayer*, vector<ForwardDetLayer const*>, less<const DetLayer*> > ForwardMapType;
86 
87 
88  BarrelMapType reachedBarrelLayersMap;
89  ForwardMapType reachedForwardLayersMap;
90 
91  for ( BDLI bli = theBarrelLayers.begin();
92  bli!=theBarrelLayers.end(); bli++) {
93  DLC reachedLC = nextLayers(**bli, insideOut);
94  for ( DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
95  reachedBarrelLayersMap[*i].push_back( *bli);
96  }
97  }
98 
99  for ( FDLI fli = theForwardLayers.begin();
100  fli!=theForwardLayers.end(); fli++) {
101  DLC reachedLC = nextLayers(**fli, insideOut);
102  for ( DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
103  reachedForwardLayersMap[*i].push_back( *fli);
104  }
105  }
106 
107 
108  for ( auto const i : theTracker->allLayers()) {
109  SimpleNavigableLayer* navigableLayer =
110  dynamic_cast<SimpleNavigableLayer*>(theAllNavigableLayer[i->seqNum()]);
111  if (!navigableLayer) {edm::LogInfo("BeamHaloNavigationSchool")<<"a detlayer does not have a navigable layer, which is normal in beam halo navigation.";}
112  if (navigableLayer){navigableLayer->setInwardLinks( reachedBarrelLayersMap[i],reachedForwardLayersMap[i], TkLayerLess(outsideIn, i) );}
113  }
114 
115 }
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 119 of file BeamHaloNavigationSchool.cc.

References LogDebug, and SymmetricLayerFinder::mirror().

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

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

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