61 theMuonDetLayerGeometry(muonGeom), theGeometricSearchTracker(trackerGeom), theMagneticField(field) {
65 std::vector<DetLayer*> * allLayers =
new std::vector<DetLayer*>();
67 allLayers->insert(allLayers->end(), muonGeom->
allLayers().begin(), muonGeom->
allLayers().end());
68 allLayers->insert(allLayers->end(), trackerGeom->
allLayers().begin(), trackerGeom->
allLayers().end());
72 std::vector<BarrelDetLayer*> blc = trackerGeom->
barrelLayers();
73 for ( std::vector<BarrelDetLayer*>::const_iterator
i = blc.begin();
i != blc.end();
i++ ) {
78 std::vector<ForwardDetLayer*> flc = trackerGeom->
forwardLayers();
79 for (std::vector<ForwardDetLayer*>::const_iterator
i = flc.begin();
i != flc.end();
i++) {
85 for ( vector<DetLayer*>::const_iterator
i = barrel.begin();
i != barrel.end();
i++ ) {
87 if ( mbp == 0 )
throw Genexception(
"Bad BarrelDetLayer");
93 for ( vector<DetLayer*>::const_iterator
i = endcap.begin();
i != endcap.end();
i++ ) {
95 if ( mep == 0 )
throw Genexception(
"Bad ForwardDetLayer");
132 vector<NavigableLayer*>
result;
134 for ( vector< SimpleBarrelNavigableLayer*>::const_iterator
136 result.push_back( *ib);
138 for ( vector< SimpleForwardNavigableLayer*>::const_iterator
140 result.push_back( *ifl);
143 for ( vector< SimpleForwardNavigableLayer*>::const_iterator
145 result.push_back( *ifl);
148 vector<MuonBarrelNavigableLayer*>::const_iterator ib;
149 vector<MuonForwardNavigableLayer*>::const_iterator ie;
152 result.push_back(*ib);
156 result.push_back(*ie);
160 result.push_back(*ie);
177 float eta_min = -eta_max;
178 edm::LogInfo(
"MuonTkNavigationSchool")<<
"BarrelLayer eta: ("<<eta_min<<
", "<<eta_max<<
"). Radius "<<radius<<
", Length "<<length;
198 edm::LogInfo(
"MuonTkNavigationSchool")<<
"ForwardLayer eta: ("<<eta_min<<
", "<<eta_max<<
"). Radius ("<<inRadius<<
", "<<outRadius<<
"), Z "<<
z;
203 edm::LogInfo(
"MuonTkNavigationSchool")<<
"BackwardLayer eta: ("<<eta_min<<
", "<<eta_max<<
"). Radius ("<<inRadius<<
", "<<outRadius<<
"), Z "<<
z;
219 float length = fabs((*bl).first->specificSurface().bounds().length()/2.);
225 if ( plusOne !=
theBarrelLayers.end() ) { outerBarrel.insert(*plusOne); }
228 allOuterBarrel.insert(*iMBI);
231 MapE allOuterBackward;
234 if ( (*el).second.isCompatible(range) ) {
235 float z = (*el).first->specificSurface().position().z();
236 if (fabs(z) < length)
continue;
237 allOuterBackward.insert(*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);
254 MapE allOuterForward;
257 if ( (*el).second.isCompatible(range) ) {
258 float z = (*el).first->specificSurface().position().z();
259 if (fabs(z) < length)
continue;
260 allOuterForward.insert(*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);
280 MapE allInnerBackward;
282 MapE allInnerForward;
287 innerBarrel.insert(*minusOne);
290 allInnerBarrel.insert(*iMBI);
298 if ( (*el).second.isCompatible(range) ) {
299 float z = (*el).first->specificSurface().position().z();
300 if (fabs(z) > length)
continue;
301 allInnerBackward.insert(*el);
305 if (el->second.isCompatible(range)) {
306 float z = (*el).first->specificSurface().position().z();
307 if (fabs(z) < length) {
308 allInnerBackward.insert(*el);
316 if ( (*el).second.isCompatible(range) ) {
317 float z = (*el).first->specificSurface().position().z();
318 if (fabs(z) > length)
continue;
319 allInnerForward.insert(*el);
324 if (el->second.isCompatible(range)) {
325 float z = (*el).first->specificSurface().position().z();
326 if (fabs(z) < length) {
327 allInnerForward.insert(*el);
331 if ( !range.
isInside((*minusOne).second) ) {
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);
348 if (el->second.isCompatible(backwardRange)) {
349 float z = (*el).first->specificSurface().position().z();
350 if (fabs(z) < length) {
351 innerBackward.insert(*el);
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);
368 if (el->second.isCompatible(forwardRange)) {
369 float z = (*el).first->specificSurface().position().z();
370 if (fabs(z) < length) innerForward.insert(*el);
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;
405 for (
MapBI ib = outerBarrel.begin(); ib != outerBarrel.end(); ib++) {
407 outerBarrelLayers.push_back(ibdl);
410 for (
MapBI ib = innerBarrel.begin(); ib != innerBarrel.end(); ib++) {
412 innerBarrelLayers.push_back(ibdl);
415 for (
MapBI ib = allOuterBarrel.begin(); ib != allOuterBarrel.end(); ib++) {
417 allOuterBarrelLayers.push_back(ibdl);
420 for (
MapBI ib = allInnerBarrel.begin(); ib != allInnerBarrel.end(); ib++) {
422 allInnerBarrelLayers.push_back(ibdl);
425 for (
MapEI ie = outerBackward.begin(); ie != outerBackward.end(); ie++) {
427 outerBackwardLayers.push_back(ifdl);
430 for (
MapEI ie = outerForward.begin(); ie != outerForward.end(); ie++) {
432 outerForwardLayers.push_back(ifdl);
435 for (
MapEI ie = allOuterBackward.begin(); ie != allOuterBackward.end(); ie++) {
437 allOuterBackwardLayers.push_back(ifdl);
440 for (
MapEI ie = allOuterForward.begin(); ie != allOuterForward.end(); ie++) {
442 allOuterForwardLayers.push_back(ifdl);
445 for (
MapEI ie = innerBackward.begin(); ie != innerBackward.end(); ie++) {
447 innerBackwardLayers.push_back(ifdl);
450 for (
MapEI ie = innerForward.begin(); ie != innerForward.end(); ie++) {
452 innerForwardLayers.push_back(ifdl);
455 for (
MapEI ie = allInnerBackward.begin(); ie != allInnerBackward.end(); ie++) {
457 allInnerBackwardLayers.push_back(ifdl);
460 for (
MapEI ie = allInnerForward.begin(); ie != allInnerForward.end(); ie++) {
462 allInnerForwardLayers.push_back(ifdl);
467 allOuterBarrelLayers,
468 allInnerBarrelLayers,
471 allOuterBackwardLayers,
472 allOuterForwardLayers,
475 allInnerBackwardLayers,
476 allInnerForwardLayers,
490 std::vector<MuonForwardNavigableLayer*>& resultM,
491 std::vector<SimpleForwardNavigableLayer*>& resultT) {
493 for (
MapEI el = layers.begin(); el != layers.end(); el++) {
496 float z = (*el).first->specificSurface().position().z();
502 MapEI outerOne(plusOne);
503 bool outerDoubleCheck =
false;
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)) {
514 if (tempR.
max() > 0 ) {
521 outerDoubleCheck =
true;
524 tempR = tempR.
subtract((*l).second);
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);
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);
547 MapE allOuterELayers;
548 for (
MapEI iMEI = plusOne; iMEI!=layers.end(); iMEI++){
549 if ((*iMEI).second.isCompatible(range)) allOuterELayers.insert(*iMEI);
553 bool hasOverlap =
false;
555 MapB allOuterBLayers;
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;
562 outerBLayers.insert(*iMBI);
563 if (tempR.
isInside((*iMBI).second))
break;
564 tempR = tempR.
subtract((*iMBI).second);
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);
576 MapE allInnerELayers;
578 MapB allInnerBLayers;
580 bool checkFurther =
true;
581 bool doubleCheck =
false;
585 if (el != layers.begin()) {
587 outRadius = minusOne->first->specificSurface().outerRadius();
589 for (
MapEI iMEI = minusOne; iMEI!=layers.begin(); iMEI--){
590 if ( (*iMEI).second.isCompatible(itempR) ) {
591 innerELayers.insert(*iMEI);
593 if (itempR.
isInside((*iMEI).second)) { checkFurther =
false;
break; }
594 if ((*iMEI).second.isInside(itempR)) {
599 if (itempR.
max() > 0 ) {
608 else itempR = itempR.
subtract((*iMEI).second);
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);
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);
630 if (checkFurther && (*layers.begin()).
second.isCompatible(itempR)) {
631 innerELayers.insert(*layers.begin());
635 for (
MapEI iMEI = minusOne; iMEI!=layers.begin(); iMEI--) {
636 if ((*iMEI).second.isCompatible(range)) allInnerELayers.insert(*iMEI);
638 if ((*layers.begin()).
second.isCompatible(range)) allInnerELayers.insert(*layers.begin());
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);
651 bool hasOverlap2 =
false;
652 bool hasInsideE =
false;
655 float length = fabs((*iMBI).first->specificSurface().bounds().length()/2.);
656 if (length > fabs(z))
continue;
657 float radius = (*iMBI).first->specificSurface().radius();
659 bool compatible =
false;
660 if (radius > outRadius) {
661 compatible = (*iMBI).second.isCompatible(range);
662 if (compatible && outRadius > 40) hasInsideE =
true;
664 else compatible = (*iMBI).second.isCompatible(itempR);
665 if (!checkFurther && (radius < outRadius))
break;
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);
688 BDLC outerBarrelLayers;
689 FDLC outerForwardLayers;
690 BDLC allOuterBarrelLayers;
691 FDLC allOuterForwardLayers;
692 BDLC innerBarrelLayers;
693 FDLC innerForwardLayers;
694 BDLC allInnerBarrelLayers;
695 FDLC allInnerForwardLayers;
701 for (
MapBI ib = outerBLayers.begin(); ib != outerBLayers.end(); ib++) {
703 outerBarrelLayers.push_back(ibdl);
706 for (
MapEI ie = outerELayers.begin(); ie != outerELayers.end(); ie++) {
708 if ( hasOverlap && j==outerELayers.size() )
break;
710 outerForwardLayers.push_back(ifdl);
713 for (
MapBI ib = allOuterBLayers.begin(); ib != allOuterBLayers.end(); ib++) {
715 allOuterBarrelLayers.push_back(ibdl);
718 for (
MapEI ie = allOuterELayers.begin(); ie != allOuterELayers.end(); ie++) {
720 allOuterForwardLayers.push_back(ifdl);
723 for (
MapBI ib = innerBLayers.begin(); ib != innerBLayers.end(); ib++) {
725 if (hasOverlap2 && l==innerBLayers.size() )
continue;
727 innerBarrelLayers.push_back(ibdl);
730 for (
MapEI ie = innerELayers.begin(); ie != innerELayers.end(); ie++) {
732 if (hasInsideE && m==innerELayers.size()-2 )
continue;
734 innerForwardLayers.push_back(ifdl);
737 for (
MapBI ib = allInnerBLayers.begin(); ib != allInnerBLayers.end(); ib++) {
739 allInnerBarrelLayers.push_back(ibdl);
742 for (
MapEI ie = allInnerELayers.begin(); ie != allInnerELayers.end(); ie++) {
744 allInnerForwardLayers.push_back(ifdl);
749 allOuterBarrelLayers,
751 allInnerBarrelLayers,
753 allOuterForwardLayers,
755 allInnerForwardLayers,
772 length =
max(length,(*i).first->surface().bounds().length()/2.f);
785 if ( z > 0 )
return -
log((
tan(atan(r/z)/2.)));
786 return log(-(
tan(atan(r/z)/2.)));
std::vector< SimpleBarrelNavigableLayer * > theTkBarrelNLC
std::vector< SimpleForwardNavigableLayer * > theTkBackwardNLC
virtual float length() const =0
MuonTkNavigationSchool(const MuonDetLayerGeometry *, const GeometricSearchTracker *, const MagneticField *)
constructor
float barrelLength() const
calaulate the length of the barrel
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)
std::vector< DetLayer * > LayerContainer
const MagneticField * theMagneticField
MapB::const_iterator MapBI
std::vector< BarrelDetLayer * > BDLC
std::vector< MuonBarrelNavigableLayer * > theMuonBarrelNLC
std::vector< MuonForwardNavigableLayer * > theMuonBackwardNLC
std::vector< MuonForwardNavigableLayer * > theMuonForwardNLC
std::map< BarrelDetLayer *, MuonEtaRange, MuonDetLayerComp > MapB
U second(std::pair< T, U > const &p)
std::vector< BarrelDetLayer * > const & barrelLayers() const
~MuonTkNavigationSchool()
destructor
MapE::const_iterator MapEI
Scalar radius() const
Radius of the cylinder.
const T & max(const T &a, const T &b)
virtual const BoundDisk & specificSurface() const
Tan< T >::type tan(const T &t)
const std::vector< DetLayer * > & allEndcapLayers() const
return all endcap DetLayers (CSC+RPC), -Z to +Z
std::vector< DetLayer * > const & allLayers() const
const Bounds & bounds() const
bool isInside(float eta, float error=0.) const
virtual std::vector< NavigableLayer * > navigableLayers() const
return a vector of NavigableLayer*, from base class
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
const std::vector< DetLayer * > & allLayers() const
return all layers (DT+CSC+RPC), order: backward, barrel, forward
std::vector< ForwardDetLayer * > FDLC
float outerRadius() const
The outer radius of the disk.
void linkEndcapLayers(const MapE &, std::vector< MuonForwardNavigableLayer * > &, std::vector< SimpleForwardNavigableLayer * > &)
link endcap layers
void addEndcapLayer(ForwardDetLayer *)
add endcap layer (backward and forward)
float innerRadius() const
The inner radius of the disk.
MuonEtaRange subtract(const MuonEtaRange &) const
create new range of size this minus range
const std::vector< DetLayer * > * theAllDetLayersInSystem
std::vector< ForwardDetLayer * > const & forwardLayers() const
void linkBarrelLayers()
link barrel layers
std::vector< SimpleForwardNavigableLayer * > theTkForwardNLC
const PositionType & position() const
float calculateEta(float r, float z) const
pseudorapidity from r and z
const std::vector< DetLayer * > & allBarrelLayers() const
return all barrel DetLayers (DT+RPC), inside-out
void addBarrelLayer(BarrelDetLayer *)
add barrel layer