![]() |
|
|||
File indexing completed on 2024-04-06 12:05:13
0001 0002 #ifndef DataFormats_SiStripCommon_SiStripFedKey_H 0003 #define DataFormats_SiStripCommon_SiStripFedKey_H 0004 0005 #include "DataFormats/SiStripCommon/interface/ConstantsForGranularity.h" 0006 #include "DataFormats/SiStripCommon/interface/SiStripKey.h" 0007 0008 class SiStripFedKey; 0009 0010 /** Debug info for SiStripFedKey class. */ 0011 std::ostream& operator<<(std::ostream&, const SiStripFedKey&); 0012 0013 /** 0014 @class SiStripFedKey 0015 @author R.Bainbridge 0016 0017 @brief Utility class that identifies a position within the strip 0018 tracker readout structure, down to the level of an APV25 chip. 0019 0020 The class allows to encode the position within a 32-bit "key" and, 0021 conversely, unpack a 32-bit key to provide the position. 0022 0023 The class provides the following member data: 0024 - FED key (32 bits), 0025 - FED id, 0026 - Front-End unit ("external" numbering scheme), 0027 - channel within a Front-End unit ("external" numbering scheme), 0028 - APV number within a channel (or, equivalently, an APV pair). 0029 - directory path, 0030 - "granularity". 0031 0032 Member data (integer in type only) with values of 0xFFFF signifies 0033 "invalid" (ie, FedId = 0xFFFF means "invalid FED id"). Data with 0034 null values signifies "all" (ie, FedId = 0 means "all FEDs"). 0035 0036 The class generates a "directory path" string according to the 0037 member data. This can be used to organise histograms / other data 0038 types when using DQM / root. Conversely, the member data can also 0039 be built using the directory path when provided as a constructor 0040 argument. 0041 0042 The class also provides the "granularity" to which the FED key is 0043 unambiguous (ie, not "invalid" or "null") in defining a position 0044 within the readout system. 0045 0046 In addition, the class provides static methods that allow to 0047 convert between the two "FED channel" numbering schema in 0048 place. The class member data hold values that respect the 0049 "external" numbering scheme used by the optical links 0050 group. Front-End units are numbered from 1 to 8, bottom to 0051 top. Channels with the FE units are numbered 1 to 12, bottom to 0052 top. The "internal" numbering scheme is used by the DAQ software, 0053 which numbers FED channels consecutively from 0 to 95, top to 0054 bottom. 0055 */ 0056 class SiStripFedKey : public SiStripKey { 0057 public: 0058 // ---------- Constructors ---------- 0059 0060 /** Constructor using FED id, FE unit, FE channel, and APV. */ 0061 SiStripFedKey(const uint16_t& fed_id, 0062 const uint16_t& fe_unit = 0, 0063 const uint16_t& fe_chan = 0, 0064 const uint16_t& fed_apv = 0); 0065 0066 /** Constructor using 32-bit "FED key". */ 0067 SiStripFedKey(const uint32_t& fed_key); 0068 0069 /** Constructor using directory path. */ 0070 SiStripFedKey(const std::string& directory_path); 0071 0072 /** Copy constructor. */ 0073 SiStripFedKey(const SiStripFedKey&); 0074 0075 /** Copy constructor using base class. */ 0076 SiStripFedKey(const SiStripKey&); 0077 0078 /** Default constructor */ 0079 SiStripFedKey(); 0080 0081 /** Assignment operator */ 0082 SiStripFedKey& operator=(const SiStripFedKey&) = default; 0083 0084 // ---------- Public interface to member data ---------- 0085 0086 /** Returns FED id. */ 0087 inline const uint16_t& fedId() const; 0088 0089 /** Returns Front-End unit (according to "external" numbering). */ 0090 inline const uint16_t& feUnit() const; 0091 0092 /** Returns chan of FE unit (according to "external" numbering). */ 0093 inline const uint16_t& feChan() const; 0094 0095 /** Returns APV within FED channel. */ 0096 inline const uint16_t& fedApv() const; 0097 0098 /** Returns FED channel (according to "internal" numbering). */ 0099 inline uint16_t fedChannel() const; 0100 0101 // ---------- Numbering schemes ---------- 0102 0103 /** Returns FED channel ("internal" numbering scheme) for given 0104 Front-End unit and channel ("external" numbering scheme). */ 0105 static uint16_t fedCh(const uint16_t& fe_unit, const uint16_t& fe_chan); 0106 0107 /** Returns Front-End unit ("external" numbering scheme) for given 0108 FED channel ("internal" numbering scheme). */ 0109 static uint16_t feUnit(const uint16_t& fed_ch); 0110 0111 /** Returns Front-End channel ("external" numbering scheme) for 0112 given FED channel ("internal" numbering scheme). */ 0113 static uint16_t feChan(const uint16_t& fed_ch); 0114 0115 /** Returns number that encodes FED id and FED channel, which can be 0116 used to index vectors containing event and non-event data. Users 0117 should check if returned value is valid for indexing vector! */ 0118 static uint32_t fedIndex(const uint16_t& fed_id, const uint16_t& fed_ch); 0119 0120 // ---------- Utility methods ---------- 0121 0122 /** Identifies key objects with identical member data. */ 0123 bool isEqual(const SiStripKey&) const override; 0124 0125 /** "Consistent" means identical and/or null (ie, "all") data. */ 0126 bool isConsistent(const SiStripKey&) const override; 0127 0128 /** Identifies all member data as being "valid" or null ("all"). */ 0129 bool isValid() const override; 0130 0131 /** All member data to level of "Granularity" are valid. If 0132 sistrip::Granularity is "undefined", returns false. */ 0133 bool isValid(const sistrip::Granularity&) const override; 0134 0135 /** Identifies all member data as being invalid. */ 0136 bool isInvalid() const override; 0137 0138 /** All member data to level of "Granularity" are invalid. If 0139 sistrip::Granularity is "undefined", returns true. */ 0140 bool isInvalid(const sistrip::Granularity&) const override; 0141 0142 // ---------- Print methods ---------- 0143 0144 /** Print member data of the key */ 0145 void print(std::stringstream& ss) const override; 0146 0147 /** A terse summary of the key */ 0148 void terse(std::stringstream& ss) const override; 0149 0150 private: 0151 // ---------- Private methods ---------- 0152 0153 void initFromValue() override; 0154 void initFromKey() override; 0155 void initFromPath() override; 0156 void initGranularity() override; 0157 0158 // ---------- Private member data ---------- 0159 0160 /** FED id [0,50-489,invalid]. */ 0161 uint16_t fedId_; 0162 0163 /** FE unit [0,1-8,invalid]. */ 0164 uint16_t feUnit_; 0165 0166 /** FE channel [0,1-12,invalid]. */ 0167 uint16_t feChan_; 0168 0169 /** APV [0,1-2,invalid]. */ 0170 uint16_t fedApv_; 0171 0172 // Definition of bit field positions for 32-bit key 0173 static const uint16_t fedCrateOffset_ = 24; 0174 static const uint16_t fedSlotOffset_ = 19; 0175 static const uint16_t fedIdOffset_ = 10; 0176 static const uint16_t feUnitOffset_ = 6; 0177 static const uint16_t feChanOffset_ = 2; 0178 static const uint16_t fedApvOffset_ = 0; 0179 0180 // Definition of bit field masks for 32-bit key 0181 static const uint16_t fedCrateMask_ = 0x03F; // (6 bits) 0182 static const uint16_t fedSlotMask_ = 0x01F; // (5 bits) 0183 static const uint16_t fedIdMask_ = 0x1FF; // (9 bits) 0184 static const uint16_t feUnitMask_ = 0x00F; // (4 bits) 0185 static const uint16_t feChanMask_ = 0x00F; // (4 bits) 0186 static const uint16_t fedApvMask_ = 0x003; // (2 bits) 0187 }; 0188 0189 // ---------- Inline methods ---------- 0190 0191 const uint16_t& SiStripFedKey::fedId() const { return fedId_; } 0192 const uint16_t& SiStripFedKey::feUnit() const { return feUnit_; } 0193 const uint16_t& SiStripFedKey::feChan() const { return feChan_; } 0194 const uint16_t& SiStripFedKey::fedApv() const { return fedApv_; } 0195 uint16_t SiStripFedKey::fedChannel() const { return fedCh(feUnit_, feChan_); } 0196 0197 #endif // DataFormats_SiStripCommon_SiStripFedKey_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |