00001 #include "Geometry/TrackerGeometryBuilder/interface/GeomDetLess.h" 00002 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" 00003 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" 00004 #include "FWCore/Utilities/interface/Exception.h" 00005 00006 bool GeomDetLess::insideOutLess( const GeomDet* a, const GeomDet* b) const 00007 { 00008 if (a == b) return false; 00009 00010 DetId ida(a->geographicalId()); 00011 DetId idb(b->geographicalId()); 00012 00013 if ( (ida.subdetId() == StripSubdetector::TIB || ida.subdetId() == StripSubdetector::TOB || ida.subdetId() == PixelSubdetector::PixelBarrel) && 00014 (idb.subdetId() == StripSubdetector::TIB || idb.subdetId() == StripSubdetector::TOB || idb.subdetId() == PixelSubdetector::PixelBarrel)) { // barrel with barrel 00015 return a->surface().position().perp() < b->surface().position().perp(); 00016 } 00017 00018 if ( (ida.subdetId() == StripSubdetector::TEC || ida.subdetId() == StripSubdetector::TID || ida.subdetId() == PixelSubdetector::PixelEndcap) && 00019 (idb.subdetId() == StripSubdetector::TEC || idb.subdetId() == StripSubdetector::TID || idb.subdetId() == PixelSubdetector::PixelEndcap)) { // fwd with fwd 00020 return std::abs(a->surface().position().z()) < std::abs(b->surface().position().z()); 00021 } 00022 00023 // 00024 // here I have 1 barrel against one forward 00025 // 00026 00027 if ( (ida.subdetId() == StripSubdetector::TIB || ida.subdetId() == StripSubdetector::TOB || ida.subdetId() == PixelSubdetector::PixelBarrel) && 00028 (idb.subdetId() == StripSubdetector::TEC || idb.subdetId() == StripSubdetector::TID || idb.subdetId() == PixelSubdetector::PixelEndcap)) { // barrel with barrel 00029 return barrelForwardLess( a, b); 00030 }else{ 00031 return !barrelForwardLess( b, a); 00032 } 00033 00034 throw cms::Exception("GeomDetLess") << "GeomDetLess: arguments are not Ok"; 00035 00036 } 00037 00038 bool GeomDetLess::barrelForwardLess( const GeomDet* bla, 00039 const GeomDet* flb) const 00040 { 00041 return std::abs(bla->surface().position().z()) < std::abs( flb->position().z()); 00042 } 00043 00044