CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DataFormats/SiStripCommon/interface/SiStripDetKey.h

Go to the documentation of this file.
00001 // Last commit: $Id: SiStripDetKey.h,v 1.8 2009/07/31 09:53:47 lowette Exp $
00002 
00003 #ifndef DataFormats_SiStripCommon_SiStripDetKey_h
00004 #define DataFormats_SiStripCommon_SiStripDetKey_h
00005 
00006 #include "DataFormats/SiStripCommon/interface/ConstantsForGranularity.h"
00007 #include "DataFormats/SiStripCommon/interface/SiStripKey.h"
00008 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
00009 
00029 class SiStripDetKey : public SiStripKey {
00030   
00031  public:
00032 
00033   // ---------- Constructors ----------
00034 
00036   SiStripDetKey( const uint16_t& partition );
00037 
00039   SiStripDetKey( const DetId& det_id,
00040                  const uint16_t& apv_pair_number = 0,
00041                  const uint16_t& apv_within_pair = 0 );
00042   
00044   SiStripDetKey( const SiStripDetId& det_id );
00045   
00047   SiStripDetKey( const uint32_t& det_key );
00048   
00050   SiStripDetKey( const std::string& directory_path );
00051 
00053   SiStripDetKey( const SiStripDetKey& );
00054 
00056   SiStripDetKey( const SiStripKey& );
00057   
00059   SiStripDetKey( const SiStripKey&,
00060                  const sistrip::Granularity& );
00061 
00063   SiStripDetKey();
00064   
00065   // ---------- Public interface to member data ----------
00066   
00068   inline const uint16_t& partition() const;
00069   
00071   inline const uint16_t& apvPairNumber() const;
00072   
00074   inline const uint16_t& apvWithinPair() const;
00075   
00076   // ---------- Numbering schemes ---------- 
00077   
00078   //@@ nothing yet
00079   //@@ switch b/w det_id and det_key
00080   //@@ switch b/w strip, pair, apv, etc...
00081 
00082   // ---------- Utility methods ---------- 
00083 
00085   bool isEqual( const SiStripKey& ) const;
00086   
00088   bool isConsistent( const SiStripKey& ) const;
00089   
00091   bool isValid() const;
00092   
00095   bool isValid( const sistrip::Granularity& ) const;
00096   
00098   bool isInvalid() const;
00099   
00102   bool isInvalid( const sistrip::Granularity& ) const;
00103 
00104   // ---------- Print methods ----------
00105   
00107   virtual void print( std::stringstream& ss ) const;
00108   
00110   virtual void terse( std::stringstream& ss ) const;
00111   
00112  private: 
00113 
00114   // ---------- Private methods ----------
00115 
00116   void initFromValue();
00117   void initFromKey();
00118   void initFromPath();
00119   void initGranularity();
00120   
00121   // ---------- Private member data ----------
00122 
00124   uint16_t partition_;
00125 
00127   uint16_t apvPairNumber_;
00128 
00130   uint16_t apvWithinPair_; 
00131   
00132   // Definition of bit field positions for 32-bit key 
00133   static const uint16_t partitionOffset_ = 29;
00134 
00135   // Definition of bit field masks for 32-bit key 
00136   static const uint16_t partitionMask_ = 0x07; // (3 bits)
00137   
00138 };
00139 
00140 // ---------- inline methods ----------
00141 
00142 const uint16_t& SiStripDetKey::partition() const { return partition_; }
00143 const uint16_t& SiStripDetKey::apvPairNumber() const { return apvPairNumber_; }
00144 const uint16_t& SiStripDetKey::apvWithinPair() const { return apvWithinPair_; }
00145 
00147 std::ostream& operator<< ( std::ostream&, const SiStripDetKey& );
00148 
00149 inline bool operator< ( const SiStripDetKey& a, const SiStripDetKey& b ) { return ( a.key() < b.key() ); }
00150 
00151 
00152 #endif // DataFormats_SiStripCommon_SiStripDetKey_h