File indexing completed on 2023-03-17 10:41:58
0001 #ifndef PixelModuleNameOnline_h
0002 #define PixelModuleNameOnline_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <iosfwd>
0016 #include <string>
0017 #include <cassert>
0018 #include "CalibFormats/SiPixelObjects/interface/PixelROCName.h"
0019
0020 namespace pos {
0021
0022
0023
0024
0025
0026 class PixelModuleName {
0027 public:
0028 PixelModuleName();
0029
0030 explicit PixelModuleName(std::string rocname);
0031
0032 explicit PixelModuleName(PixelROCName roc);
0033
0034 explicit PixelModuleName(std::ifstream& s);
0035
0036 std::string modulename() const;
0037
0038 char detsub() const { return (id_ & 0x80000000) ? 'B' : 'F'; }
0039 char mp() const { return id_ & 0x40000000 ? 'p' : 'm'; }
0040 char IO() const { return id_ & 0x20000000 ? 'I' : 'O'; }
0041
0042
0043 int disk() const {
0044 assert((id_ & 0x80000000) == 0);
0045 return (id_ >> 8) & 0x3;
0046 }
0047 int blade() const {
0048 assert((id_ & 0x80000000) == 0);
0049 return (id_ >> 3) & 0x1f;
0050 }
0051 int panel() const {
0052 assert((id_ & 0x80000000) == 0);
0053 return ((id_ >> 2) & 0x1) + 1;
0054 }
0055
0056
0057 int sec() const {
0058 assert((id_ & 0x80000000) != 0);
0059 return ((id_ >> 10) & 0x7) + 1;
0060 }
0061 int layer() const {
0062 assert((id_ & 0x80000000) != 0);
0063 return (id_ >> 8) & 0x3;
0064 }
0065 int ladder() const {
0066 assert((id_ & 0x80000000) != 0);
0067 return (id_ >> 2) & 0x1f;
0068 }
0069 char HF() const {
0070 assert((id_ & 0x80000000) != 0);
0071 return id_ & 0x00000080 ? 'F' : 'H';
0072 }
0073 int module() const {
0074 assert((id_ & 0x80000000) != 0);
0075 return ((id_)&0x3) + 1;
0076 }
0077
0078 friend std::ostream& operator<<(std::ostream& s, const PixelModuleName& pixelroc);
0079
0080 const PixelModuleName& operator=(const PixelModuleName& aROC);
0081
0082 const bool operator<(const PixelModuleName& aROC) const { return id_ < aROC.id_; }
0083
0084 const bool operator==(const PixelModuleName& aModule) const { return id_ == aModule.id_; }
0085
0086 private:
0087 void parsename(std::string name);
0088
0089 void setIdFPix(char np, char LR, int disk, int blade, int panel);
0090
0091 void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module);
0092
0093 void check(bool check, const std::string& name);
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117 unsigned int id_;
0118 };
0119 std::ostream& operator<<(std::ostream& s, const PixelModuleName& pixelroc);
0120
0121 }
0122 #endif