CMS 3D CMS Logo

SiStripKey.h
Go to the documentation of this file.
1 
2 #ifndef DataFormats_SiStripCommon_SiStripKey_H
3 #define DataFormats_SiStripCommon_SiStripKey_H
4 
6 #include <ostream>
7 #include <sstream>
8 #include <string>
9 #include <cstdint>
10 
11 class SiStripKey;
12 
14 std::ostream& operator<<(std::ostream&, const SiStripKey&);
15 
23 class SiStripKey {
24 public:
25  // ---------- Constructors ----------
26 
28  SiStripKey(const uint32_t& key);
29 
31  SiStripKey(const std::string& directory_path);
32 
34  SiStripKey(const SiStripKey&);
35 
37  const SiStripKey& operator=(const SiStripKey&);
38 
40  SiStripKey();
41 
43  virtual ~SiStripKey() { ; }
44 
45  // ---------- Public interface to member data ----------
46 
48  inline const uint32_t& key() const;
49 
51  inline const std::string& path() const;
52 
54  inline const sistrip::Granularity& granularity() const;
55 
57  inline const uint16_t& channel() const;
58 
59  // ---------- Virtual utility methods ----------
60 
62  virtual bool isEqual(const SiStripKey&) const;
63 
65  virtual bool isConsistent(const SiStripKey&) const;
66 
68  virtual bool isValid() const;
69 
72  virtual bool isValid(const sistrip::Granularity&) const;
73 
75  virtual bool isInvalid() const;
76 
79  virtual bool isInvalid(const sistrip::Granularity&) const;
80 
81  // ---------- Print methods ----------
82 
84  virtual void print(std::stringstream& ss) const;
85 
87  virtual void terse(std::stringstream& ss) const { ; }
88 
89 protected:
90  // ---------- Protected methods ----------
91 
92  virtual void initFromValue() { ; }
93  virtual void initFromKey() { ; }
94  virtual void initFromPath() { ; }
95  virtual void initGranularity() { ; }
96 
97  inline void key(const uint32_t&);
98  inline void path(const std::string&);
99  inline void granularity(const sistrip::Granularity&);
100  inline void channel(const uint16_t&);
101 
102 private:
103  // ---------- Private member data ----------
104 
106  uint32_t key_;
107 
110 
113 
115  uint16_t channel_;
116 };
117 
118 // ---------- Inline methods ----------
119 
120 const uint32_t& SiStripKey::key() const { return key_; }
121 const std::string& SiStripKey::path() const { return path_; }
123 const uint16_t& SiStripKey::channel() const { return channel_; }
124 
125 void SiStripKey::key(const uint32_t& key) { key_ = key; }
128 void SiStripKey::channel(const uint16_t& chan) { channel_ = chan; }
129 
130 #endif // DataFormats_SiStripCommon_SiStripKey_H
const uint16_t & channel() const
Definition: SiStripKey.h:123
std::ostream & operator<<(std::ostream &, const SiStripKey &)
Definition: SiStripKey.cc:100
const std::string & path() const
Definition: SiStripKey.h:121
sistrip::Granularity granularity_
Definition: SiStripKey.h:112
virtual void initFromPath()
Definition: SiStripKey.h:94
virtual bool isConsistent(const SiStripKey &) const
Definition: SiStripKey.cc:64
const SiStripKey & operator=(const SiStripKey &)
Definition: SiStripKey.cc:30
std::string path_
Definition: SiStripKey.h:109
virtual bool isEqual(const SiStripKey &) const
Definition: SiStripKey.cc:53
Constants and enumerated type for sistrip::Granularity.
const uint32_t & key() const
Definition: SiStripKey.h:120
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:23
uint32_t key_
Definition: SiStripKey.h:106
virtual bool isValid() const
Definition: SiStripKey.cc:68
virtual void initGranularity()
Definition: SiStripKey.h:95
virtual bool isInvalid() const
Definition: SiStripKey.cc:79
virtual void print(std::stringstream &ss) const
Definition: SiStripKey.cc:90
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
virtual void initFromValue()
Definition: SiStripKey.h:92
virtual void terse(std::stringstream &ss) const
Definition: SiStripKey.h:87
virtual void initFromKey()
Definition: SiStripKey.h:93
uint16_t channel_
Definition: SiStripKey.h:115
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
virtual ~SiStripKey()
Definition: SiStripKey.h:43