CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
bool isEqual (const SiStripKey &) const
 
bool isInvalid () const
 
bool isInvalid (const sistrip::Granularity &) const
 
bool isValid () const
 
bool isValid (const sistrip::Granularity &) const
 
const uint16_t & partition () const
 
virtual void print (std::stringstream &ss) const
 
 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 ()
 
virtual void terse (std::stringstream &ss) const
 
- 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 ()
 
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
 

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 29 of file SiStripDetKey.h.

Constructor & Destructor Documentation

SiStripDetKey::SiStripDetKey ( const uint16_t &  partition)

Constructor using partition.

Definition at line 10 of file SiStripDetKey.cc.

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

10  :
11  SiStripKey(),
15 {
16  // order is important!
17  initFromValue();
18  initFromKey();
19  initFromPath();
21 }
uint16_t apvPairNumber_
void initFromValue()
const uint16_t & partition() const
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t apvWithinPair_
void initGranularity()
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 25 of file SiStripDetKey.cc.

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

27  :
28  SiStripKey(),
30  apvPairNumber_(apv_pair_number),
31  apvWithinPair_(apv_within_pair)
32 {
33  // order is important!
34  initFromValue();
35  initFromKey();
36  initFromPath();
38 }
uint16_t apvPairNumber_
void initFromValue()
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t apvWithinPair_
void initGranularity()
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripDetId det_id)

Constructor using SiStripDetId.

Definition at line 42 of file SiStripDetKey.cc.

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

42  :
43  SiStripKey(),
47 {
48  // order is important!
49  initFromValue();
50  initFromKey();
51  initFromPath();
53 }
uint16_t apvPairNumber_
void initFromValue()
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t apvWithinPair_
void initGranularity()
uint16_t partition_
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().

57  :
58  SiStripKey(det_key),
62 {
63  // order is important!
64  initFromKey();
65  initFromValue();
66  initFromPath();
68 }
uint16_t apvPairNumber_
void initFromValue()
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t apvWithinPair_
void initGranularity()
uint16_t partition_
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().

72  :
77 {
78  // order is important!
79  initFromPath();
80  initFromValue();
81  initFromKey();
83 }
uint16_t apvPairNumber_
void initFromValue()
const std::string & path() const
Definition: SiStripKey.h:127
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t apvWithinPair_
void initGranularity()
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripDetKey input)

Copy constructor.

Definition at line 87 of file SiStripDetKey.cc.

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

87  :
88  SiStripKey(),
89  partition_(input.partition()),
90  apvPairNumber_(input.apvPairNumber()),
92 {
93  key(input.key());
94  path(input.path());
95  granularity(input.granularity());
96 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:126
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:128
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const std::string & path() const
Definition: SiStripKey.h:127
const uint16_t & apvPairNumber() const
uint16_t apvWithinPair_
uint16_t partition_
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_, and SiStripKey::path().

100  :
101  SiStripKey(),
105 {
106  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
107  if ( (&det_key) ) {
108  key(det_key.key());
109  path(det_key.path());
110  granularity(det_key.granularity());
111  partition_ = det_key.partition();
112  apvPairNumber_ = det_key.apvPairNumber();
113  apvWithinPair_ = det_key.apvWithinPair();
114  }
115 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:126
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:128
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
const std::string & path() const
Definition: SiStripKey.h:127
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:29
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t apvWithinPair_
uint16_t partition_
SiStripDetKey::SiStripDetKey ( const SiStripKey input,
const sistrip::Granularity gran 
)

Copy to level specified by granularity.

Definition at line 119 of file SiStripDetKey.cc.

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

120  :
121  SiStripKey(),
122  partition_(0),
123  apvPairNumber_(0),
124  apvWithinPair_(0)
125 {
126  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
127  if ( (&det_key) ) {
128 
129  if ( gran == sistrip::PARTITION ) {
130  partition_ = det_key.partition();
131  }
132 
133  initFromValue();
134  initFromKey();
135  initFromPath();
136  initGranularity();
137 
138  }
139 
140 }
uint16_t apvPairNumber_
void initFromValue()
const uint16_t & partition() const
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:29
uint16_t apvWithinPair_
void initGranularity()
uint16_t partition_
SiStripDetKey::SiStripDetKey ( )

Default constructor

Definition at line 144 of file SiStripDetKey.cc.

144  :
145  SiStripKey(),
149 {;}
uint16_t apvPairNumber_
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t apvWithinPair_
uint16_t partition_

Member Function Documentation

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

143 { return apvPairNumber_; }
uint16_t 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().

144 { return apvWithinPair_; }
uint16_t apvWithinPair_
void SiStripDetKey::initFromKey ( )
privatevirtual

Reimplemented from SiStripKey.

Definition at line 230 of file SiStripDetKey.cc.

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

Referenced by SiStripDetKey().

230  {
231 
232  if ( key() == sistrip::invalid32_ ) {
233 
234  // ---------- Set DetKey based on member data ----------
235 
236  // Initialise to null value
237  key(0);
238 
239  // Extract partition
240  if ( partition_ >= 1 && //sistrip::PARTITION_MIN &&
241  partition_ <= 4 ) { //sistrip::PARTITION_MAX ) {
243  } else if ( partition_ == 0 ) {
245  } else {
247  }
248 
249  } else {
250 
251  // ---------- Set member data based on Det key ----------
252 
254 
256 
257  }
258 
259 }
static const uint32_t invalid32_
Definition: Constants.h:16
static const uint16_t partitionOffset_
const uint32_t & key() const
Definition: SiStripKey.h:126
static const uint16_t partitionMask_
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t partition_
void SiStripDetKey::initFromPath ( )
privatevirtual

Reimplemented from SiStripKey.

Definition at line 263 of file SiStripDetKey.cc.

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

Referenced by SiStripDetKey().

263  {
264 
265  if ( path() == sistrip::null_ ) {
266 
267  // ---------- Set directory path based on member data ----------
268 
269  std::stringstream dir;
270 
271  dir << sistrip::root_ << sistrip::dir_
273 
274  // Add partition
275  if ( partition_ ) {
277  }
278 
279  std::string temp( dir.str() );
280  path( temp );
281 
282  } else {
283 
284  // ---------- Set member data based on directory path ----------
285 
286  partition_ = 0;
287 
288  // Check if root is found
289  if ( path().find( sistrip::root_ ) == std::string::npos ) {
290  std::string temp = path();
291  path( std::string(sistrip::root_) + sistrip::dir_ + temp );
292  }
293 
294  size_t curr = 0; // current string position
295  size_t next = 0; // next string position
296  next = path().find( sistrip::detectorView_, curr );
297 
298  // Extract view
299  curr = next;
300  if ( curr != std::string::npos ) {
301  next = path().find( sistrip::partition_, curr );
302  std::string detector_view( path(),
303  curr+(sizeof(sistrip::detectorView_) - 1),
304  next-(sizeof(sistrip::dir_) - 1)-curr );
305  // Extract partition
306  curr = next;
307  if ( curr != std::string::npos ) {
308  next = std::string::npos;
310  curr+(sizeof(sistrip::partition_) - 1),
311  next-(sizeof(sistrip::dir_) - 1)-curr );
312  partition_ = std::atoi( partition.c_str() );
313  }
314  } else {
315  std::stringstream ss;
316  ss << sistrip::root_ << sistrip::dir_;
317  //ss << sistrip::root_ << sistrip::dir_
318  //<< sistrip::unknownView_ << sistrip::dir_;
319  std::string temp( ss.str() );
320  path( temp );
321  }
322 
323  }
324 
325 }
static const char dir_[]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static const char detectorView_[]
static const char partition_[]
const uint16_t & partition() const
const std::string & path() const
Definition: SiStripKey.h:127
static const char root_[]
dbl *** dir
Definition: mlp_gen.cc:35
uint16_t partition_
static const char null_[]
Definition: Constants.h:23
void SiStripDetKey::initFromValue ( )
privatevirtual

Reimplemented from SiStripKey.

Definition at line 216 of file SiStripDetKey.cc.

References sistrip::invalid_, and partition_.

Referenced by SiStripDetKey().

216  {
217 
218  // partition
219  if ( partition_ >= 1 && //sistrip::PARTITION_MIN &&
220  partition_ <= 4 ) { //sistrip::PARTITION_MAX ) {
222  } else if ( partition_ == 0 ) {
223  partition_ = 0;
224  } else { partition_ = sistrip::invalid_; }
225 
226 }
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t partition_
void SiStripDetKey::initGranularity ( )
privatevirtual

Reimplemented from SiStripKey.

Definition at line 329 of file SiStripDetKey.cc.

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

Referenced by SiStripDetKey().

329  {
330 
332  channel(0);
336  } else if ( partition_ == sistrip::invalid_ ) {
339  }
340 
341 }
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:128
const uint16_t & channel() const
Definition: SiStripKey.h:129
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t partition_
bool SiStripDetKey::isConsistent ( const SiStripKey key) const
virtual

"Consistent" means identical and/or null (ie, "all") data.

Reimplemented from SiStripKey.

Definition at line 165 of file SiStripDetKey.cc.

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

165  {
166  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
167  if ( !(&input) ) { return false; }
168  if ( isEqual(input) ) { return false; }
169  else if ( ( partition_ == 0 || input.partition() == 0 ) &&
170  ( apvPairNumber_ == 0 || input.apvPairNumber() == 0 ) &&
171  ( apvWithinPair_ == 0 || input.apvWithinPair() == 0 ) ) {
172  return true;
173  } else { return false; }
174 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:126
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:29
bool isEqual(const SiStripKey &) const
uint16_t apvWithinPair_
uint16_t partition_
bool SiStripDetKey::isEqual ( const SiStripKey key) const
virtual

Identifies key objects with identical member data.

Reimplemented from SiStripKey.

Definition at line 153 of file SiStripDetKey.cc.

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

Referenced by isConsistent().

153  {
154  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
155  if ( !(&input) ) { return false; }
156  if ( partition_ == input.partition() &&
157  apvPairNumber_ == input.apvPairNumber() &&
158  apvWithinPair_ == input.apvWithinPair() ) {
159  return true;
160  } else { return false; }
161 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:126
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:29
uint16_t apvWithinPair_
uint16_t partition_
bool SiStripDetKey::isInvalid ( ) const
virtual

Identifies all member data as being invalid.

Reimplemented from SiStripKey.

Definition at line 197 of file SiStripDetKey.cc.

References sistrip::APV.

197  {
198  return isInvalid(sistrip::APV);
199 }
bool isInvalid() const
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 203 of file SiStripDetKey.cc.

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

203  {
204  if ( gran == sistrip::TRACKER ) { return false; }
205  else if ( gran == sistrip::UNDEFINED_GRAN ||
206  gran == sistrip::UNKNOWN_GRAN ) { return false; }
207 
208  if ( partition_ == sistrip::invalid_ ) {
209  if ( gran == sistrip::PARTITION ) { return true; }
210  }
211  return false;
212 }
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t partition_
bool SiStripDetKey::isValid ( void  ) const
virtual

Identifies all member data as being "valid" or null ("all").

Reimplemented from SiStripKey.

Definition at line 178 of file SiStripDetKey.cc.

References sistrip::APV.

Referenced by print().

178  {
179  return isValid(sistrip::APV);
180 }
bool isValid() const
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 184 of file SiStripDetKey.cc.

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

184  {
185  if ( gran == sistrip::TRACKER ) { return true; }
186  else if ( gran == sistrip::UNDEFINED_GRAN ||
187  gran == sistrip::UNKNOWN_GRAN ) { return false; }
188 
189  if ( partition_ != sistrip::invalid_ ) {
190  if ( gran == sistrip::PARTITION ) { return true; }
191  }
192  return false;
193 }
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t partition_
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().

142 { return partition_; }
uint16_t partition_
void SiStripDetKey::print ( std::stringstream &  ss) const
virtual

Print member data of the key

Reimplemented from SiStripKey.

Definition at line 352 of file SiStripDetKey.cc.

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

Referenced by operator<<().

352  {
353  ss << " [SiStripDetKey::print]" << std::endl
354  << std::hex
355  << " 32-bit Det key : 0x"
356  << std::setfill('0')
357  << std::setw(8) << key() << std::endl
358  << std::setfill(' ')
359  << std::dec
360  << " Partition : " << partition() << std::endl
361  << " Directory : " << path() << std::endl
362  << " Granularity : "
364  << " Channel : " << channel() << std::endl
365  << " isValid : " << isValid();
366 }
static std::string granularity(const sistrip::Granularity &)
const uint32_t & key() const
Definition: SiStripKey.h:126
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:128
const uint16_t & partition() const
const std::string & path() const
Definition: SiStripKey.h:127
const uint16_t & channel() const
Definition: SiStripKey.h:129
bool isValid() const
void SiStripDetKey::terse ( std::stringstream &  ss) const
virtual

A terse summary of the key

Reimplemented from SiStripKey.

Definition at line 345 of file SiStripDetKey.cc.

References partition().

345  {
346  ss << "DET:partition= "
347  << partition();
348 }
const uint16_t & partition() const

Member Data Documentation

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
const uint16_t SiStripDetKey::partitionMask_ = 0x07
staticprivate

Definition at line 136 of file SiStripDetKey.h.

Referenced by initFromKey().

const uint16_t SiStripDetKey::partitionOffset_ = 29
staticprivate

Definition at line 133 of file SiStripDetKey.h.

Referenced by initFromKey().