Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip. More...
#include <SiStripDetKey.h>
Public Member Functions | |
const uint16_t & | apvPairNumber () const |
const uint16_t & | apvWithinPair () const |
bool | isConsistent (const SiStripKey &) const |
bool | isEqual (const SiStripKey &) const |
bool | isInvalid () const |
bool | isInvalid (const sistrip::Granularity &) const |
bool | isValid (const sistrip::Granularity &) const |
bool | isValid () const |
const uint16_t & | partition () const |
virtual void | print (std::stringstream &ss) const |
SiStripDetKey (const DetId &det_id, const uint16_t &apv_pair_number=0, const uint16_t &apv_within_pair=0) | |
SiStripDetKey (const std::string &directory_path) | |
SiStripDetKey (const uint32_t &det_key) | |
SiStripDetKey (const SiStripDetId &det_id) | |
SiStripDetKey () | |
SiStripDetKey (const SiStripKey &) | |
SiStripDetKey (const uint16_t &partition) | |
SiStripDetKey (const SiStripKey &, const sistrip::Granularity &) | |
SiStripDetKey (const SiStripDetKey &) | |
virtual void | terse (std::stringstream &ss) const |
Private Member Functions | |
void | initFromKey () |
void | initFromPath () |
void | initFromValue () |
void | initGranularity () |
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 |
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
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 29 of file SiStripDetKey.h.
SiStripDetKey::SiStripDetKey | ( | const uint16_t & | partition | ) |
Constructor using partition.
Definition at line 10 of file SiStripDetKey.cc.
References initFromKey(), initFromPath(), initFromValue(), and initGranularity().
: SiStripKey(), partition_(partition), apvPairNumber_(sistrip::invalid_), apvWithinPair_(sistrip::invalid_) { // order is important! initFromValue(); initFromKey(); initFromPath(); initGranularity(); }
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 25 of file SiStripDetKey.cc.
References initFromKey(), initFromPath(), initFromValue(), and initGranularity().
: SiStripKey(), partition_(sistrip::invalid_), apvPairNumber_(apv_pair_number), apvWithinPair_(apv_within_pair) { // order is important! initFromValue(); initFromKey(); initFromPath(); initGranularity(); }
SiStripDetKey::SiStripDetKey | ( | const SiStripDetId & | det_id | ) |
Constructor using SiStripDetId.
Definition at line 42 of file SiStripDetKey.cc.
References initFromKey(), initFromPath(), initFromValue(), and initGranularity().
: SiStripKey(), partition_(sistrip::invalid_), apvPairNumber_(sistrip::invalid_), apvWithinPair_(sistrip::invalid_) { // order is important! initFromValue(); initFromKey(); initFromPath(); initGranularity(); }
SiStripDetKey::SiStripDetKey | ( | const uint32_t & | det_key | ) |
Constructor using 32-bit "DET key".
Definition at line 57 of file SiStripDetKey.cc.
References initFromKey(), initFromPath(), initFromValue(), and initGranularity().
: SiStripKey(det_key), partition_(sistrip::invalid_), apvPairNumber_(sistrip::invalid_), apvWithinPair_(sistrip::invalid_) { // order is important! initFromKey(); initFromValue(); initFromPath(); initGranularity(); }
SiStripDetKey::SiStripDetKey | ( | const std::string & | directory_path | ) |
Constructor using directory path.
Definition at line 72 of file SiStripDetKey.cc.
References initFromKey(), initFromPath(), initFromValue(), and initGranularity().
: SiStripKey(path), partition_(sistrip::invalid_), apvPairNumber_(sistrip::invalid_), apvWithinPair_(sistrip::invalid_) { // order is important! initFromPath(); initFromValue(); initFromKey(); initGranularity(); }
SiStripDetKey::SiStripDetKey | ( | const SiStripDetKey & | input | ) |
Copy constructor.
Definition at line 87 of file SiStripDetKey.cc.
References SiStripKey::granularity(), SiStripKey::key(), and SiStripKey::path().
: SiStripKey(), partition_(input.partition()), apvPairNumber_(input.apvPairNumber()), apvWithinPair_(input.apvWithinPair()) { key(input.key()); path(input.path()); granularity(input.granularity()); }
SiStripDetKey::SiStripDetKey | ( | const SiStripKey & | input | ) |
Copy constructor using base class.
Definition at line 100 of file SiStripDetKey.cc.
References apvPairNumber(), apvPairNumber_, apvWithinPair(), apvWithinPair_, SiStripKey::granularity(), LaserDQM_cfg::input, SiStripKey::key(), partition(), partition_, SiStripKey::path(), and groupFilesInBlocks::temp.
: SiStripKey(), partition_(sistrip::invalid_), apvPairNumber_(sistrip::invalid_), apvWithinPair_(sistrip::invalid_) { SiStripKey& temp = const_cast<SiStripKey&>(input); SiStripDetKey& det_key = dynamic_cast<SiStripDetKey&>(temp); if ( (&det_key) ) { key(det_key.key()); path(det_key.path()); granularity(det_key.granularity()); partition_ = det_key.partition(); apvPairNumber_ = det_key.apvPairNumber(); apvWithinPair_ = det_key.apvWithinPair(); } }
SiStripDetKey::SiStripDetKey | ( | const SiStripKey & | input, |
const sistrip::Granularity & | gran | ||
) |
Copy to level specified by granularity.
Definition at line 120 of file SiStripDetKey.cc.
References initFromKey(), initFromPath(), initFromValue(), initGranularity(), LaserDQM_cfg::input, sistrip::PARTITION, partition(), partition_, and groupFilesInBlocks::temp.
: SiStripKey(), partition_(0), apvPairNumber_(0), apvWithinPair_(0) { SiStripKey& temp = const_cast<SiStripKey&>(input); SiStripDetKey& det_key = dynamic_cast<SiStripDetKey&>(temp); if ( (&det_key) ) { if ( gran == sistrip::PARTITION ) { partition_ = det_key.partition(); } initFromValue(); initFromKey(); initFromPath(); initGranularity(); } }
SiStripDetKey::SiStripDetKey | ( | ) |
Default constructor
Definition at line 146 of file SiStripDetKey.cc.
const uint16_t & SiStripDetKey::apvPairNumber | ( | ) | const [inline] |
Returns APV pair number.
Definition at line 143 of file SiStripDetKey.h.
References apvPairNumber_.
Referenced by isConsistent(), isEqual(), and SiStripDetKey().
{ return apvPairNumber_; }
const uint16_t & SiStripDetKey::apvWithinPair | ( | ) | const [inline] |
Returns APV position within pair.
Definition at line 144 of file SiStripDetKey.h.
References apvWithinPair_.
Referenced by isConsistent(), isEqual(), and SiStripDetKey().
{ return apvWithinPair_; }
void SiStripDetKey::initFromKey | ( | ) | [private, virtual] |
Reimplemented from SiStripKey.
Definition at line 234 of file SiStripDetKey.cc.
References sistrip::invalid32_, sistrip::invalid_, SiStripKey::key(), partition_, partitionMask_, and partitionOffset_.
Referenced by SiStripDetKey().
{ if ( key() == sistrip::invalid32_ ) { // ---------- Set DetKey based on member data ---------- // Initialise to null value key(0); // Extract partition if ( partition_ >= 1 && //sistrip::PARTITION_MIN && partition_ <= 4 ) { //sistrip::PARTITION_MAX ) { key( key() | (partition_<<partitionOffset_) ); } else if ( partition_ == 0 ) { key( key() | (partition_<<partitionOffset_) ); } else { key( key() | (partitionMask_<<partitionOffset_) ); } } else { // ---------- Set member data based on Det key ---------- partition_ = ( key()>>partitionOffset_ ) & partitionMask_; if ( partition_ == partitionMask_ ) { partition_ = sistrip::invalid_; } } }
void SiStripDetKey::initFromPath | ( | ) | [private, virtual] |
Reimplemented from SiStripKey.
Definition at line 267 of file SiStripDetKey.cc.
References sistrip::detectorView_, dir, sistrip::dir_, spr::find(), sistrip::null_, partition(), sistrip::partition_, partition_, SiStripKey::path(), sistrip::root_, and groupFilesInBlocks::temp.
Referenced by SiStripDetKey().
{ if ( path() == sistrip::null_ ) { // ---------- Set directory path based on member data ---------- std::stringstream dir; dir << sistrip::root_ << sistrip::dir_ << sistrip::detectorView_ << sistrip::dir_; // Add partition if ( partition_ ) { dir << sistrip::partition_ << partition_ << sistrip::dir_; } std::string temp( dir.str() ); path( temp ); } else { // ---------- Set member data based on directory path ---------- partition_ = 0; // Check if root is found if ( path().find( sistrip::root_ ) == std::string::npos ) { std::string temp = path(); path( std::string(sistrip::root_) + sistrip::dir_ + temp ); } size_t curr = 0; // current string position size_t next = 0; // next string position next = path().find( sistrip::detectorView_, curr ); // Extract view curr = next; if ( curr != std::string::npos ) { next = path().find( sistrip::partition_, curr ); std::string detector_view( path(), curr+(sizeof(sistrip::detectorView_) - 1), next-(sizeof(sistrip::dir_) - 1)-curr ); // Extract partition curr = next; if ( curr != std::string::npos ) { next = std::string::npos; std::string partition( path(), curr+(sizeof(sistrip::partition_) - 1), next-(sizeof(sistrip::dir_) - 1)-curr ); partition_ = std::atoi( partition.c_str() ); } } else { std::stringstream ss; ss << sistrip::root_ << sistrip::dir_; //ss << sistrip::root_ << sistrip::dir_ //<< sistrip::unknownView_ << sistrip::dir_; std::string temp( ss.str() ); path( temp ); } } }
void SiStripDetKey::initFromValue | ( | ) | [private, virtual] |
Reimplemented from SiStripKey.
Definition at line 220 of file SiStripDetKey.cc.
References sistrip::invalid_, and partition_.
Referenced by SiStripDetKey().
{ // partition if ( partition_ >= 1 && //sistrip::PARTITION_MIN && partition_ <= 4 ) { //sistrip::PARTITION_MAX ) { partition_ = partition_; } else if ( partition_ == 0 ) { partition_ = 0; } else { partition_ = sistrip::invalid_; } }
void SiStripDetKey::initGranularity | ( | ) | [private, virtual] |
Reimplemented from SiStripKey.
Definition at line 333 of file SiStripDetKey.cc.
References SiStripKey::channel(), SiStripKey::granularity(), sistrip::invalid_, sistrip::PARTITION, partition_, sistrip::TRACKER, and sistrip::UNKNOWN_GRAN.
Referenced by SiStripDetKey().
{ granularity( sistrip::TRACKER ); channel(0); if ( partition_ && partition_ != sistrip::invalid_ ) { granularity( sistrip::PARTITION ); channel(partition_); } else if ( partition_ == sistrip::invalid_ ) { granularity( sistrip::UNKNOWN_GRAN ); channel(sistrip::invalid_); } }
bool SiStripDetKey::isConsistent | ( | const SiStripKey & | key | ) | const [virtual] |
"Consistent" means identical and/or null (ie, "all") data.
Reimplemented from SiStripKey.
Definition at line 168 of file SiStripDetKey.cc.
References apvPairNumber(), apvPairNumber_, apvWithinPair(), apvWithinPair_, LaserDQM_cfg::input, isEqual(), SiStripKey::key(), partition(), partition_, and groupFilesInBlocks::temp.
{ SiStripKey& temp = const_cast<SiStripKey&>(key); SiStripDetKey& input = dynamic_cast<SiStripDetKey&>(temp); if ( !(&input) ) { return false; } if ( isEqual(input) ) { return false; } else if ( ( partition_ == 0 || input.partition() == 0 ) && ( apvPairNumber_ == 0 || input.apvPairNumber() == 0 ) && ( apvWithinPair_ == 0 || input.apvWithinPair() == 0 ) ) { return true; } else { return false; } }
bool SiStripDetKey::isEqual | ( | const SiStripKey & | key | ) | const [virtual] |
Identifies key objects with identical member data.
Reimplemented from SiStripKey.
Definition at line 155 of file SiStripDetKey.cc.
References apvPairNumber(), apvPairNumber_, apvWithinPair(), apvWithinPair_, LaserDQM_cfg::input, SiStripKey::key(), partition(), partition_, and groupFilesInBlocks::temp.
Referenced by isConsistent().
{ SiStripKey& temp = const_cast<SiStripKey&>(key); SiStripDetKey& input = dynamic_cast<SiStripDetKey&>(temp); if ( !(&input) ) { return false; } if ( partition_ == input.partition() && apvPairNumber_ == input.apvPairNumber() && apvWithinPair_ == input.apvWithinPair() ) { return true; } else { return false; } }
bool SiStripDetKey::isInvalid | ( | const sistrip::Granularity & | gran | ) | const [virtual] |
All member data to level of "Granularity" are invalid. If sistrip::Granularity is "undefined", returns true.
Reimplemented from SiStripKey.
Definition at line 207 of file SiStripDetKey.cc.
References sistrip::invalid_, sistrip::PARTITION, partition_, sistrip::TRACKER, sistrip::UNDEFINED_GRAN, and sistrip::UNKNOWN_GRAN.
{ if ( gran == sistrip::TRACKER ) { return false; } else if ( gran == sistrip::UNDEFINED_GRAN || gran == sistrip::UNKNOWN_GRAN ) { return false; } if ( partition_ == sistrip::invalid_ ) { if ( gran == sistrip::PARTITION ) { return true; } } return false; }
bool SiStripDetKey::isInvalid | ( | ) | const [virtual] |
Identifies all member data as being invalid.
Reimplemented from SiStripKey.
Definition at line 201 of file SiStripDetKey.cc.
References sistrip::APV.
{ return isInvalid(sistrip::APV); }
bool SiStripDetKey::isValid | ( | const sistrip::Granularity & | gran | ) | const [virtual] |
All member data to level of "Granularity" are valid. If sistrip::Granularity is "undefined", returns false.
Reimplemented from SiStripKey.
Definition at line 188 of file SiStripDetKey.cc.
References sistrip::invalid_, sistrip::PARTITION, partition_, sistrip::TRACKER, sistrip::UNDEFINED_GRAN, and sistrip::UNKNOWN_GRAN.
{ if ( gran == sistrip::TRACKER ) { return true; } else if ( gran == sistrip::UNDEFINED_GRAN || gran == sistrip::UNKNOWN_GRAN ) { return false; } if ( partition_ != sistrip::invalid_ ) { if ( gran == sistrip::PARTITION ) { return true; } } return false; }
bool SiStripDetKey::isValid | ( | void | ) | const [virtual] |
Identifies all member data as being "valid" or null ("all").
Reimplemented from SiStripKey.
Definition at line 182 of file SiStripDetKey.cc.
References sistrip::APV.
Referenced by print().
{ return isValid(sistrip::APV); }
const uint16_t & SiStripDetKey::partition | ( | ) | const [inline] |
Returns partition.
Definition at line 142 of file SiStripDetKey.h.
References partition_.
Referenced by initFromPath(), isConsistent(), isEqual(), print(), SiStripDetKey(), and terse().
{ return partition_; }
void SiStripDetKey::print | ( | std::stringstream & | ss | ) | const [virtual] |
Print member data of the key
Reimplemented from SiStripKey.
Definition at line 356 of file SiStripDetKey.cc.
References SiStripKey::channel(), SiStripKey::granularity(), isValid(), SiStripKey::key(), partition(), and SiStripKey::path().
Referenced by operator<<().
{ ss << " [SiStripDetKey::print]" << std::endl << std::hex << " 32-bit Det key : 0x" << std::setfill('0') << std::setw(8) << key() << std::endl << std::setfill(' ') << std::dec << " Partition : " << partition() << std::endl << " Directory : " << path() << std::endl << " Granularity : " << SiStripEnumsAndStrings::granularity( granularity() ) << std::endl << " Channel : " << channel() << std::endl << " isValid : " << isValid(); }
void SiStripDetKey::terse | ( | std::stringstream & | ss | ) | const [virtual] |
A terse summary of the key
Reimplemented from SiStripKey.
Definition at line 349 of file SiStripDetKey.cc.
References partition().
{ ss << "DET:partition= " << partition(); }
uint16_t SiStripDetKey::apvPairNumber_ [private] |
APV pair number [0,1-3,invalid].
Definition at line 127 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 130 of file SiStripDetKey.h.
Referenced by apvWithinPair(), isConsistent(), isEqual(), and SiStripDetKey().
uint16_t SiStripDetKey::partition_ [private] |
partition [0,1-4,invalid].
Definition at line 124 of file SiStripDetKey.h.
Referenced by initFromKey(), initFromPath(), initFromValue(), initGranularity(), isConsistent(), isEqual(), isInvalid(), isValid(), partition(), and SiStripDetKey().
const uint16_t SiStripDetKey::partitionMask_ = 0x07 [static, private] |
Definition at line 136 of file SiStripDetKey.h.
Referenced by initFromKey().
const uint16_t SiStripDetKey::partitionOffset_ = 29 [static, private] |
Definition at line 133 of file SiStripDetKey.h.
Referenced by initFromKey().