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 ()
 
 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 SiStripDetKey &)
 
 SiStripDetKey (const SiStripKey &)
 
 SiStripDetKey (const SiStripKey &, const sistrip::Granularity &)
 
 SiStripDetKey (const std::string &directory_path)
 
 SiStripDetKey (const uint16_t &partition)
 
 SiStripDetKey (const uint32_t &det_key)
 
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 ()
 
 SiStripKey (const SiStripKey &)
 
 SiStripKey (const std::string &directory_path)
 
 SiStripKey (const uint32_t &key)
 
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() [1/9]

SiStripDetKey::SiStripDetKey ( const uint16_t &  partition)

Constructor using partition.

Definition at line 9 of file SiStripDetKey.cc.

11  // order is important!
12  initFromValue();
13  initFromKey();
14  initFromPath();
16 }

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

◆ SiStripDetKey() [2/9]

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.

21  : SiStripKey(), partition_(sistrip::invalid_), apvPairNumber_(apv_pair_number), apvWithinPair_(apv_within_pair) {
22  // order is important!
23  initFromValue();
24  initFromKey();
25  initFromPath();
27 }

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

◆ SiStripDetKey() [3/9]

SiStripDetKey::SiStripDetKey ( const SiStripDetId det_id)

Constructor using SiStripDetId.

Definition at line 31 of file SiStripDetKey.cc.

32  : SiStripKey(),
36  // order is important!
37  initFromValue();
38  initFromKey();
39  initFromPath();
41 }

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

◆ SiStripDetKey() [4/9]

SiStripDetKey::SiStripDetKey ( const uint32_t &  det_key)

Constructor using 32-bit "DET key".

Definition at line 45 of file SiStripDetKey.cc.

46  : SiStripKey(det_key),
50  // order is important!
51  initFromKey();
52  initFromValue();
53  initFromPath();
55 }

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

◆ SiStripDetKey() [5/9]

SiStripDetKey::SiStripDetKey ( const std::string &  directory_path)

Constructor using directory path.

Definition at line 59 of file SiStripDetKey.cc.

60  : SiStripKey(path),
64  // order is important!
65  initFromPath();
66  initFromValue();
67  initFromKey();
69 }

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

◆ SiStripDetKey() [6/9]

SiStripDetKey::SiStripDetKey ( const SiStripDetKey input)

Copy constructor.

Definition at line 73 of file SiStripDetKey.cc.

74  : SiStripKey(),
75  partition_(input.partition()),
76  apvPairNumber_(input.apvPairNumber()),
77  apvWithinPair_(input.apvWithinPair()) {
78  key(input.key());
79  path(input.path());
80  granularity(input.granularity());
81 }

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

◆ SiStripDetKey() [7/9]

SiStripDetKey::SiStripDetKey ( const SiStripKey input)

Copy constructor using base class.

Definition at line 85 of file SiStripDetKey.cc.

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 }

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

◆ SiStripDetKey() [8/9]

SiStripDetKey::SiStripDetKey ( const SiStripKey input,
const sistrip::Granularity gran 
)

Copy to level specified by granularity.

Definition at line 101 of file SiStripDetKey.cc.

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 }

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

◆ SiStripDetKey() [9/9]

SiStripDetKey::SiStripDetKey ( )

Default constructor

Definition at line 116 of file SiStripDetKey.cc.

Member Function Documentation

◆ apvPairNumber()

const uint16_t & SiStripDetKey::apvPairNumber ( ) const
inline

Returns APV pair number.

Definition at line 135 of file SiStripDetKey.h.

135 { return apvPairNumber_; }

References apvPairNumber_.

Referenced by SiStripDetKey().

◆ apvWithinPair()

const uint16_t & SiStripDetKey::apvWithinPair ( ) const
inline

Returns APV position within pair.

Definition at line 136 of file SiStripDetKey.h.

136 { return apvWithinPair_; }

References apvWithinPair_.

Referenced by SiStripDetKey().

◆ initFromKey()

void SiStripDetKey::initFromKey ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 203 of file SiStripDetKey.cc.

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 }

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

Referenced by SiStripDetKey().

◆ initFromPath()

void SiStripDetKey::initFromPath ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 233 of file SiStripDetKey.cc.

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();
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;
281  //ss << sistrip::root_ << sistrip::dir_
282  //<< sistrip::unknownView_ << sistrip::dir_;
283  std::string temp(ss.str());
284  path(temp);
285  }
286  }
287 }

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().

◆ initFromValue()

void SiStripDetKey::initFromValue ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 194 of file SiStripDetKey.cc.

194  {
195  // partition
196  if (partition_ > 4) {
198  }
199 }

References sistrip::invalid_, and partition_.

Referenced by SiStripDetKey().

◆ initGranularity()

void SiStripDetKey::initGranularity ( )
overrideprivatevirtual

◆ isConsistent()

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.

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 }

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

◆ isEqual()

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.

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 }

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

Referenced by isConsistent().

◆ isInvalid() [1/2]

bool SiStripDetKey::isInvalid ( ) const
overridevirtual

Identifies all member data as being invalid.

Reimplemented from SiStripKey.

Definition at line 173 of file SiStripDetKey.cc.

173 { return isInvalid(sistrip::APV); }

References sistrip::APV.

◆ isInvalid() [2/2]

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.

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 }

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

◆ isValid() [1/2]

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.

152 { return isValid(sistrip::APV); }

References sistrip::APV.

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

◆ isValid() [2/2]

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.

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 }

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().

◆ partition()

const uint16_t & SiStripDetKey::partition ( ) const
inline

Returns partition.

Definition at line 134 of file SiStripDetKey.h.

134 { return partition_; }

References partition_.

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

◆ print()

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.

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 }

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

◆ terse()

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.

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

References partition(), and contentValuesCheck::ss.

Member Data Documentation

◆ apvPairNumber_

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().

◆ apvWithinPair_

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().

◆ partition_

uint16_t SiStripDetKey::partition_
private

◆ partitionMask_

const uint16_t SiStripDetKey::partitionMask_ = 0x07
staticprivate

Definition at line 129 of file SiStripDetKey.h.

Referenced by initFromKey().

◆ partitionOffset_

const uint16_t SiStripDetKey::partitionOffset_ = 29
staticprivate

Definition at line 126 of file SiStripDetKey.h.

Referenced by initFromKey().

sistrip::null_
static const char null_[]
Definition: Constants.h:22
input
static const std::string input
Definition: EdmProvDump.cc:48
sistrip::TRACKER
Definition: ConstantsForGranularity.h:64
sistrip::invalid32_
static const uint32_t invalid32_
Definition: Constants.h:15
SiStripDetKey::initFromKey
void initFromKey() override
Definition: SiStripDetKey.cc:203
sistrip::detectorView_
static const char detectorView_[]
Definition: ConstantsForView.h:22
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
sistrip::dir_
static const char dir_[]
Definition: ConstantsForDqm.h:17
SiStripKey::SiStripKey
SiStripKey()
Definition: SiStripKey.cc:43
sistrip::UNKNOWN_GRAN
Definition: ConstantsForGranularity.h:62
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
SiStripKey::granularity
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
SiStripDetKey::isEqual
bool isEqual(const SiStripKey &) const override
Definition: SiStripDetKey.cc:126
SiStripDetKey::apvPairNumber
const uint16_t & apvPairNumber() const
Definition: SiStripDetKey.h:135
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiStripKey::channel
const uint16_t & channel() const
Definition: SiStripKey.h:123
SiStripDetKey::apvWithinPair_
uint16_t apvWithinPair_
Definition: SiStripDetKey.h:123
SiStripDetKey::partition_
uint16_t partition_
Definition: SiStripDetKey.h:117
sistrip::partition_
static const char partition_[]
Definition: ConstantsForGranularity.h:24
SiStripEnumsAndStrings::granularity
static std::string granularity(const sistrip::Granularity &)
Definition: SiStripEnumsAndStrings.cc:265
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripDetKey::initFromValue
void initFromValue() override
Definition: SiStripDetKey.cc:194
SiStripKey::path
const std::string & path() const
Definition: SiStripKey.h:121
sistrip::APV
Definition: ConstantsForGranularity.h:79
sistrip::root_
static const char root_[]
Definition: ConstantsForDqm.h:30
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
SiStripDetKey
Utility class that identifies a position within the strip tracker geometrical structure,...
Definition: SiStripDetKey.h:28
SiStripDetKey::partitionMask_
static const uint16_t partitionMask_
Definition: SiStripDetKey.h:129
SiStripDetKey::partitionOffset_
static const uint16_t partitionOffset_
Definition: SiStripDetKey.h:126
SiStripDetKey::apvPairNumber_
uint16_t apvPairNumber_
Definition: SiStripDetKey.h:120
SiStripDetKey::partition
const uint16_t & partition() const
Definition: SiStripDetKey.h:134
SiStripDetKey::initFromPath
void initFromPath() override
Definition: SiStripDetKey.cc:233
SiStripDetKey::isValid
bool isValid() const override
Definition: SiStripDetKey.cc:152
sistrip::PARTITION
Definition: ConstantsForGranularity.h:65
SiStripDetKey::initGranularity
void initGranularity() override
Definition: SiStripDetKey.cc:291
SiStripDetKey::isInvalid
bool isInvalid() const override
Definition: SiStripDetKey.cc:173
sistrip::UNDEFINED_GRAN
Definition: ConstantsForGranularity.h:61
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
SiStripDetKey::apvWithinPair
const uint16_t & apvWithinPair() const
Definition: SiStripDetKey.h:136