CMS 3D CMS Logo

SiStripHashedDetId Class Reference

Author:
R.Bainbridge
More...

#include <CalibFormats/SiStripObjects/interface/SiStripHashedDetId.h>

List of all members.

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
 Returns DetId object for given hashed index.
const_iterator end () const
uint32_t hashedIndex (uint32_t det_id)
 Returns hashed index for given DetId.
 SiStripHashedDetId ()
 Public default constructor.
 SiStripHashedDetId (const SiStripHashedDetId &)
 Copy constructor.
 SiStripHashedDetId (const std::vector< DetId > &)
 Constructor taking DetIds as input.
 SiStripHashedDetId (const std::vector< uint32_t > &)
 Constructor taking raw DetIds as input.
uint32_t unhashIndex (uint32_t hashed_index) const
 Returns raw (32-bit) DetId for given hashed index.
 ~SiStripHashedDetId ()
 Default destructor.

Private Member Functions

void init (const std::vector< uint32_t > &)

Private Attributes

std::vector< uint32_t > detIds_
 Sorted list of all silicon strip tracker DetIds.
uint32_t id_
const_iterator iter_


Detailed Description

Author:
R.Bainbridge

Provides dense hash map in place of DetId

Definition at line 18 of file SiStripHashedDetId.h.


Member Typedef Documentation

typedef std::vector<uint32_t>::const_iterator SiStripHashedDetId::const_iterator

Definition at line 41 of file SiStripHashedDetId.h.

typedef std::vector<uint32_t>::iterator SiStripHashedDetId::iterator

Definition at line 43 of file SiStripHashedDetId.h.


Constructor & Destructor Documentation

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_.

00014   : detIds_(),
00015     id_(0),
00016     iter_(detIds_.begin())
00017 {
00018   LogTrace(mlCabling_)
00019     << "[SiStripHashedDetId::" << __func__ << "]"
00020     << " Constructing object...";
00021   init(raw_ids);
00022 }

SiStripHashedDetId::SiStripHashedDetId ( const std::vector< DetId > &  det_ids  ) 

Constructor taking DetIds as input.

Definition at line 26 of file SiStripHashedDetId.cc.

References detIds_, init(), iter, LogTrace, and sistrip::mlCabling_.

00027   : detIds_(),
00028     id_(0),
00029     iter_(detIds_.begin())
00030 {
00031   LogTrace(mlCabling_)
00032     << "[SiStripHashedDetId::" << __func__ << "]"
00033     << " Constructing object...";
00034   detIds_.clear();
00035   detIds_.reserve(16000);
00036   std::vector<DetId>::const_iterator iter = det_ids.begin();
00037   for ( ; iter != det_ids.end(); ++iter ) {
00038     detIds_.push_back( iter->rawId() );
00039   }
00040   init(detIds_);
00041 }

SiStripHashedDetId::SiStripHashedDetId ( const SiStripHashedDetId input  ) 

Copy constructor.

Definition at line 45 of file SiStripHashedDetId.cc.

References begin(), edmNew::copy(), detIds_, end(), LogTrace, and sistrip::mlCabling_.

00046   : detIds_(),
00047     id_(0),
00048     iter_(detIds_.begin())
00049 {
00050   LogTrace(mlCabling_)
00051     << "[SiStripHashedDetId::" << __func__ << "]"
00052     << " Constructing object...";
00053   detIds_.reserve( input.end() - input.begin() );
00054   std::copy( input.begin(), input.end(), detIds_.begin() );
00055 }

SiStripHashedDetId::SiStripHashedDetId (  ) 

Public default constructor.

Definition at line 59 of file SiStripHashedDetId.cc.

References LogTrace, and sistrip::mlCabling_.

00060   : detIds_(),
00061     id_(0),
00062     iter_(detIds_.begin())
00063 {
00064   LogTrace(mlCabling_) 
00065     << "[SiStripHashedDetId::" << __func__ << "]"
00066     << " Constructing object...";
00067 }

SiStripHashedDetId::~SiStripHashedDetId (  ) 

Default destructor.

Definition at line 71 of file SiStripHashedDetId.cc.

References detIds_, LogTrace, and sistrip::mlCabling_.

00071                                         {
00072   LogTrace(mlCabling_)
00073     << "[SiStripHashedDetId::" << __func__ << "]"
00074     << " Destructing object...";
00075   detIds_.clear();
00076 }


Member Function Documentation

SiStripHashedDetId::const_iterator SiStripHashedDetId::begin (  )  const [inline]

Returns DetId object for given hashed index.

Definition at line 91 of file SiStripHashedDetId.h.

References detIds_.

Referenced by hashedIndex(), operator<<(), SiStripHashedDetId(), and unhashIndex().

00091 { return detIds_.begin(); }

SiStripHashedDetId::const_iterator SiStripHashedDetId::end (  )  const [inline]

Definition at line 92 of file SiStripHashedDetId.h.

References detIds_.

Referenced by hashedIndex(), operator<<(), SiStripHashedDetId(), and unhashIndex().

00092 { return detIds_.end(); }

uint32_t SiStripHashedDetId::hashedIndex ( uint32_t  det_id  )  [inline]

Returns hashed index for given DetId.

Definition at line 73 of file SiStripHashedDetId.h.

References begin(), end(), find(), id_, sistrip::invalid32_, iter, and iter_.

00073                                                           { 
00074   const_iterator iter = end();
00075   if ( det_id > id_ ) { iter = find( iter_, end(), det_id ); }
00076   else { iter = find( begin(), iter_, det_id ); }
00077   if ( iter != end() ) { 
00078     id_ = det_id;
00079     iter_ = iter;
00080     return iter-begin(); 
00081   } else { 
00082     id_ = 0;
00083     iter_ = begin();
00084     return sistrip::invalid32_; 
00085   }
00086 }

void SiStripHashedDetId::init ( const std::vector< uint32_t > &  raw_ids  )  [private]

Definition at line 80 of file SiStripHashedDetId.cc.

References DetId::det(), detIds_, id_, sistrip::invalid32_, sistrip::invalid_, iter, iter_, sistrip::mlCabling_, python::multivaluedict::sort(), SiStripDetId::subDetector(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, and DetId::Tracker.

Referenced by SiStripHashedDetId().

00080                                                                   {
00081   detIds_.clear();
00082   detIds_.reserve(16000);
00083   const_iterator iter = raw_ids.begin();
00084   for ( ; iter != raw_ids.end(); ++iter ) {
00085     SiStripDetId detid(*iter);
00086     if ( *iter != sistrip::invalid32_ && 
00087          *iter != sistrip::invalid_ && 
00088          detid.det() == DetId::Tracker && 
00089          ( detid.subDetector() == SiStripDetId::TID || 
00090            detid.subDetector() == SiStripDetId::TIB || 
00091            detid.subDetector() == SiStripDetId::TOB || 
00092            detid.subDetector() == SiStripDetId::TEC ) ) { 
00093       detIds_.push_back(*iter);
00094     } else {
00095       edm::LogWarning(mlCabling_)
00096         << "[SiStripHashedDetId::" << __func__ << "]"
00097         << " DetId 0x" 
00098         << std::hex << std::setw(8) << std::setfill('0') << *iter
00099         << " is not from the strip tracker!";
00100     }
00101   }
00102   if ( !detIds_.empty() ) {
00103     std::sort( detIds_.begin(), detIds_.end() );
00104     id_ = detIds_.front();
00105     iter_ = detIds_.begin();
00106   }
00107 }

uint32_t SiStripHashedDetId::unhashIndex ( uint32_t  hashed_index  )  const [inline]

Returns raw (32-bit) DetId for given hashed index.

Definition at line 87 of file SiStripHashedDetId.h.

References begin(), detIds_, end(), and sistrip::invalid32_.

00087                                                                       { 
00088   if ( hashed_index < static_cast<uint32_t>(end()-begin()) ) { return detIds_[hashed_index]; }
00089   else { return sistrip::invalid32_; }
00090 }


Member Data Documentation

std::vector<uint32_t> SiStripHashedDetId::detIds_ [private]

Sorted list of all silicon strip tracker DetIds.

Definition at line 65 of file SiStripHashedDetId.h.

Referenced by begin(), end(), init(), SiStripHashedDetId(), unhashIndex(), and ~SiStripHashedDetId().

uint32_t SiStripHashedDetId::id_ [private]

Definition at line 67 of file SiStripHashedDetId.h.

Referenced by hashedIndex(), and init().

const_iterator SiStripHashedDetId::iter_ [private]

Definition at line 69 of file SiStripHashedDetId.h.

Referenced by hashedIndex(), and init().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:24 2009 for CMSSW by  doxygen 1.5.4