00001 // Last commit: $Id: SiStripDetKey.h,v 1.7 2008/02/06 14:32:33 bainbrid 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 00010 class SiStripDetKey; 00011 00013 std::ostream& operator<< ( std::ostream&, const SiStripDetKey& ); 00014 00015 /* 00016 @class SiStripDetKey 00017 @author R.Bainbridge 00018 00019 @brief Utility class that identifies a position within the strip 00020 tracker geometrical structure, down to the level of an APV25 chip. 00021 00022 NOTA BENE: *** NOT FINISHED *** 00023 00024 can generate another key that is NOT DetId and packs 00025 sistrip-specific data in a more condensed way, so that all levels 00026 can be encoded with "all" and "invalid" values, down to level of 00027 apv. also, need "conversion tool" that re-generates DetId key from 00028 this new key. this is only way...!!! maybe can "safeguard" use of 00029 this key as a DetId by reserving bits 22-24 as a flag (eg, set all 00030 high), so that if an attempt to build DetId using SiStripDetId 00031 class, we can understand if key is real DetId or not... what about 00032 going to level of apv?... what about levels about module?... 00033 */ 00034 class SiStripDetKey : public SiStripKey { 00035 00036 public: 00037 00038 // ---------- Constructors ---------- 00039 00041 SiStripDetKey( const DetId& det_id, 00042 const uint16_t& apv_pair_number = 0, 00043 const uint16_t& apv_within_pair = 0 ); 00044 00046 SiStripDetKey( const SiStripDetId& det_id ); 00047 00049 SiStripDetKey( const uint32_t& det_key ); 00050 00052 SiStripDetKey( const std::string& directory_path ); 00053 00055 SiStripDetKey( const SiStripDetKey& ); 00056 00058 SiStripDetKey( const SiStripKey& ); 00059 00061 SiStripDetKey(); 00062 00063 // ---------- Public interface to member data ---------- 00064 00066 inline const uint16_t& apvPairNumber() const; 00067 00069 inline const uint16_t& apvWithinPair() const; 00070 00071 // ---------- Numbering schemes ---------- 00072 00073 //@@ nothing yet 00074 //@@ switch b/w det_id and det_key 00075 //@@ switch b/w strip, pair, apv, etc... 00076 00077 // ---------- Utility methods ---------- 00078 00080 bool isEqual( const SiStripKey& ) const; 00081 00083 bool isConsistent( const SiStripKey& ) const; 00084 00086 bool isValid() const; 00087 00090 bool isValid( const sistrip::Granularity& ) const; 00091 00093 bool isInvalid() const; 00094 00097 bool isInvalid( const sistrip::Granularity& ) const; 00098 00099 // ---------- Print methods ---------- 00100 00102 virtual void print( std::stringstream& ss ) const; 00103 00105 virtual void terse( std::stringstream& ss ) const {;} 00106 00107 private: 00108 00109 // ---------- Private methods ---------- 00110 00111 void initFromValue(); 00112 void initFromKey(); 00113 void initFromPath(); 00114 void initGranularity(); 00115 00116 // ---------- Private member data ---------- 00117 00119 uint16_t apvPairNumber_; 00120 00122 uint16_t apvWithinPair_; 00123 00124 // Definition of bit field positions for 32-bit key 00125 static const uint16_t tempOffset_ = 0; 00126 00127 // Definition of bit field masks for 32-bit key 00128 static const uint16_t tempMask_ = 0x00F; // (4 bits) 00129 00130 }; 00131 00132 // ---------- inline methods ---------- 00133 00134 const uint16_t& SiStripDetKey::apvPairNumber() const { return apvPairNumber_; } 00135 const uint16_t& SiStripDetKey::apvWithinPair() const { return apvWithinPair_; } 00136 00137 #endif // DataFormats_SiStripCommon_SiStripDetKey_h 00138