CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
SiStripDetKey Class Reference

Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip. More...

#include <SiStripDetKey.h>

Inheritance diagram for SiStripDetKey:
SiStripKey

Public Member Functions

const uint16_t & apvPairNumber () const
 
const uint16_t & apvWithinPair () const
 
bool isConsistent (const SiStripKey &) const override
 
bool isEqual (const SiStripKey &) const override
 
bool isInvalid () const override
 
bool isInvalid (const sistrip::Granularity &) const override
 
bool isValid () const override
 
bool isValid (const sistrip::Granularity &) const override
 
const uint16_t & partition () const
 
void print (std::stringstream &ss) const override
 
 SiStripDetKey (const uint16_t &partition)
 
 SiStripDetKey (const DetId &det_id, const uint16_t &apv_pair_number=0, const uint16_t &apv_within_pair=0)
 
 SiStripDetKey (const SiStripDetId &det_id)
 
 SiStripDetKey (const uint32_t &det_key)
 
 SiStripDetKey (const std::string &directory_path)
 
 SiStripDetKey (const SiStripDetKey &)
 
 SiStripDetKey (const SiStripKey &)
 
 SiStripDetKey (const SiStripKey &, const sistrip::Granularity &)
 
 SiStripDetKey ()
 
void terse (std::stringstream &ss) const override
 
- Public Member Functions inherited from SiStripKey
const uint16_t & channel () const
 
const sistrip::Granularitygranularity () const
 
const uint32_t & key () const
 
const SiStripKeyoperator= (const SiStripKey &)
 
const std::string & path () const
 
 SiStripKey (const uint32_t &key)
 
 SiStripKey (const std::string &directory_path)
 
 SiStripKey (const SiStripKey &)
 
 SiStripKey ()
 
virtual ~SiStripKey ()
 

Private Member Functions

void initFromKey () override
 
void initFromPath () override
 
void initFromValue () override
 
void initGranularity () override
 

Private Attributes

uint16_t apvPairNumber_
 
uint16_t apvWithinPair_
 
uint16_t partition_
 

Static Private Attributes

static const uint16_t partitionMask_ = 0x07
 
static const uint16_t partitionOffset_ = 29
 

Additional Inherited Members

- Protected Member Functions inherited from SiStripKey
void channel (const uint16_t &)
 
void granularity (const sistrip::Granularity &)
 
void key (const uint32_t &)
 
void path (const std::string &)
 

Detailed Description

Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.

Author
R.Bainbridge, S.Lowette

NOTA BENE: *** NOT FINISHED ***

can generate another key that is NOT DetId and packs sistrip-specific data in a more condensed way, so that all levels can be encoded with "all" and "invalid" values, down to level of apv. also, need "conversion tool" that re-generates DetId key from this new key. this is only way...!!! maybe can "safeguard" use of this key as a DetId by reserving bits 22-24 as a flag (eg, set all high), so that if an attempt to build DetId using SiStripDetId class, we can understand if key is real DetId or not... what about going to level of apv?... what about levels about module?...

Definition at line 28 of file SiStripDetKey.h.

Constructor & Destructor Documentation

SiStripDetKey::SiStripDetKey ( const uint16_t &  partition)

Constructor using partition.

Definition at line 9 of file SiStripDetKey.cc.

References initFromKey(), initFromPath(), initFromValue(), and initGranularity().

11  // order is important!
12  initFromValue();
13  initFromKey();
14  initFromPath();
16 }
uint16_t apvPairNumber_
void initFromPath() override
void initGranularity() override
const uint16_t & partition() const
void initFromKey() override
void initFromValue() override
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const DetId det_id,
const uint16_t &  apv_pair_number = 0,
const uint16_t &  apv_within_pair = 0 
)

Constructor using DetId, APV pair and APV pos within pair.

Definition at line 20 of file SiStripDetKey.cc.

References initFromKey(), initFromPath(), initFromValue(), and initGranularity().

21  : SiStripKey(), partition_(sistrip::invalid_), apvPairNumber_(apv_pair_number), apvWithinPair_(apv_within_pair) {
22  // order is important!
23  initFromValue();
24  initFromKey();
25  initFromPath();
27 }
uint16_t apvPairNumber_
void initFromPath() override
void initGranularity() override
void initFromKey() override
void initFromValue() override
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripDetId det_id)

Constructor using SiStripDetId.

Definition at line 31 of file SiStripDetKey.cc.

References initFromKey(), initFromPath(), initFromValue(), and initGranularity().

32  : SiStripKey(),
36  // order is important!
37  initFromValue();
38  initFromKey();
39  initFromPath();
41 }
uint16_t apvPairNumber_
void initFromPath() override
void initGranularity() override
void initFromKey() override
void initFromValue() override
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const uint32_t &  det_key)

Constructor using 32-bit "DET key".

Definition at line 45 of file SiStripDetKey.cc.

References initFromKey(), initFromPath(), initFromValue(), and initGranularity().

46  : SiStripKey(det_key),
50  // order is important!
51  initFromKey();
52  initFromValue();
53  initFromPath();
55 }
uint16_t apvPairNumber_
void initFromPath() override
void initGranularity() override
void initFromKey() override
void initFromValue() override
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const std::string &  directory_path)

Constructor using directory path.

Definition at line 59 of file SiStripDetKey.cc.

References initFromKey(), initFromPath(), initFromValue(), and initGranularity().

60  : SiStripKey(path),
64  // order is important!
65  initFromPath();
66  initFromValue();
67  initFromKey();
69 }
uint16_t apvPairNumber_
void initFromPath() override
void initGranularity() override
void initFromKey() override
const std::string & path() const
Definition: SiStripKey.h:121
void initFromValue() override
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripDetKey input)

Copy constructor.

Definition at line 73 of file SiStripDetKey.cc.

References SiStripKey::granularity(), SiStripKey::key(), and SiStripKey::path().

74  : SiStripKey(),
75  partition_(input.partition()),
77  apvWithinPair_(input.apvWithinPair()) {
78  key(input.key());
79  path(input.path());
80  granularity(input.granularity());
81 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:120
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const std::string & path() const
Definition: SiStripKey.h:121
const uint16_t & apvPairNumber() const
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripKey input)

Copy constructor using base class.

Definition at line 85 of file SiStripDetKey.cc.

References apvPairNumber(), apvPairNumber_, apvWithinPair(), apvWithinPair_, SiStripKey::granularity(), input, SiStripKey::key(), partition(), partition_, and SiStripKey::path().

86  : SiStripKey(),
90  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
91  key(det_key.key());
92  path(det_key.path());
93  granularity(det_key.granularity());
94  partition_ = det_key.partition();
95  apvPairNumber_ = det_key.apvPairNumber();
96  apvWithinPair_ = det_key.apvWithinPair();
97 }
uint16_t apvPairNumber_
static std::string const input
Definition: EdmProvDump.cc:48
const uint32_t & key() const
Definition: SiStripKey.h:120
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const std::string & path() const
Definition: SiStripKey.h:121
const uint16_t & apvPairNumber() const
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripKey input,
const sistrip::Granularity gran 
)

Copy to level specified by granularity.

Definition at line 101 of file SiStripDetKey.cc.

References initFromKey(), initFromPath(), initFromValue(), initGranularity(), input, partition(), sistrip::PARTITION, and partition_.

103  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
104  if (gran == sistrip::PARTITION) {
105  partition_ = det_key.partition();
106  }
107 
108  initFromValue();
109  initFromKey();
110  initFromPath();
111  initGranularity();
112 }
uint16_t apvPairNumber_
void initFromPath() override
void initGranularity() override
static std::string const input
Definition: EdmProvDump.cc:48
const uint16_t & partition() const
void initFromKey() override
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
void initFromValue() override
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( )

Default constructor

Definition at line 116 of file SiStripDetKey.cc.

117  : SiStripKey(),
121  ;
122 }
uint16_t apvPairNumber_
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t apvWithinPair_
uint16_t partition_

Member Function Documentation

const uint16_t & SiStripDetKey::apvPairNumber ( ) const
inline

Returns APV pair number.

Definition at line 135 of file SiStripDetKey.h.

References apvPairNumber_.

Referenced by isConsistent(), isEqual(), and SiStripDetKey().

135 { return apvPairNumber_; }
uint16_t apvPairNumber_
const uint16_t & SiStripDetKey::apvWithinPair ( ) const
inline

Returns APV position within pair.

Definition at line 136 of file SiStripDetKey.h.

References apvWithinPair_, and operator<<().

Referenced by isConsistent(), isEqual(), and SiStripDetKey().

136 { return apvWithinPair_; }
uint16_t apvWithinPair_
void SiStripDetKey::initFromKey ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 203 of file SiStripDetKey.cc.

References sistrip::invalid32_, sistrip::invalid_, SiStripKey::key(), partition_, partitionMask_, and partitionOffset_.

Referenced by SiStripDetKey().

203  {
204  if (key() == sistrip::invalid32_) {
205  // ---------- Set DetKey based on member data ----------
206 
207  // Initialise to null value
208  key(0);
209 
210  // Extract partition
211  if (partition_ >= 1 && //sistrip::PARTITION_MIN &&
212  partition_ <= 4) { //sistrip::PARTITION_MAX ) {
214  } else if (partition_ == 0) {
216  } else {
218  }
219 
220  } else {
221  // ---------- Set member data based on Det key ----------
222 
224 
225  if (partition_ == partitionMask_) {
227  }
228  }
229 }
static const uint32_t invalid32_
Definition: Constants.h:15
static const uint16_t partitionOffset_
const uint32_t & key() const
Definition: SiStripKey.h:120
static const uint16_t partitionMask_
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t partition_
void SiStripDetKey::initFromPath ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 233 of file SiStripDetKey.cc.

References sistrip::detectorView_, DeadROC_duringRun::dir, sistrip::dir_, spr::find(), GetRecoTauVFromDQM_MC_cff::next, sistrip::null_, partition(), sistrip::partition_, partition_, SiStripKey::path(), sistrip::root_, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

Referenced by SiStripDetKey().

233  {
234  if (path() == sistrip::null_) {
235  // ---------- Set directory path based on member data ----------
236 
237  std::stringstream dir;
238 
240 
241  // Add partition
242  if (partition_) {
244  }
245 
246  std::string temp(dir.str());
247  path(temp);
248 
249  } else {
250  // ---------- Set member data based on directory path ----------
251 
252  partition_ = 0;
253 
254  // Check if root is found
255  if (path().find(sistrip::root_) == std::string::npos) {
256  std::string temp = path();
257  path(std::string(sistrip::root_) + sistrip::dir_ + temp);
258  }
259 
260  size_t curr = 0; // current string position
261  size_t next = 0; // next string position
262  next = path().find(sistrip::detectorView_, curr);
263 
264  // Extract view
265  curr = next;
266  if (curr != std::string::npos) {
267  next = path().find(sistrip::partition_, curr);
268  std::string detector_view(
269  path(), curr + (sizeof(sistrip::detectorView_) - 1), next - (sizeof(sistrip::dir_) - 1) - curr);
270  // Extract partition
271  curr = next;
272  if (curr != std::string::npos) {
273  next = std::string::npos;
275  path(), curr + (sizeof(sistrip::partition_) - 1), next - (sizeof(sistrip::dir_) - 1) - curr);
276  partition_ = std::atoi(partition.c_str());
277  }
278  } else {
279  std::stringstream ss;
280  ss << sistrip::root_ << sistrip::dir_;
281  //ss << sistrip::root_ << sistrip::dir_
282  //<< sistrip::unknownView_ << sistrip::dir_;
283  std::string temp(ss.str());
284  path(temp);
285  }
286  }
287 }
static const char dir_[]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static const char detectorView_[]
static const char partition_[]
const uint16_t & partition() const
const std::string & path() const
Definition: SiStripKey.h:121
static const char root_[]
uint16_t partition_
static const char null_[]
Definition: Constants.h:22
void SiStripDetKey::initFromValue ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 194 of file SiStripDetKey.cc.

References sistrip::invalid_, and partition_.

Referenced by SiStripDetKey().

194  {
195  // partition
196  if (partition_ > 4) {
198  }
199 }
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t partition_
void SiStripDetKey::initGranularity ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 291 of file SiStripDetKey.cc.

References SiStripKey::channel(), SiStripKey::granularity(), sistrip::invalid_, sistrip::PARTITION, partition_, sistrip::TRACKER, and sistrip::UNKNOWN_GRAN.

Referenced by SiStripDetKey().

291  {
293  channel(0);
297  } else if (partition_ == sistrip::invalid_) {
300  }
301 }
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
const uint16_t & channel() const
Definition: SiStripKey.h:123
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t partition_
bool SiStripDetKey::isConsistent ( const SiStripKey key) const
overridevirtual

"Consistent" means identical and/or null (ie, "all") data.

Reimplemented from SiStripKey.

Definition at line 138 of file SiStripDetKey.cc.

References apvPairNumber(), apvPairNumber_, apvWithinPair(), apvWithinPair_, input, isEqual(), SiStripKey::key(), partition(), and partition_.

138  {
139  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
140  if (isEqual(input)) {
141  return false;
142  } else if ((partition_ == 0 || input.partition() == 0) && (apvPairNumber_ == 0 || input.apvPairNumber() == 0) &&
143  (apvWithinPair_ == 0 || input.apvWithinPair() == 0)) {
144  return true;
145  } else {
146  return false;
147  }
148 }
uint16_t apvPairNumber_
bool isEqual(const SiStripKey &) const override
static std::string const input
Definition: EdmProvDump.cc:48
const uint32_t & key() const
Definition: SiStripKey.h:120
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const uint16_t & apvPairNumber() const
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
uint16_t apvWithinPair_
uint16_t partition_
bool SiStripDetKey::isEqual ( const SiStripKey key) const
overridevirtual

Identifies key objects with identical member data.

Reimplemented from SiStripKey.

Definition at line 126 of file SiStripDetKey.cc.

References apvPairNumber(), apvPairNumber_, apvWithinPair(), apvWithinPair_, input, SiStripKey::key(), partition(), and partition_.

Referenced by isConsistent().

126  {
127  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
128  if (partition_ == input.partition() && apvPairNumber_ == input.apvPairNumber() &&
129  apvWithinPair_ == input.apvWithinPair()) {
130  return true;
131  } else {
132  return false;
133  }
134 }
uint16_t apvPairNumber_
static std::string const input
Definition: EdmProvDump.cc:48
const uint32_t & key() const
Definition: SiStripKey.h:120
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const uint16_t & apvPairNumber() const
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
uint16_t apvWithinPair_
uint16_t partition_
bool SiStripDetKey::isInvalid ( ) const
overridevirtual

Identifies all member data as being invalid.

Reimplemented from SiStripKey.

Definition at line 173 of file SiStripDetKey.cc.

References sistrip::APV.

173 { return isInvalid(sistrip::APV); }
bool isInvalid() const override
bool SiStripDetKey::isInvalid ( const sistrip::Granularity gran) const
overridevirtual

All member data to level of "Granularity" are invalid. If sistrip::Granularity is "undefined", returns true.

Reimplemented from SiStripKey.

Definition at line 177 of file SiStripDetKey.cc.

References sistrip::invalid_, sistrip::PARTITION, partition_, sistrip::TRACKER, sistrip::UNDEFINED_GRAN, and sistrip::UNKNOWN_GRAN.

177  {
178  if (gran == sistrip::TRACKER) {
179  return false;
180  } else if (gran == sistrip::UNDEFINED_GRAN || gran == sistrip::UNKNOWN_GRAN) {
181  return false;
182  }
183 
184  if (partition_ == sistrip::invalid_) {
185  if (gran == sistrip::PARTITION) {
186  return true;
187  }
188  }
189  return false;
190 }
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t partition_
bool SiStripDetKey::isValid ( void  ) const
overridevirtual

Identifies all member data as being "valid" or null ("all").

Reimplemented from SiStripKey.

Definition at line 152 of file SiStripDetKey.cc.

References sistrip::APV.

Referenced by ntupleDataFormat._Object::_checkIsValid(), print(), and core.AutoHandle.AutoHandle::ReallyLoad().

152 { return isValid(sistrip::APV); }
bool isValid() const override
bool SiStripDetKey::isValid ( const sistrip::Granularity gran) const
overridevirtual

All member data to level of "Granularity" are valid. If sistrip::Granularity is "undefined", returns false.

Reimplemented from SiStripKey.

Definition at line 156 of file SiStripDetKey.cc.

References sistrip::invalid_, sistrip::PARTITION, partition_, sistrip::TRACKER, sistrip::UNDEFINED_GRAN, and sistrip::UNKNOWN_GRAN.

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

156  {
157  if (gran == sistrip::TRACKER) {
158  return true;
159  } else if (gran == sistrip::UNDEFINED_GRAN || gran == sistrip::UNKNOWN_GRAN) {
160  return false;
161  }
162 
163  if (partition_ != sistrip::invalid_) {
164  if (gran == sistrip::PARTITION) {
165  return true;
166  }
167  }
168  return false;
169 }
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t partition_
const uint16_t & SiStripDetKey::partition ( ) const
inline

Returns partition.

Definition at line 134 of file SiStripDetKey.h.

References partition_.

Referenced by initFromPath(), isConsistent(), isEqual(), print(), SiStripDetKey(), and terse().

134 { return partition_; }
uint16_t partition_
void SiStripDetKey::print ( std::stringstream &  ss) const
overridevirtual

Print member data of the key

Reimplemented from SiStripKey.

Definition at line 309 of file SiStripDetKey.cc.

References SiStripKey::channel(), TauDecayModes::dec, SiStripEnumsAndStrings::granularity(), SiStripKey::granularity(), isValid(), SiStripKey::key(), partition(), and SiStripKey::path().

Referenced by operator<<().

309  {
310  ss << " [SiStripDetKey::print]" << std::endl
311  << std::hex << " 32-bit Det key : 0x" << std::setfill('0') << std::setw(8) << key() << std::endl
312  << std::setfill(' ') << std::dec << " Partition : " << partition() << std::endl
313  << " Directory : " << path() << std::endl
314  << " Granularity : " << SiStripEnumsAndStrings::granularity(granularity()) << std::endl
315  << " Channel : " << channel() << std::endl
316  << " isValid : " << isValid();
317 }
bool isValid() const override
static std::string granularity(const sistrip::Granularity &)
const uint32_t & key() const
Definition: SiStripKey.h:120
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
const uint16_t & partition() const
const std::string & path() const
Definition: SiStripKey.h:121
const uint16_t & channel() const
Definition: SiStripKey.h:123
void SiStripDetKey::terse ( std::stringstream &  ss) const
overridevirtual

A terse summary of the key

Reimplemented from SiStripKey.

Definition at line 305 of file SiStripDetKey.cc.

References partition().

305 { ss << "DET:partition= " << partition(); }
const uint16_t & partition() const

Member Data Documentation

uint16_t SiStripDetKey::apvPairNumber_
private

APV pair number [0,1-3,invalid].

Definition at line 120 of file SiStripDetKey.h.

Referenced by apvPairNumber(), isConsistent(), isEqual(), and SiStripDetKey().

uint16_t SiStripDetKey::apvWithinPair_
private

APV position within pair [0,1-2,invalid].

Definition at line 123 of file SiStripDetKey.h.

Referenced by apvWithinPair(), isConsistent(), isEqual(), and SiStripDetKey().

uint16_t SiStripDetKey::partition_
private
const uint16_t SiStripDetKey::partitionMask_ = 0x07
staticprivate

Definition at line 129 of file SiStripDetKey.h.

Referenced by initFromKey().

const uint16_t SiStripDetKey::partitionOffset_ = 29
staticprivate

Definition at line 126 of file SiStripDetKey.h.

Referenced by initFromKey().