![]() |
|
|||
File indexing completed on 2023-03-17 10:51:21
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 // ---------- Public interface to member data ---------- 0082 0083 /** Returns FED id. */ 0084 inline const uint16_t& fedId() const; 0085 0086 /** Returns Front-End unit (according to "external" numbering). */ 0087 inline const uint16_t& feUnit() const; 0088 0089 /** Returns chan of FE unit (according to "external" numbering). */ 0090 inline const uint16_t& feChan() const; 0091 0092 /** Returns APV within FED channel. */ 0093 inline const uint16_t& fedApv() const; 0094 0095 /** Returns FED channel (according to "internal" numbering). */ 0096 inline uint16_t fedChannel() const; 0097 0098 // ---------- Numbering schemes ---------- 0099 0100 /** Returns FED channel ("internal" numbering scheme) for given 0101 Front-End unit and channel ("external" numbering scheme). */ 0102 static uint16_t fedCh(const uint16_t& fe_unit, const uint16_t& fe_chan); 0103 0104 /** Returns Front-End unit ("external" numbering scheme) for given 0105 FED channel ("internal" numbering scheme). */ 0106 static uint16_t feUnit(const uint16_t& fed_ch); 0107 0108 /** Returns Front-End channel ("external" numbering scheme) for 0109 given FED channel ("internal" numbering scheme). */ 0110 static uint16_t feChan(const uint16_t& fed_ch); 0111 0112 /** Returns number that encodes FED id and FED channel, which can be 0113 used to index vectors containing event and non-event data. Users 0114 should check if returned value is valid for indexing vector! */ 0115 static uint32_t fedIndex(const uint16_t& fed_id, const uint16_t& fed_ch); 0116 0117 // ---------- Utility methods ---------- 0118 0119 /** Identifies key objects with identical member data. */ 0120 bool isEqual(const SiStripKey&) const override; 0121 0122 /** "Consistent" means identical and/or null (ie, "all") data. */ 0123 bool isConsistent(const SiStripKey&) const override; 0124 0125 /** Identifies all member data as being "valid" or null ("all"). */ 0126 bool isValid() const override; 0127 0128 /** All member data to level of "Granularity" are valid. If 0129 sistrip::Granularity is "undefined", returns false. */ 0130 bool isValid(const sistrip::Granularity&) const override; 0131 0132 /** Identifies all member data as being invalid. */ 0133 bool isInvalid() const override; 0134 0135 /** All member data to level of "Granularity" are invalid. If 0136 sistrip::Granularity is "undefined", returns true. */ 0137 bool isInvalid(const sistrip::Granularity&) const override; 0138 0139 // ---------- Print methods ---------- 0140 0141 /** Print member data of the key */ 0142 void print(std::stringstream& ss) const override; 0143 0144 /** A terse summary of the key */ 0145 void terse(std::stringstream& ss) const override; 0146 0147 private: 0148 // ---------- Private methods ---------- 0149 0150 void initFromValue() override; 0151 void initFromKey() override; 0152 void initFromPath() override; 0153 void initGranularity() override; 0154 0155 // ---------- Private member data ---------- 0156 0157 /** FED id [0,50-489,invalid]. */ 0158 uint16_t fedId_; 0159 0160 /** FE unit [0,1-8,invalid]. */ 0161 uint16_t feUnit_; 0162 0163 /** FE channel [0,1-12,invalid]. */ 0164 uint16_t feChan_; 0165 0166 /** APV [0,1-2,invalid]. */ 0167 uint16_t fedApv_; 0168 0169 // Definition of bit field positions for 32-bit key 0170 static const uint16_t fedCrateOffset_ = 24; 0171 static const uint16_t fedSlotOffset_ = 19; 0172 static const uint16_t fedIdOffset_ = 10; 0173 static const uint16_t feUnitOffset_ = 6; 0174 static const uint16_t feChanOffset_ = 2; 0175 static const uint16_t fedApvOffset_ = 0; 0176 0177 // Definition of bit field masks for 32-bit key 0178 static const uint16_t fedCrateMask_ = 0x03F; // (6 bits) 0179 static const uint16_t fedSlotMask_ = 0x01F; // (5 bits) 0180 static const uint16_t fedIdMask_ = 0x1FF; // (9 bits) 0181 static const uint16_t feUnitMask_ = 0x00F; // (4 bits) 0182 static const uint16_t feChanMask_ = 0x00F; // (4 bits) 0183 static const uint16_t fedApvMask_ = 0x003; // (2 bits) 0184 }; 0185 0186 // ---------- Inline methods ---------- 0187 0188 const uint16_t& SiStripFedKey::fedId() const { return fedId_; } 0189 const uint16_t& SiStripFedKey::feUnit() const { return feUnit_; } 0190 const uint16_t& SiStripFedKey::feChan() const { return feChan_; } 0191 const uint16_t& SiStripFedKey::fedApv() const { return fedApv_; } 0192 uint16_t SiStripFedKey::fedChannel() const { return fedCh(feUnit_, feChan_); } 0193 0194 #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 |
![]() ![]() |