CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/Geometry/TrackerGeometryBuilder/interface/TrackerLayerIdAccessor.h

Go to the documentation of this file.
00001 #ifndef TRACKERLAYERIDACCESSOR_H
00002 #define TRACKERLAYERIDACCESSOR_H
00003 
00004 
00005 #include "DataFormats/SiStripDetId/interface/SiStripSubStructure.h"
00006 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00007 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00008 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00009 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00010 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00011 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00012 #include "DataFormats/DetId/interface/DetId.h"
00013 
00014 #include<ext/functional>
00015 
00016 
00017 //class DetIdComparator : public binary_function<DetId, DetId, bool> {
00018 class DetIdComparator {
00019 public:
00020   bool operator()( DetId i1, DetId i2 ) const {
00021     return (*this)(i1.rawId(),i2.rawId());
00022   };
00023   virtual bool operator()(uint32_t  i1, uint32_t  i2 ) const =0;
00024 };
00025 
00026 class DetIdTIBSameLayerComparator : public  DetIdComparator {
00027  public:
00028   virtual bool operator()(uint32_t i1,uint32_t i2 ) const {
00029     TIBDetId id1(i1);
00030     TIBDetId id2(i2);
00031     if ((id1.det() == id2.det()) &&
00032         (id1.subdetId() == id2.subdetId()) &&
00033         (id1.layer() == id2.layer())) return false;
00034     return (id1<id2);
00035   }
00036 };
00037 class DetIdTOBSameLayerComparator : public  DetIdComparator {
00038  public:
00039   virtual bool operator()(uint32_t i1,uint32_t i2 ) const {
00040     TOBDetId id1(i1);
00041     TOBDetId id2(i2);
00042     if ((id1.det() == id2.det()) &&
00043         (id1.subdetId() == id2.subdetId()) &&
00044         (id1.layer() == id2.layer())) return false;
00045     return (id1<id2);
00046   }
00047 };
00048 class DetIdPXBSameLayerComparator : public  DetIdComparator {
00049  public:
00050   virtual bool operator()(uint32_t i1,uint32_t i2 ) const {
00051     PXBDetId id1(i1);
00052     PXBDetId id2(i2);
00053     if ((id1.det() == id2.det()) &&
00054         (id1.subdetId() == id2.subdetId()) &&
00055         (id1.layer() == id2.layer())) return false;
00056     return (id1<id2);
00057   }
00058 };
00059 class DetIdPXFSameDiskComparator : public  DetIdComparator {
00060  public:
00061   virtual bool operator()(uint32_t i1,uint32_t i2 ) const {
00062     PXFDetId id1(i1);
00063     PXFDetId id2(i2);
00064     if ((id1.det() == id2.det()) &&
00065         (id1.subdetId() == id2.subdetId()) &&
00066         (id1.side() == id2.side()) &&
00067         (id1.disk() == id2.disk())) return false;
00068     return (id1<id2);
00069   }
00070 };
00071 class DetIdTECSameDiskComparator : public  DetIdComparator {
00072  public:
00073   virtual bool operator()(uint32_t i1,uint32_t i2 ) const {
00074     TECDetId id1(i1);
00075     TECDetId id2(i2);
00076     if ((id1.det() == id2.det()) &&
00077         (id1.subdetId() == id2.subdetId()) &&
00078         (id1.side() == id2.side()) &&
00079         (id1.wheel() == id2.wheel())) return false;
00080     return (id1<id2);
00081   }
00082 };
00083 class DetIdTIDSameDiskComparator : public  DetIdComparator {
00084  public:
00085   virtual bool operator()(uint32_t i1,uint32_t i2 ) const {
00086     TIDDetId id1(i1);
00087     TIDDetId id2(i2);
00088     if ((id1.det() == id2.det()) &&
00089         (id1.subdetId() == id2.subdetId()) &&
00090         (id1.side() == id2.side()) &&
00091         (id1.wheel() == id2.wheel())) return false;
00092     return (id1<id2);
00093   }
00094 };
00095 
00096 
00097 class TrackerLayerIdAccessor {
00098  public:
00099   //
00100   // returns a valid DetId + a valid comaprator for the RangeMap
00101   //
00102   typedef std::pair<DetId,DetIdComparator&> returnType;
00103   TrackerLayerIdAccessor();
00104   std::pair<DetId,DetIdPXBSameLayerComparator>  pixelBarrelLayer(int layer);
00105   std::pair<DetId,DetIdPXFSameDiskComparator>  pixelForwardDisk(int side,int disk);
00106   std::pair<DetId,DetIdTIBSameLayerComparator>  stripTIBLayer(int layer);
00107   std::pair<DetId,DetIdTOBSameLayerComparator> stripTOBLayer(int layer);
00108   std::pair<DetId,DetIdTECSameDiskComparator>  stripTECDisk(int side,int disk);
00109   std::pair<DetId,DetIdTIDSameDiskComparator>  stripTIDDisk(int side,int disk);
00110   
00111  private:
00112   
00113 };
00114 
00115 #endif
00116