CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MuonTkNavigationSchool Class Reference

#include <MuonTkNavigationSchool.h>

Inheritance diagram for MuonTkNavigationSchool:
NavigationSchool

Classes

struct  delete_layer
 

Public Member Functions

 MuonTkNavigationSchool (const MuonDetLayerGeometry *, const GeometricSearchTracker *, const MagneticField *)
 constructor More...
 
virtual std::vector
< NavigableLayer * > 
navigableLayers () const
 return a vector of NavigableLayer*, from base class More...
 
 ~MuonTkNavigationSchool ()
 destructor More...
 
- Public Member Functions inherited from NavigationSchool
const std::vector< DetLayer * > & allLayersInSystem () const
 
 NavigationSchool ()
 
virtual ~NavigationSchool ()
 

Private Types

typedef std::vector
< BarrelDetLayer * > 
BDLC
 
typedef std::vector
< ForwardDetLayer * > 
FDLC
 

Private Member Functions

void addBarrelLayer (BarrelDetLayer *)
 add barrel layer More...
 
void addEndcapLayer (ForwardDetLayer *)
 add endcap layer (backward and forward) More...
 
float barrelLength () const
 calaulate the length of the barrel More...
 
float calculateEta (float r, float z) const
 pseudorapidity from r and z More...
 
void linkBarrelLayers ()
 link barrel layers More...
 
void linkEndcapLayers (const MapE &, std::vector< MuonForwardNavigableLayer * > &, std::vector< SimpleForwardNavigableLayer * > &)
 link endcap layers More...
 

Private Attributes

MapE theBackwardLayers
 
MapB theBarrelLayers
 
MapE theForwardLayers
 
const GeometricSearchTrackertheGeometricSearchTracker
 
const MagneticFieldtheMagneticField
 
std::vector
< MuonForwardNavigableLayer * > 
theMuonBackwardNLC
 
std::vector
< MuonBarrelNavigableLayer * > 
theMuonBarrelNLC
 
const MuonDetLayerGeometrytheMuonDetLayerGeometry
 
std::vector
< MuonForwardNavigableLayer * > 
theMuonForwardNLC
 
std::vector
< SimpleForwardNavigableLayer * > 
theTkBackwardNLC
 
std::vector
< SimpleBarrelNavigableLayer * > 
theTkBarrelNLC
 
std::vector
< SimpleForwardNavigableLayer * > 
theTkForwardNLC
 

Additional Inherited Members

- Public Types inherited from NavigationSchool
typedef std::vector
< NavigableLayer * > 
StateType
 
- Protected Attributes inherited from NavigationSchool
const std::vector< DetLayer * > * theAllDetLayersInSystem
 

Detailed Description

Navigation School for both the Muon system and the Tracker.

Date:
2008/03/20 14:17:23
Revision:
1.2
Author
Chang Liu - Purdue University
Stefano Lacaprara - INFN Padova

Definition at line 36 of file MuonTkNavigationSchool.h.

Member Typedef Documentation

typedef std::vector<BarrelDetLayer*> MuonTkNavigationSchool::BDLC
private

Definition at line 85 of file MuonTkNavigationSchool.h.

typedef std::vector<ForwardDetLayer*> MuonTkNavigationSchool::FDLC
private

Definition at line 86 of file MuonTkNavigationSchool.h.

Constructor & Destructor Documentation

MuonTkNavigationSchool::MuonTkNavigationSchool ( const MuonDetLayerGeometry muonGeom,
const GeometricSearchTracker trackerGeom,
const MagneticField field 
)

constructor

Definition at line 58 of file MuonTkNavigationSchool.cc.

References addBarrelLayer(), addEndcapLayer(), MuonDetLayerGeometry::allBarrelLayers(), MuonDetLayerGeometry::allEndcapLayers(), GeometricSearchTracker::allLayers(), MuonDetLayerGeometry::allLayers(), Reference_intrackfit_cff::barrel, GeometricSearchTracker::barrelLayers(), Reference_intrackfit_cff::endcap, GeometricSearchTracker::forwardLayers(), i, linkBarrelLayers(), linkEndcapLayers(), NavigationSchool::theAllDetLayersInSystem, theBackwardLayers, theForwardLayers, theMuonBackwardNLC, theMuonForwardNLC, theTkBackwardNLC, and theTkForwardNLC.

60  :
62 
63  // need to allocate the vector of DetLayers, to concatenate the two vectors of DetLayers
64  // it has to be deleted in the destructor
65  std::vector<DetLayer*> * allLayers = new std::vector<DetLayer*>();
66  allLayers->reserve(muonGeom->allLayers().size()+trackerGeom->allLayers().size());
67  allLayers->insert(allLayers->end(), muonGeom->allLayers().begin(), muonGeom->allLayers().end());
68  allLayers->insert(allLayers->end(), trackerGeom->allLayers().begin(), trackerGeom->allLayers().end());
69  theAllDetLayersInSystem = allLayers;
70 
71  // get tracker barrel layers
72  std::vector<BarrelDetLayer*> blc = trackerGeom->barrelLayers();
73  for ( std::vector<BarrelDetLayer*>::const_iterator i = blc.begin(); i != blc.end(); i++ ) {
74  addBarrelLayer(*i);
75  }
76 
77  // get tracker forward layers
78  std::vector<ForwardDetLayer*> flc = trackerGeom->forwardLayers();
79  for (std::vector<ForwardDetLayer*>::const_iterator i = flc.begin(); i != flc.end(); i++) {
80  addEndcapLayer(*i);
81  }
82 
83  // get all muon barrel DetLayers (DT + RPC)
84  vector<DetLayer*> barrel = muonGeom->allBarrelLayers();
85  for ( vector<DetLayer*>::const_iterator i = barrel.begin(); i != barrel.end(); i++ ) {
86  BarrelDetLayer* mbp = dynamic_cast<BarrelDetLayer*>(*i);
87  if ( mbp == 0 ) throw Genexception("Bad BarrelDetLayer");
88  addBarrelLayer(mbp);
89  }
90 
91  // get all muon forward (+z) DetLayers (CSC + RPC)
92  vector<DetLayer*> endcap = muonGeom->allEndcapLayers();
93  for ( vector<DetLayer*>::const_iterator i = endcap.begin(); i != endcap.end(); i++ ) {
94  ForwardDetLayer* mep = dynamic_cast<ForwardDetLayer*>(*i);
95  if ( mep == 0 ) throw Genexception("Bad ForwardDetLayer");
96  addEndcapLayer(mep);
97  }
98 
99  // create outward links for all DetLayers
103 
104 }
int i
Definition: DBlmapReader.cc:9
std::vector< SimpleForwardNavigableLayer * > theTkBackwardNLC
const MagneticField * theMagneticField
std::vector< MuonForwardNavigableLayer * > theMuonBackwardNLC
std::vector< MuonForwardNavigableLayer * > theMuonForwardNLC
std::vector< BarrelDetLayer * > const & barrelLayers() const
const GeometricSearchTracker * theGeometricSearchTracker
const std::vector< DetLayer * > & allEndcapLayers() const
return all endcap DetLayers (CSC+RPC), -Z to +Z
std::vector< DetLayer * > const & allLayers() const
const std::vector< DetLayer * > & allLayers() const
return all layers (DT+CSC+RPC), order: backward, barrel, forward
const MuonDetLayerGeometry * theMuonDetLayerGeometry
void linkEndcapLayers(const MapE &, std::vector< MuonForwardNavigableLayer * > &, std::vector< SimpleForwardNavigableLayer * > &)
link endcap layers
void addEndcapLayer(ForwardDetLayer *)
add endcap layer (backward and forward)
const std::vector< DetLayer * > * theAllDetLayersInSystem
std::vector< ForwardDetLayer * > const & forwardLayers() const
void linkBarrelLayers()
link barrel layers
std::vector< SimpleForwardNavigableLayer * > theTkForwardNLC
const std::vector< DetLayer * > & allBarrelLayers() const
return all barrel DetLayers (DT+RPC), inside-out
void addBarrelLayer(BarrelDetLayer *)
add barrel layer
MuonTkNavigationSchool::~MuonTkNavigationSchool ( )

destructor

Definition at line 110 of file MuonTkNavigationSchool.cc.

References NavigationSchool::theAllDetLayersInSystem, theMuonBackwardNLC, theMuonBarrelNLC, theMuonForwardNLC, theTkBackwardNLC, theTkBarrelNLC, and theTkForwardNLC.

110  {
111 
112  for_each(theTkBarrelNLC.begin(),theTkBarrelNLC.end(), delete_layer());
113  for_each(theTkForwardNLC.begin(),theTkForwardNLC.end(), delete_layer());
114  for_each(theTkBackwardNLC.begin(),theTkBackwardNLC.end(), delete_layer());
115  for_each(theMuonBarrelNLC.begin(),theMuonBarrelNLC.end(), delete_layer());
116  for_each(theMuonForwardNLC.begin(),theMuonForwardNLC.end(), delete_layer());
117  for_each(theMuonBackwardNLC.begin(),theMuonBackwardNLC.end(), delete_layer());
118 
119  // delete the vector containing all the detlayers
121 
122 }
std::vector< SimpleBarrelNavigableLayer * > theTkBarrelNLC
std::vector< SimpleForwardNavigableLayer * > theTkBackwardNLC
std::vector< MuonBarrelNavigableLayer * > theMuonBarrelNLC
std::vector< MuonForwardNavigableLayer * > theMuonBackwardNLC
std::vector< MuonForwardNavigableLayer * > theMuonForwardNLC
const std::vector< DetLayer * > * theAllDetLayersInSystem
std::vector< SimpleForwardNavigableLayer * > theTkForwardNLC

Member Function Documentation

void MuonTkNavigationSchool::addBarrelLayer ( BarrelDetLayer mbp)
private

add barrel layer

Definition at line 171 of file MuonTkNavigationSchool.cc.

References BoundSurface::bounds(), calculateEta(), Bounds::length(), Cylinder::radius(), CosmicsPD_Skims::radius, BarrelDetLayer::specificSurface(), and theBarrelLayers.

Referenced by MuonTkNavigationSchool().

171  {
172 
173  const BoundCylinder& bc = mbp->specificSurface();
174  float radius = bc.radius();
175  float length = bc.bounds().length()/2.;
176  float eta_max = calculateEta(radius, length);
177  float eta_min = -eta_max;
178  edm::LogInfo("MuonTkNavigationSchool")<<"BarrelLayer eta: ("<<eta_min<<", "<<eta_max<<"). Radius "<<radius<<", Length "<<length;
179  theBarrelLayers[mbp] = MuonEtaRange(eta_max, eta_min);
180 
181 }
virtual float length() const =0
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
const Bounds & bounds() const
Definition: BoundSurface.h:89
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
float calculateEta(float r, float z) const
pseudorapidity from r and z
void MuonTkNavigationSchool::addEndcapLayer ( ForwardDetLayer mep)
private

add endcap layer (backward and forward)

Definition at line 187 of file MuonTkNavigationSchool.cc.

References BoundSurface::bounds(), calculateEta(), BoundDisk::innerRadius(), Bounds::length(), BoundDisk::outerRadius(), GloballyPositioned< T >::position(), ForwardDetLayer::specificSurface(), theBackwardLayers, theForwardLayers, detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by MuonTkNavigationSchool().

187  {
188 
189  const BoundDisk& bd = mep->specificSurface();
190  float outRadius = bd.outerRadius();
191  float inRadius = bd.innerRadius();
192  float thick = bd.bounds().length()/2.;
193  float z = bd.position().z();
194 
195  if ( z > 0. ) {
196  float eta_min = calculateEta(outRadius, z-thick);
197  float eta_max = calculateEta(inRadius, z+thick);
198  edm::LogInfo("MuonTkNavigationSchool")<<"ForwardLayer eta: ("<<eta_min<<", "<<eta_max<<"). Radius ("<<inRadius<<", "<<outRadius<<"), Z "<<z;
199  theForwardLayers[mep] = MuonEtaRange(eta_max, eta_min);
200  } else {
201  float eta_max = calculateEta(outRadius, z+thick);
202  float eta_min = calculateEta(inRadius, z-thick);
203  edm::LogInfo("MuonTkNavigationSchool")<<"BackwardLayer eta: ("<<eta_min<<", "<<eta_max<<"). Radius ("<<inRadius<<", "<<outRadius<<"), Z "<<z;
204  theBackwardLayers[mep] = MuonEtaRange(eta_max, eta_min);
205  }
206 
207 }
virtual float length() const =0
double double double z
T z() const
Definition: PV3DBase.h:63
virtual const BoundDisk & specificSurface() const
const Bounds & bounds() const
Definition: BoundSurface.h:89
float outerRadius() const
The outer radius of the disk.
Definition: BoundDisk.h:75
float innerRadius() const
The inner radius of the disk.
Definition: BoundDisk.h:72
const PositionType & position() const
float calculateEta(float r, float z) const
pseudorapidity from r and z
float MuonTkNavigationSchool::barrelLength ( ) const
private

calaulate the length of the barrel

Definition at line 767 of file MuonTkNavigationSchool.cc.

References i, max(), GeomDetEnumerators::PixelBarrel, theBarrelLayers, GeomDetEnumerators::TIB, and GeomDetEnumerators::TOB.

767  {
768 
769  float length = 0.0;
770  for (MapBI i= theBarrelLayers.begin(); i != theBarrelLayers.end(); i++) {
771  if ((*i).first->subDetector() != GeomDetEnumerators::PixelBarrel && (*i).first->subDetector() != GeomDetEnumerators::TIB && (*i).first->subDetector() != GeomDetEnumerators::TOB) continue;
772  length = max(length,(*i).first->surface().bounds().length()/2.f);
773  }
774 
775  return length;
776 
777 }
int i
Definition: DBlmapReader.cc:9
MapB::const_iterator MapBI
const T & max(const T &a, const T &b)
float MuonTkNavigationSchool::calculateEta ( float  r,
float  z 
) const
private

pseudorapidity from r and z

Definition at line 783 of file MuonTkNavigationSchool.cc.

References create_public_lumi_plots::log, and funct::tan().

Referenced by addBarrelLayer(), and addEndcapLayer().

783  {
784 
785  if ( z > 0 ) return -log((tan(atan(r/z)/2.)));
786  return log(-(tan(atan(r/z)/2.)));
787 
788 }
double double double z
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
void MuonTkNavigationSchool::linkBarrelLayers ( )
private

link barrel layers

Definition at line 213 of file MuonTkNavigationSchool.cc.

References GeomDetEnumerators::DT, MuonEtaRange::isInside(), MuonEtaRange::max(), MuonEtaRange::min(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::RPCBarrel, DetLayer::subDetector(), theBackwardLayers, theBarrelLayers, theForwardLayers, theMagneticField, theMuonBarrelNLC, theTkBarrelNLC, GeomDetEnumerators::TIB, GeomDetEnumerators::TOB, and detailsBasic3DVector::z.

Referenced by MuonTkNavigationSchool().

213  {
214 
215  for (MapBI bl = theBarrelLayers.begin(); bl != theBarrelLayers.end(); bl++) {
216 
217  MuonEtaRange range = (*bl).second;
218 
219  float length = fabs((*bl).first->specificSurface().bounds().length()/2.);
220  // first add next barrel layer
221  MapBI plusOne(bl);
222  plusOne++;
223  MapB outerBarrel;
224  MapB allOuterBarrel;
225  if ( plusOne != theBarrelLayers.end() ) { outerBarrel.insert(*plusOne); }
226  // add all outer barrel layers
227  for ( MapBI iMBI = plusOne; iMBI!= theBarrelLayers.end(); iMBI++) {
228  allOuterBarrel.insert(*iMBI);
229  }
230  // then add all compatible backward layers with an eta criteria
231  MapE allOuterBackward;
232  for (MapEI el = theBackwardLayers.begin();
233  el != theBackwardLayers.end(); el++) {
234  if ( (*el).second.isCompatible(range) ) {
235  float z = (*el).first->specificSurface().position().z();
236  if (fabs(z) < length) continue;
237  allOuterBackward.insert(*el);
238  }
239  }
240 
241  // add the backward next layer with an eta criteria
242  MapE outerBackward;
243  for (MapEI el = theBackwardLayers.begin();
244  el != theBackwardLayers.end(); el++) {
245  if ( (*el).second.isCompatible(range) ) {
246  float z = (*el).first->specificSurface().position().z();
247  if (fabs(z) < length) continue;
248  outerBackward.insert(*el);
249  break;
250  }
251  }
252 
253  // then add all compatible forward layers with an eta criteria
254  MapE allOuterForward;
255  for (MapEI el = theForwardLayers.begin();
256  el != theForwardLayers.end(); el++) {
257  if ( (*el).second.isCompatible(range) ) {
258  float z = (*el).first->specificSurface().position().z();
259  if (fabs(z) < length) continue;
260  allOuterForward.insert(*el);
261  }
262  }
263 
264  // then add forward next layer with an eta criteria
265  MapE outerForward;
266  for (MapEI el = theForwardLayers.begin();
267  el != theForwardLayers.end(); el++) {
268  if ( (*el).second.isCompatible(range) ) {
269  float z = (*el).first->specificSurface().position().z();
270  if (fabs(z) < length) continue;
271  outerForward.insert(*el);
272  break;
273  }
274  }
275 
276  // first add next inner barrel layer
277  MapBI minusOne(bl);
278  MapB innerBarrel;
279  MapB allInnerBarrel;
280  MapE allInnerBackward;
281  MapE innerBackward;
282  MapE allInnerForward;
283  MapE innerForward;
284 
285  if ( bl != theBarrelLayers.begin() ) {
286  minusOne--;
287  innerBarrel.insert(*minusOne);
288  // add all inner barrel layers
289  for ( MapBI iMBI = minusOne; iMBI != theBarrelLayers.begin(); iMBI--) {
290  allInnerBarrel.insert(*iMBI);
291  }
292  allInnerBarrel.insert(*theBarrelLayers.begin());
293 
294  // then add all compatible backward layers with an eta criteria
295  for (MapEI el = theBackwardLayers.end();
296  el != theBackwardLayers.begin(); el--) {
297  if (el == theBackwardLayers.end()) continue; //C.L @@: no -/+ for map iterator
298  if ( (*el).second.isCompatible(range) ) {
299  float z = (*el).first->specificSurface().position().z();
300  if (fabs(z) > length) continue;
301  allInnerBackward.insert(*el);
302  }
303  }
304  MapEI el = theBackwardLayers.begin();
305  if (el->second.isCompatible(range)) {
306  float z = (*el).first->specificSurface().position().z();
307  if (fabs(z) < length) {
308  allInnerBackward.insert(*el);
309  }
310  }
311 
312  // then add all compatible forward layers with an eta criteria
313  for (MapEI el = theForwardLayers.end();
314  el != theForwardLayers.begin(); el--) {
315  if (el == theForwardLayers.end()) continue;
316  if ( (*el).second.isCompatible(range) ) {
317  float z = (*el).first->specificSurface().position().z();
318  if (fabs(z) > length) continue;
319  allInnerForward.insert(*el);
320  }
321  }
322 
323  el = theForwardLayers.begin();
324  if (el->second.isCompatible(range)) {
325  float z = (*el).first->specificSurface().position().z();
326  if (fabs(z) < length) {
327  allInnerForward.insert(*el);
328  }
329  }
330 
331  if ( !range.isInside((*minusOne).second) ) {
332  MuonEtaRange backwardRange(range.min(), (*minusOne).second.min());
333  MuonEtaRange forwardRange((*minusOne).second.max(),range.max());
334 
335  // add the backward next layer with an eta criteria
336  for (MapEI el = theBackwardLayers.end();
337  el != theBackwardLayers.begin(); el--) {
338  if ( el == theBackwardLayers.end() ) continue;
339  if ( (*el).second.isCompatible(backwardRange) ) {
340  float z = (*el).first->specificSurface().position().z();
341  if (fabs(z) > length) continue;
342  innerBackward.insert(*el);
343  backwardRange = backwardRange.subtract((*el).second);
344  }
345  }
346 
347  MapEI el = theBackwardLayers.begin();
348  if (el->second.isCompatible(backwardRange)) {
349  float z = (*el).first->specificSurface().position().z();
350  if (fabs(z) < length) {
351  innerBackward.insert(*el);
352  }
353  }
354 
355  // then add forward next layer with an eta criteria
356  for (MapEI el = theForwardLayers.end();
357  el != theForwardLayers.begin(); el--) {
358  if ( el == theForwardLayers.end() ) continue;
359  if ( (*el).second.isCompatible(forwardRange) ) {
360  float z = (*el).first->specificSurface().position().z();
361  if (fabs(z) > length) continue;
362  innerForward.insert(*el);
363  forwardRange = forwardRange.subtract((*el).second);
364 
365  }
366  }
367  el = theForwardLayers.begin();
368  if (el->second.isCompatible(forwardRange)) {
369  float z = (*el).first->specificSurface().position().z();
370  if (fabs(z) < length) innerForward.insert(*el);
371  }
372  }
373  }
374 
375  BarrelDetLayer* mbp = (*bl).first;
377  theMuonBarrelNLC.push_back(new MuonBarrelNavigableLayer(mbp,
378  outerBarrel,
379  innerBarrel,
380  outerBackward,
381  outerForward,
382  innerBackward,
383  innerForward,
384  allOuterBarrel,
385  allInnerBarrel,
386  allOuterBackward,
387  allOuterForward,
388  allInnerBackward,
389  allInnerForward));
390  }
392  BDLC outerBarrelLayers;
393  BDLC innerBarrelLayers;
394  BDLC allOuterBarrelLayers;
395  BDLC allInnerBarrelLayers;
396  FDLC outerBackwardLayers;
397  FDLC outerForwardLayers;
398  FDLC allOuterBackwardLayers;
399  FDLC allOuterForwardLayers;
400  FDLC innerBackwardLayers;
401  FDLC innerForwardLayers;
402  FDLC allInnerBackwardLayers;
403  FDLC allInnerForwardLayers;
404 
405  for (MapBI ib = outerBarrel.begin(); ib != outerBarrel.end(); ib++) {
406  BarrelDetLayer* ibdl = (*ib).first;
407  outerBarrelLayers.push_back(ibdl);
408  }
409 
410  for (MapBI ib = innerBarrel.begin(); ib != innerBarrel.end(); ib++) {
411  BarrelDetLayer* ibdl = (*ib).first;
412  innerBarrelLayers.push_back(ibdl);
413  }
414 
415  for (MapBI ib = allOuterBarrel.begin(); ib != allOuterBarrel.end(); ib++) {
416  BarrelDetLayer* ibdl = (*ib).first;
417  allOuterBarrelLayers.push_back(ibdl);
418  }
419 
420  for (MapBI ib = allInnerBarrel.begin(); ib != allInnerBarrel.end(); ib++) {
421  BarrelDetLayer* ibdl = (*ib).first;
422  allInnerBarrelLayers.push_back(ibdl);
423  }
424 
425  for (MapEI ie = outerBackward.begin(); ie != outerBackward.end(); ie++) {
426  ForwardDetLayer* ifdl = (*ie).first;
427  outerBackwardLayers.push_back(ifdl);
428  }
429 
430  for (MapEI ie = outerForward.begin(); ie != outerForward.end(); ie++) {
431  ForwardDetLayer* ifdl = (*ie).first;
432  outerForwardLayers.push_back(ifdl);
433  }
434 
435  for (MapEI ie = allOuterBackward.begin(); ie != allOuterBackward.end(); ie++) {
436  ForwardDetLayer* ifdl = (*ie).first;
437  allOuterBackwardLayers.push_back(ifdl);
438  }
439 
440  for (MapEI ie = allOuterForward.begin(); ie != allOuterForward.end(); ie++) {
441  ForwardDetLayer* ifdl = (*ie).first;
442  allOuterForwardLayers.push_back(ifdl);
443  }
444 
445  for (MapEI ie = innerBackward.begin(); ie != innerBackward.end(); ie++) {
446  ForwardDetLayer* ifdl = (*ie).first;
447  innerBackwardLayers.push_back(ifdl);
448  }
449 
450  for (MapEI ie = innerForward.begin(); ie != innerForward.end(); ie++) {
451  ForwardDetLayer* ifdl = (*ie).first;
452  innerForwardLayers.push_back(ifdl);
453  }
454 
455  for (MapEI ie = allInnerBackward.begin(); ie != allInnerBackward.end(); ie++) {
456  ForwardDetLayer* ifdl = (*ie).first;
457  allInnerBackwardLayers.push_back(ifdl);
458  }
459 
460  for (MapEI ie = allInnerForward.begin(); ie != allInnerForward.end(); ie++) {
461  ForwardDetLayer* ifdl = (*ie).first;
462  allInnerForwardLayers.push_back(ifdl);
463  }
464 
465  theTkBarrelNLC.push_back(new SimpleBarrelNavigableLayer(mbp,outerBarrelLayers,
466  innerBarrelLayers,
467  allOuterBarrelLayers,
468  allInnerBarrelLayers,
469  outerBackwardLayers,
470  outerForwardLayers,
471  allOuterBackwardLayers,
472  allOuterForwardLayers,
473  innerBackwardLayers,
474  innerForwardLayers,
475  allInnerBackwardLayers,
476  allInnerForwardLayers,
477  theMagneticField, 5.));
478 
479  }
480 
481  }
482 
483 }
std::vector< SimpleBarrelNavigableLayer * > theTkBarrelNLC
std::map< ForwardDetLayer *, MuonEtaRange, MuonDetLayerComp > MapE
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
const MagneticField * theMagneticField
MapB::const_iterator MapBI
std::vector< BarrelDetLayer * > BDLC
std::vector< MuonBarrelNavigableLayer * > theMuonBarrelNLC
double double double z
std::map< BarrelDetLayer *, MuonEtaRange, MuonDetLayerComp > MapB
MapE::const_iterator MapEI
float min() const
Definition: MuonEtaRange.h:26
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:45
std::vector< ForwardDetLayer * > FDLC
MuonEtaRange subtract(const MuonEtaRange &) const
create new range of size this minus range
Definition: MuonEtaRange.cc:67
float max() const
Definition: MuonEtaRange.h:27
void MuonTkNavigationSchool::linkEndcapLayers ( const MapE layers,
std::vector< MuonForwardNavigableLayer * > &  resultM,
std::vector< SimpleForwardNavigableLayer * > &  resultT 
)
private

link endcap layers

Definition at line 489 of file MuonTkNavigationSchool.cc.

References GeomDetEnumerators::CSC, i, MuonEtaRange::isInside(), j, gen::k, prof2calltree::l, m, MuonEtaRange::max(), MuonEtaRange::min(), GeomDetEnumerators::PixelEndcap, CosmicsPD_Skims::radius, GeomDetEnumerators::RPCEndcap, edm::second(), DetLayer::subDetector(), MuonEtaRange::subtract(), GeomDetEnumerators::TEC, theBarrelLayers, theMagneticField, GeomDetEnumerators::TID, and detailsBasic3DVector::z.

Referenced by MuonTkNavigationSchool().

491  {
492 
493  for (MapEI el = layers.begin(); el != layers.end(); el++) {
494 
495  MuonEtaRange range = (*el).second;
496  float z = (*el).first->specificSurface().position().z();
497  // first add next endcap layer (if compatible)
498  MapEI plusOne(el);
499  plusOne++;
500  MuonEtaRange tempR(range);
501  MuonEtaRange secondOR(range);
502  MapEI outerOne(plusOne);
503  bool outerDoubleCheck = false;
504  MapE outerELayers;
505  if ( plusOne != layers.end()) {
506  for ( MapEI l = plusOne; l != layers.end(); l++ ) {
507  if ( (*l).second.isCompatible(tempR)) {
508  outerELayers.insert(*l);
509  if ( tempR.isInside((*l).second) ) break;
510  if ((*l).second.isInside(tempR)) {
511  // split into 2 pieces
512  outerOne = l;
513  outerOne++;
514  if (tempR.max() > 0 ) {
515  secondOR = MuonEtaRange(tempR.max(),(*l).second.max());
516  tempR = MuonEtaRange((*l).second.min(),tempR.min());
517  }else {
518  secondOR = MuonEtaRange((*l).second.min(),tempR.min());
519  tempR = MuonEtaRange(tempR.max(),(*l).second.max());
520  }
521  outerDoubleCheck = true;
522  break;
523  }
524  tempR = tempR.subtract((*l).second);
525  } //if ( (*l).second.isCompatible(tempR))
526  }//for
527 
528  if (outerDoubleCheck) {
529  for ( MapEI l = outerOne; l != layers.end(); l++ ) {
530  if ( (*l).second.isCompatible(tempR)) {
531  outerELayers.insert(*l);
532  if ( tempR.isInside((*l).second) ) break;
533  tempR = tempR.subtract((*l).second);
534  } //if ( (*l).second.isCompatible(tempR))
535  }//for
536 
537  for ( MapEI l = outerOne; l != layers.end(); l++ ) {
538  if ( (*l).second.isCompatible(secondOR)) {
539  outerELayers.insert(*l);
540  if ( secondOR.isInside((*l).second) ) break;
541  secondOR = secondOR.subtract((*l).second);
542  } //if ( (*l).second.isCompatible(tempR))
543  }//for
544  }
545  }//if end
546 
547  MapE allOuterELayers;
548  for (MapEI iMEI = plusOne; iMEI!=layers.end(); iMEI++){
549  if ((*iMEI).second.isCompatible(range)) allOuterELayers.insert(*iMEI);
550  }
551  // to avoid overlap
552  int i = 0;
553  bool hasOverlap = false;
554  MapB outerBLayers;
555  MapB allOuterBLayers;
556  for (MapBI iMBI = theBarrelLayers.begin(); iMBI!=theBarrelLayers.end(); iMBI++){
557  if ((*iMBI).second.isCompatible(tempR)) {
558  float length = fabs((*iMBI).first->specificSurface().bounds().length()/2.);
559  if (length > fabs(z)) {
560  if ( (i==0) && (tempR.isInside((*iMBI).second)) ) hasOverlap = true;
561  i++;
562  outerBLayers.insert(*iMBI);
563  if (tempR.isInside((*iMBI).second)) break;
564  tempR = tempR.subtract((*iMBI).second);
565  }
566  }
567  }
568 
569  for (MapBI iMBI = theBarrelLayers.begin(); iMBI!=theBarrelLayers.end(); iMBI++){
570  float length = fabs((*iMBI).first->specificSurface().bounds().length()/2.);
571  if (length < fabs(z)) continue;
572  if ((*iMBI).second.isCompatible(range)) allOuterBLayers.insert(*iMBI);
573  }
574 
575  MapE innerELayers;
576  MapE allInnerELayers;
577  MapB innerBLayers;
578  MapB allInnerBLayers;
579  MuonEtaRange itempR(range);
580  bool checkFurther = true;
581  bool doubleCheck = false;
582  MuonEtaRange secondR;
583  float outRadius = 0;
584  MapEI minusOne(el);
585  if (el != layers.begin()) {
586  minusOne--;
587  outRadius = minusOne->first->specificSurface().outerRadius();
588  MapEI innerOne;
589  for (MapEI iMEI = minusOne; iMEI!=layers.begin(); iMEI--){
590  if ( (*iMEI).second.isCompatible(itempR) ) {
591  innerELayers.insert(*iMEI);
592 
593  if (itempR.isInside((*iMEI).second)) { checkFurther = false; break; }
594  if ((*iMEI).second.isInside(itempR)) {
595  // split into 2 pieces
596  doubleCheck = true;
597  innerOne = iMEI;
598  innerOne--;
599  if (itempR.max() > 0 ) {
600  secondR = MuonEtaRange(itempR.max(),(*iMEI).second.max());
601  itempR = MuonEtaRange((*iMEI).second.min(),itempR.min());
602  }else {
603  itempR = MuonEtaRange(itempR.max(),(*iMEI).second.max());
604  secondR = MuonEtaRange((*iMEI).second.min(),itempR.min());
605  }
606  break;
607  }
608  else itempR = itempR.subtract((*iMEI).second);
609  }//if ( (*iMEI).second.isCompatible(itempR) )
610  }//for MapEI
611  if (doubleCheck ) {
612 
613  for (MapEI iMEI = innerOne; iMEI!=layers.begin(); iMEI--){
614  if ( (*iMEI).second.isCompatible(itempR) ) {
615  innerELayers.insert(*iMEI);
616  if (itempR.isInside((*iMEI).second)) { checkFurther = false; break; }
617  else itempR = itempR.subtract((*iMEI).second);
618  }//if ( (*iMEI).second.isCompatible(itempR) )
619  }//for MapEI
620 
621  for (MapEI iMEI = innerOne; iMEI!=layers.begin(); iMEI--){
622  if ( (*iMEI).second.isCompatible(secondR) ) {
623  innerELayers.insert(*iMEI);
624  if (secondR.isInside((*iMEI).second)) { checkFurther = false; break; }
625  else secondR = secondR.subtract((*iMEI).second);
626  }//if ( (*iMEI).second.isCompatible(itempR) )
627  }//for MapEI
628  }// if doubleCheck
629 
630  if (checkFurther && (*layers.begin()).second.isCompatible(itempR)) {
631  innerELayers.insert(*layers.begin());
632  itempR = itempR.subtract((*layers.begin()).second);
633  }
634 
635  for (MapEI iMEI = minusOne; iMEI!=layers.begin(); iMEI--) {
636  if ((*iMEI).second.isCompatible(range)) allInnerELayers.insert(*iMEI);
637  }
638  if ((*layers.begin()).second.isCompatible(range)) allInnerELayers.insert(*layers.begin());
639  }
640 
641 
642  for (MapBI iMBI = theBarrelLayers.end(); iMBI!=theBarrelLayers.begin(); iMBI--) {
643  if (iMBI == theBarrelLayers.end()) continue;
644  float length = fabs((*iMBI).first->specificSurface().bounds().length()/2.);
645  if (length > fabs(z)) continue;
646  if ((*iMBI).second.isCompatible(range)) allInnerBLayers.insert(*iMBI);
647  }
648  if ((*theBarrelLayers.begin()).second.isCompatible(range)) allInnerBLayers.insert(*theBarrelLayers.begin());
649 
650  int k = 0;
651  bool hasOverlap2 = false;
652  bool hasInsideE = false;
653  for (MapBI iMBI = theBarrelLayers.end(); iMBI!=theBarrelLayers.begin(); iMBI--) {
654  if (iMBI == theBarrelLayers.end()) continue;
655  float length = fabs((*iMBI).first->specificSurface().bounds().length()/2.);
656  if (length > fabs(z)) continue;
657  float radius = (*iMBI).first->specificSurface().radius();
658 
659  bool compatible = false;
660  if (radius > outRadius) {
661  compatible = (*iMBI).second.isCompatible(range);
662  if (compatible && outRadius > 40) hasInsideE = true;//CL: no general rule
663  }
664  else compatible = (*iMBI).second.isCompatible(itempR);
665  if (!checkFurther && (radius < outRadius)) break;
666  if (compatible) {
667  if ((k==0) && (itempR.isInside((*iMBI).second)) && (radius < outRadius)) hasOverlap2 = true;
668  if (radius < outRadius) k++;
669  innerBLayers.insert(*iMBI);
670  if (itempR.isInside((*iMBI).second) && (radius < outRadius)) break;
671  itempR = itempR.subtract((*iMBI).second);
672  }
673  }
674 
675  if (el == layers.begin() && (*theBarrelLayers.begin()).second.isCompatible(itempR)) innerBLayers.insert(*theBarrelLayers.begin());
676 
677  ForwardDetLayer* mbp = (*el).first;
679  resultM.push_back(new MuonForwardNavigableLayer(mbp,
680  innerBLayers,
681  outerELayers,
682  innerELayers,
683  allInnerBLayers,
684  allOuterELayers,
685  allInnerELayers));
686  }
688  BDLC outerBarrelLayers;
689  FDLC outerForwardLayers;
690  BDLC allOuterBarrelLayers;
691  FDLC allOuterForwardLayers;
692  BDLC innerBarrelLayers;
693  FDLC innerForwardLayers;
694  BDLC allInnerBarrelLayers;
695  FDLC allInnerForwardLayers;
696 
697  unsigned int j = 0;
698  unsigned int l = 0;
699  unsigned int m = 0;
700 
701  for (MapBI ib = outerBLayers.begin(); ib != outerBLayers.end(); ib++) {
702  BarrelDetLayer* ibdl = (*ib).first;
703  outerBarrelLayers.push_back(ibdl);
704  }
705 
706  for (MapEI ie = outerELayers.begin(); ie != outerELayers.end(); ie++) {
707  j++;
708  if ( hasOverlap && j==outerELayers.size() ) break;
709  ForwardDetLayer* ifdl = (*ie).first;
710  outerForwardLayers.push_back(ifdl);
711  }
712 
713  for (MapBI ib = allOuterBLayers.begin(); ib != allOuterBLayers.end(); ib++) {
714  BarrelDetLayer* ibdl = (*ib).first;
715  allOuterBarrelLayers.push_back(ibdl);
716  }
717 
718  for (MapEI ie = allOuterELayers.begin(); ie != allOuterELayers.end(); ie++) {
719  ForwardDetLayer* ifdl = (*ie).first;
720  allOuterForwardLayers.push_back(ifdl);
721  }
722 
723  for (MapBI ib = innerBLayers.begin(); ib != innerBLayers.end(); ib++) {
724  l++;
725  if (hasOverlap2 && l==innerBLayers.size() ) continue;
726  BarrelDetLayer* ibdl = (*ib).first;
727  innerBarrelLayers.push_back(ibdl);
728  }
729 
730  for (MapEI ie = innerELayers.begin(); ie != innerELayers.end(); ie++) {
731  m++;
732  if (hasInsideE && m==innerELayers.size()-2 ) continue;
733  ForwardDetLayer* ifdl = (*ie).first;
734  innerForwardLayers.push_back(ifdl);
735  }
736 
737  for (MapBI ib = allInnerBLayers.begin(); ib != allInnerBLayers.end(); ib++) {
738  BarrelDetLayer* ibdl = (*ib).first;
739  allInnerBarrelLayers.push_back(ibdl);
740  }
741 
742  for (MapEI ie = allInnerELayers.begin(); ie != allInnerELayers.end(); ie++) {
743  ForwardDetLayer* ifdl = (*ie).first;
744  allInnerForwardLayers.push_back(ifdl);
745  }
746 
747  resultT.push_back(new SimpleForwardNavigableLayer(mbp,
748  outerBarrelLayers,
749  allOuterBarrelLayers,
750  innerBarrelLayers,
751  allInnerBarrelLayers,
752  outerForwardLayers,
753  allOuterForwardLayers,
754  innerForwardLayers,
755  allInnerForwardLayers,
756  theMagneticField, 5.));
757  }
758 
759  }
760 
761 }
int i
Definition: DBlmapReader.cc:9
std::map< ForwardDetLayer *, MuonEtaRange, MuonDetLayerComp > MapE
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
const MagneticField * theMagneticField
MapB::const_iterator MapBI
std::vector< BarrelDetLayer * > BDLC
double double double z
std::map< BarrelDetLayer *, MuonEtaRange, MuonDetLayerComp > MapB
U second(std::pair< T, U > const &p)
MapE::const_iterator MapEI
int j
Definition: DBlmapReader.cc:9
float min() const
Definition: MuonEtaRange.h:26
int k[5][pyjets_maxn]
bool isInside(float eta, float error=0.) const
Definition: MuonEtaRange.cc:45
std::vector< ForwardDetLayer * > FDLC
MuonEtaRange subtract(const MuonEtaRange &) const
create new range of size this minus range
Definition: MuonEtaRange.cc:67
float max() const
Definition: MuonEtaRange.h:27
vector< NavigableLayer * > MuonTkNavigationSchool::navigableLayers ( ) const
virtual

return a vector of NavigableLayer*, from base class

Implements NavigationSchool.

Definition at line 130 of file MuonTkNavigationSchool.cc.

References query::result, theMuonBackwardNLC, theMuonBarrelNLC, theMuonForwardNLC, theTkBackwardNLC, theTkBarrelNLC, and theTkForwardNLC.

130  {
131 
132  vector<NavigableLayer*> result;
133 
134  for ( vector< SimpleBarrelNavigableLayer*>::const_iterator
135  ib = theTkBarrelNLC.begin(); ib != theTkBarrelNLC.end(); ib++) {
136  result.push_back( *ib);
137  }
138  for ( vector< SimpleForwardNavigableLayer*>::const_iterator
139  ifl = theTkForwardNLC.begin(); ifl != theTkForwardNLC.end(); ifl++) {
140  result.push_back( *ifl);
141  }
142 
143  for ( vector< SimpleForwardNavigableLayer*>::const_iterator
144  ifl = theTkBackwardNLC.begin(); ifl != theTkBackwardNLC.end(); ifl++) {
145  result.push_back( *ifl);
146  }
147 
148  vector<MuonBarrelNavigableLayer*>::const_iterator ib;
149  vector<MuonForwardNavigableLayer*>::const_iterator ie;
150 
151  for ( ib = theMuonBarrelNLC.begin(); ib != theMuonBarrelNLC.end(); ib++ ) {
152  result.push_back(*ib);
153  }
154 
155  for ( ie = theMuonForwardNLC.begin(); ie != theMuonForwardNLC.end(); ie++ ) {
156  result.push_back(*ie);
157  }
158 
159  for ( ie = theMuonBackwardNLC.begin(); ie != theMuonBackwardNLC.end(); ie++ ) {
160  result.push_back(*ie);
161  }
162 
163  return result;
164 
165 }
std::vector< SimpleBarrelNavigableLayer * > theTkBarrelNLC
std::vector< SimpleForwardNavigableLayer * > theTkBackwardNLC
std::vector< MuonBarrelNavigableLayer * > theMuonBarrelNLC
std::vector< MuonForwardNavigableLayer * > theMuonBackwardNLC
std::vector< MuonForwardNavigableLayer * > theMuonForwardNLC
tuple result
Definition: query.py:137
std::vector< SimpleForwardNavigableLayer * > theTkForwardNLC

Member Data Documentation

MapE MuonTkNavigationSchool::theBackwardLayers
private
MapB MuonTkNavigationSchool::theBarrelLayers
private
MapE MuonTkNavigationSchool::theForwardLayers
private
const GeometricSearchTracker* MuonTkNavigationSchool::theGeometricSearchTracker
private

Definition at line 101 of file MuonTkNavigationSchool.h.

const MagneticField* MuonTkNavigationSchool::theMagneticField
private

Definition at line 102 of file MuonTkNavigationSchool.h.

Referenced by linkBarrelLayers(), and linkEndcapLayers().

std::vector<MuonForwardNavigableLayer*> MuonTkNavigationSchool::theMuonBackwardNLC
private
std::vector<MuonBarrelNavigableLayer*> MuonTkNavigationSchool::theMuonBarrelNLC
private
const MuonDetLayerGeometry* MuonTkNavigationSchool::theMuonDetLayerGeometry
private

Definition at line 100 of file MuonTkNavigationSchool.h.

std::vector<MuonForwardNavigableLayer*> MuonTkNavigationSchool::theMuonForwardNLC
private
std::vector<SimpleForwardNavigableLayer*> MuonTkNavigationSchool::theTkBackwardNLC
private
std::vector<SimpleBarrelNavigableLayer*> MuonTkNavigationSchool::theTkBarrelNLC
private
std::vector<SimpleForwardNavigableLayer*> MuonTkNavigationSchool::theTkForwardNLC
private