CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/Geometry/TrackerGeometryBuilder/src/GeomDetLess.cc

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