Provides dense hash map in place of DetId. More...
#include <SiStripHashedDetId.h>
Public Types | |
typedef std::vector< uint32_t > ::const_iterator | const_iterator |
typedef std::vector< uint32_t > ::iterator | iterator |
Public Member Functions | |
const_iterator | begin () const |
const_iterator | end () const |
uint32_t | hashedIndex (uint32_t det_id) |
SiStripHashedDetId () | |
SiStripHashedDetId (const SiStripHashedDetId &) | |
SiStripHashedDetId (const std::vector< DetId > &) | |
SiStripHashedDetId (const std::vector< uint32_t > &) | |
uint32_t | unhashIndex (uint32_t hashed_index) const |
~SiStripHashedDetId () | |
Private Member Functions | |
void | init (const std::vector< uint32_t > &) |
Private Attributes | |
std::vector< uint32_t > | detIds_ |
uint32_t | id_ |
const_iterator | iter_ |
Provides dense hash map in place of DetId.
Definition at line 19 of file SiStripHashedDetId.h.
typedef std::vector<uint32_t>::const_iterator SiStripHashedDetId::const_iterator |
Definition at line 42 of file SiStripHashedDetId.h.
typedef std::vector<uint32_t>::iterator SiStripHashedDetId::iterator |
Definition at line 44 of file SiStripHashedDetId.h.
SiStripHashedDetId::SiStripHashedDetId | ( | const std::vector< uint32_t > & | raw_ids | ) |
Constructor taking raw DetIds as input.
Definition at line 13 of file SiStripHashedDetId.cc.
References init(), LogTrace, and sistrip::mlCabling_.
SiStripHashedDetId::SiStripHashedDetId | ( | const std::vector< DetId > & | det_ids | ) |
Constructor taking DetIds as input.
Definition at line 26 of file SiStripHashedDetId.cc.
References detIds_, init(), LogTrace, and sistrip::mlCabling_.
: detIds_(), id_(0), iter_(detIds_.begin()) { LogTrace(mlCabling_) << "[SiStripHashedDetId::" << __func__ << "]" << " Constructing object..."; detIds_.clear(); detIds_.reserve(16000); std::vector<DetId>::const_iterator iter = det_ids.begin(); for ( ; iter != det_ids.end(); ++iter ) { detIds_.push_back( iter->rawId() ); } init(detIds_); }
SiStripHashedDetId::SiStripHashedDetId | ( | const SiStripHashedDetId & | input | ) |
Copy constructor.
Definition at line 45 of file SiStripHashedDetId.cc.
References begin(), filterCSVwithJSON::copy, detIds_, end(), LogTrace, and sistrip::mlCabling_.
SiStripHashedDetId::SiStripHashedDetId | ( | ) |
Public default constructor.
Definition at line 59 of file SiStripHashedDetId.cc.
References LogTrace, and sistrip::mlCabling_.
SiStripHashedDetId::~SiStripHashedDetId | ( | ) |
Default destructor.
Definition at line 71 of file SiStripHashedDetId.cc.
References detIds_, LogTrace, and sistrip::mlCabling_.
{ LogTrace(mlCabling_) << "[SiStripHashedDetId::" << __func__ << "]" << " Destructing object..."; detIds_.clear(); }
SiStripHashedDetId::const_iterator SiStripHashedDetId::begin | ( | ) | const [inline] |
Returns DetId object for given hashed index.
Definition at line 92 of file SiStripHashedDetId.h.
References detIds_.
Referenced by hashedIndex(), operator<<(), SiStripHashedDetId(), and unhashIndex().
{ return detIds_.begin(); }
SiStripHashedDetId::const_iterator SiStripHashedDetId::end | ( | ) | const [inline] |
Definition at line 93 of file SiStripHashedDetId.h.
References detIds_.
Referenced by hashedIndex(), operator<<(), SiStripHashedDetId(), and unhashIndex().
{ return detIds_.end(); }
uint32_t SiStripHashedDetId::hashedIndex | ( | uint32_t | det_id | ) | [inline] |
Returns hashed index for given DetId.
Definition at line 74 of file SiStripHashedDetId.h.
References begin(), end(), spr::find(), id_, sistrip::invalid32_, and iter_.
void SiStripHashedDetId::init | ( | const std::vector< uint32_t > & | raw_ids | ) | [private] |
Definition at line 80 of file SiStripHashedDetId.cc.
References DetId::det(), cond::rpcobgas::detid, detIds_, id_, sistrip::invalid32_, sistrip::invalid_, iter_, sistrip::mlCabling_, python::multivaluedict::sort(), SiStripDetId::subDetector(), sistripsummary::TEC, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, and DetId::Tracker.
Referenced by SiStripHashedDetId().
{ detIds_.clear(); detIds_.reserve(16000); const_iterator iter = raw_ids.begin(); for ( ; iter != raw_ids.end(); ++iter ) { SiStripDetId detid(*iter); if ( *iter != sistrip::invalid32_ && *iter != sistrip::invalid_ && detid.det() == DetId::Tracker && ( detid.subDetector() == SiStripDetId::TID || detid.subDetector() == SiStripDetId::TIB || detid.subDetector() == SiStripDetId::TOB || detid.subDetector() == SiStripDetId::TEC ) ) { detIds_.push_back(*iter); } else { edm::LogWarning(mlCabling_) << "[SiStripHashedDetId::" << __func__ << "]" << " DetId 0x" << std::hex << std::setw(8) << std::setfill('0') << *iter << " is not from the strip tracker!"; } } if ( !detIds_.empty() ) { std::sort( detIds_.begin(), detIds_.end() ); id_ = detIds_.front(); iter_ = detIds_.begin(); } }
uint32_t SiStripHashedDetId::unhashIndex | ( | uint32_t | hashed_index | ) | const [inline] |
Returns raw (32-bit) DetId for given hashed index.
Definition at line 88 of file SiStripHashedDetId.h.
References begin(), detIds_, end(), and sistrip::invalid32_.
{ if ( hashed_index < static_cast<uint32_t>(end()-begin()) ) { return detIds_[hashed_index]; } else { return sistrip::invalid32_; } }
std::vector<uint32_t> SiStripHashedDetId::detIds_ [private] |
Sorted list of all silicon strip tracker DetIds.
Definition at line 66 of file SiStripHashedDetId.h.
Referenced by begin(), end(), init(), SiStripHashedDetId(), unhashIndex(), and ~SiStripHashedDetId().
uint32_t SiStripHashedDetId::id_ [private] |
Definition at line 68 of file SiStripHashedDetId.h.
Referenced by hashedIndex(), and init().
const_iterator SiStripHashedDetId::iter_ [private] |
Definition at line 70 of file SiStripHashedDetId.h.
Referenced by hashedIndex(), and init().