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

9  :
10  SiStripKey(),
14 {
15  // order is important!
16  initFromValue();
17  initFromKey();
18  initFromPath();
20 }
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 24 of file SiStripDetKey.cc.

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

26  :
27  SiStripKey(),
29  apvPairNumber_(apv_pair_number),
30  apvWithinPair_(apv_within_pair)
31 {
32  // order is important!
33  initFromValue();
34  initFromKey();
35  initFromPath();
37 }
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 41 of file SiStripDetKey.cc.

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

41  :
42  SiStripKey(),
46 {
47  // order is important!
48  initFromValue();
49  initFromKey();
50  initFromPath();
52 }
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 56 of file SiStripDetKey.cc.

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

56  :
57  SiStripKey(det_key),
61 {
62  // order is important!
63  initFromKey();
64  initFromValue();
65  initFromPath();
67 }
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 71 of file SiStripDetKey.cc.

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

71  :
76 {
77  // order is important!
78  initFromPath();
79  initFromValue();
80  initFromKey();
82 }
uint16_t apvPairNumber_
void initFromPath() override
void initGranularity() override
void initFromKey() override
const std::string & path() const
Definition: SiStripKey.h:126
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 86 of file SiStripDetKey.cc.

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

86  :
87  SiStripKey(),
88  partition_(input.partition()),
89  apvPairNumber_(input.apvPairNumber()),
91 {
92  key(input.key());
93  path(input.path());
94  granularity(input.granularity());
95 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:125
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:127
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const std::string & path() const
Definition: SiStripKey.h:126
const uint16_t & apvPairNumber() const
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripKey input)

Copy constructor using base class.

Definition at line 99 of file SiStripDetKey.cc.

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

99  :
100  SiStripKey(),
104 {
105  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
106  key(det_key.key());
107  path(det_key.path());
108  granularity(det_key.granularity());
109  partition_ = det_key.partition();
110  apvPairNumber_ = det_key.apvPairNumber();
111  apvWithinPair_ = det_key.apvWithinPair();
112 }
uint16_t apvPairNumber_
static std::string const input
Definition: EdmProvDump.cc:48
const uint32_t & key() const
Definition: SiStripKey.h:125
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:127
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const std::string & path() const
Definition: SiStripKey.h:126
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 116 of file SiStripDetKey.cc.

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

117  :
118  SiStripKey(),
119  partition_(0),
120  apvPairNumber_(0),
121  apvWithinPair_(0)
122 {
123  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
124  if ( gran == sistrip::PARTITION ) {
125  partition_ = det_key.partition();
126  }
127 
128  initFromValue();
129  initFromKey();
130  initFromPath();
131  initGranularity();
132 }
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 136 of file SiStripDetKey.cc.

136  :
137  SiStripKey(),
141 {;}
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 142 of file SiStripDetKey.h.

References apvPairNumber_.

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

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

Returns APV position within pair.

Definition at line 143 of file SiStripDetKey.h.

References apvWithinPair_, and operator<<().

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

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

Reimplemented from SiStripKey.

Definition at line 216 of file SiStripDetKey.cc.

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

Referenced by SiStripDetKey().

216  {
217 
218  if ( key() == sistrip::invalid32_ ) {
219 
220  // ---------- Set DetKey based on member data ----------
221 
222  // Initialise to null value
223  key(0);
224 
225  // Extract partition
226  if ( partition_ >= 1 && //sistrip::PARTITION_MIN &&
227  partition_ <= 4 ) { //sistrip::PARTITION_MAX ) {
229  } else if ( partition_ == 0 ) {
231  } else {
233  }
234 
235  } else {
236 
237  // ---------- Set member data based on Det key ----------
238 
240 
242 
243  }
244 
245 }
static const uint32_t invalid32_
Definition: Constants.h:15
static const uint16_t partitionOffset_
const uint32_t & key() const
Definition: SiStripKey.h:125
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 249 of file SiStripDetKey.cc.

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

Referenced by SiStripDetKey().

249  {
250 
251  if ( path() == sistrip::null_ ) {
252 
253  // ---------- Set directory path based on member data ----------
254 
255  std::stringstream dir;
256 
257  dir << sistrip::root_ << sistrip::dir_
259 
260  // Add partition
261  if ( partition_ ) {
263  }
264 
265  std::string temp( dir.str() );
266  path( temp );
267 
268  } else {
269 
270  // ---------- Set member data based on directory path ----------
271 
272  partition_ = 0;
273 
274  // Check if root is found
275  if ( path().find( sistrip::root_ ) == std::string::npos ) {
276  std::string temp = path();
277  path( std::string(sistrip::root_) + sistrip::dir_ + temp );
278  }
279 
280  size_t curr = 0; // current string position
281  size_t next = 0; // next string position
282  next = path().find( sistrip::detectorView_, curr );
283 
284  // Extract view
285  curr = next;
286  if ( curr != std::string::npos ) {
287  next = path().find( sistrip::partition_, curr );
288  std::string detector_view( path(),
289  curr+(sizeof(sistrip::detectorView_) - 1),
290  next-(sizeof(sistrip::dir_) - 1)-curr );
291  // Extract partition
292  curr = next;
293  if ( curr != std::string::npos ) {
294  next = std::string::npos;
296  curr+(sizeof(sistrip::partition_) - 1),
297  next-(sizeof(sistrip::dir_) - 1)-curr );
298  partition_ = std::atoi( partition.c_str() );
299  }
300  } else {
301  std::stringstream ss;
302  ss << sistrip::root_ << sistrip::dir_;
303  //ss << sistrip::root_ << sistrip::dir_
304  //<< sistrip::unknownView_ << sistrip::dir_;
305  std::string temp( ss.str() );
306  path( temp );
307  }
308 
309  }
310 
311 }
static const char dir_[]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
static const char detectorView_[]
static const char partition_[]
const uint16_t & partition() const
const std::string & path() const
Definition: SiStripKey.h:126
static const char root_[]
dbl *** dir
Definition: mlp_gen.cc:35
uint16_t partition_
static const char null_[]
Definition: Constants.h:22
void SiStripDetKey::initFromValue ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 206 of file SiStripDetKey.cc.

References sistrip::invalid_, and partition_.

Referenced by SiStripDetKey().

206  {
207 
208  // partition
209  if(partition_ > 4) {
211  }
212 }
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t partition_
void SiStripDetKey::initGranularity ( )
overrideprivatevirtual

Reimplemented from SiStripKey.

Definition at line 315 of file SiStripDetKey.cc.

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

Referenced by SiStripDetKey().

315  {
316 
318  channel(0);
322  } else if ( partition_ == sistrip::invalid_ ) {
325  }
326 
327 }
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:127
const uint16_t & channel() const
Definition: SiStripKey.h:128
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 156 of file SiStripDetKey.cc.

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

156  {
157  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
158  if ( isEqual(input) ) { return false; }
159  else if ( ( partition_ == 0 || input.partition() == 0 ) &&
160  ( apvPairNumber_ == 0 || input.apvPairNumber() == 0 ) &&
161  ( apvWithinPair_ == 0 || input.apvWithinPair() == 0 ) ) {
162  return true;
163  } else { return false; }
164 }
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:125
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 145 of file SiStripDetKey.cc.

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

Referenced by isConsistent().

145  {
146  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
147  if ( partition_ == input.partition() &&
148  apvPairNumber_ == input.apvPairNumber() &&
149  apvWithinPair_ == input.apvWithinPair() ) {
150  return true;
151  } else { return false; }
152 }
uint16_t apvPairNumber_
static std::string const input
Definition: EdmProvDump.cc:48
const uint32_t & key() const
Definition: SiStripKey.h:125
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 187 of file SiStripDetKey.cc.

References sistrip::APV.

187  {
188  return isInvalid(sistrip::APV);
189 }
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 193 of file SiStripDetKey.cc.

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

193  {
194  if ( gran == sistrip::TRACKER ) { return false; }
195  else if ( gran == sistrip::UNDEFINED_GRAN ||
196  gran == sistrip::UNKNOWN_GRAN ) { return false; }
197 
198  if ( partition_ == sistrip::invalid_ ) {
199  if ( gran == sistrip::PARTITION ) { return true; }
200  }
201  return false;
202 }
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 168 of file SiStripDetKey.cc.

References sistrip::APV.

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

168  {
169  return isValid(sistrip::APV);
170 }
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 174 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().

174  {
175  if ( gran == sistrip::TRACKER ) { return true; }
176  else if ( gran == sistrip::UNDEFINED_GRAN ||
177  gran == sistrip::UNKNOWN_GRAN ) { return false; }
178 
179  if ( partition_ != sistrip::invalid_ ) {
180  if ( gran == sistrip::PARTITION ) { return true; }
181  }
182  return false;
183 }
static const uint16_t invalid_
Definition: Constants.h:16
uint16_t partition_
const uint16_t & SiStripDetKey::partition ( ) const
inline

Returns partition.

Definition at line 141 of file SiStripDetKey.h.

References partition_.

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

141 { 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 338 of file SiStripDetKey.cc.

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

Referenced by operator<<().

338  {
339  ss << " [SiStripDetKey::print]" << std::endl
340  << std::hex
341  << " 32-bit Det key : 0x"
342  << std::setfill('0')
343  << std::setw(8) << key() << std::endl
344  << std::setfill(' ')
345  << std::dec
346  << " Partition : " << partition() << std::endl
347  << " Directory : " << path() << std::endl
348  << " Granularity : "
350  << " Channel : " << channel() << std::endl
351  << " isValid : " << isValid();
352 }
bool isValid() const override
static std::string granularity(const sistrip::Granularity &)
const uint32_t & key() const
Definition: SiStripKey.h:125
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:127
const uint16_t & partition() const
const std::string & path() const
Definition: SiStripKey.h:126
const uint16_t & channel() const
Definition: SiStripKey.h:128
void SiStripDetKey::terse ( std::stringstream &  ss) const
overridevirtual

A terse summary of the key

Reimplemented from SiStripKey.

Definition at line 331 of file SiStripDetKey.cc.

References partition().

331  {
332  ss << "DET:partition= "
333  << partition();
334 }
const uint16_t & partition() const

Member Data Documentation

uint16_t SiStripDetKey::apvPairNumber_
private

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

Definition at line 126 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 129 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 135 of file SiStripDetKey.h.

Referenced by initFromKey().

const uint16_t SiStripDetKey::partitionOffset_ = 29
staticprivate

Definition at line 132 of file SiStripDetKey.h.

Referenced by initFromKey().