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_, SiStripKey::path(), and groupFilesInBlocks::temp.

100  :
101  SiStripKey(),
105 {
106  SiStripKey& temp = const_cast<SiStripKey&>(input);
107  SiStripDetKey& det_key = dynamic_cast<SiStripDetKey&>(temp);
108  if ( (&det_key) ) {
109  key(det_key.key());
110  path(det_key.path());
111  granularity(det_key.granularity());
112  partition_ = det_key.partition();
113  apvPairNumber_ = det_key.apvPairNumber();
114  apvWithinPair_ = det_key.apvWithinPair();
115  }
116 }
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
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:24
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 120 of file SiStripDetKey.cc.

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

121  :
122  SiStripKey(),
123  partition_(0),
124  apvPairNumber_(0),
125  apvWithinPair_(0)
126 {
127  SiStripKey& temp = const_cast<SiStripKey&>(input);
128  SiStripDetKey& det_key = dynamic_cast<SiStripDetKey&>(temp);
129  if ( (&det_key) ) {
130 
131  if ( gran == sistrip::PARTITION ) {
132  partition_ = det_key.partition();
133  }
134 
135  initFromValue();
136  initFromKey();
137  initFromPath();
138  initGranularity();
139 
140  }
141 
142 }
uint16_t apvPairNumber_
void initFromValue()
const uint16_t & partition() const
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:24
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 146 of file SiStripDetKey.cc.

146  :
147  SiStripKey(),
151 {;}
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 234 of file SiStripDetKey.cc.

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

Referenced by SiStripDetKey().

234  {
235 
236  if ( key() == sistrip::invalid32_ ) {
237 
238  // ---------- Set DetKey based on member data ----------
239 
240  // Initialise to null value
241  key(0);
242 
243  // Extract partition
244  if ( partition_ >= 1 && //sistrip::PARTITION_MIN &&
245  partition_ <= 4 ) { //sistrip::PARTITION_MAX ) {
247  } else if ( partition_ == 0 ) {
249  } else {
251  }
252 
253  } else {
254 
255  // ---------- Set member data based on Det key ----------
256 
258 
260 
261  }
262 
263 }
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 267 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_, and groupFilesInBlocks::temp.

Referenced by SiStripDetKey().

267  {
268 
269  if ( path() == sistrip::null_ ) {
270 
271  // ---------- Set directory path based on member data ----------
272 
273  std::stringstream dir;
274 
275  dir << sistrip::root_ << sistrip::dir_
277 
278  // Add partition
279  if ( partition_ ) {
281  }
282 
283  std::string temp( dir.str() );
284  path( temp );
285 
286  } else {
287 
288  // ---------- Set member data based on directory path ----------
289 
290  partition_ = 0;
291 
292  // Check if root is found
293  if ( path().find( sistrip::root_ ) == std::string::npos ) {
294  std::string temp = path();
295  path( std::string(sistrip::root_) + sistrip::dir_ + temp );
296  }
297 
298  size_t curr = 0; // current string position
299  size_t next = 0; // next string position
300  next = path().find( sistrip::detectorView_, curr );
301 
302  // Extract view
303  curr = next;
304  if ( curr != std::string::npos ) {
305  next = path().find( sistrip::partition_, curr );
306  std::string detector_view( path(),
307  curr+(sizeof(sistrip::detectorView_) - 1),
308  next-(sizeof(sistrip::dir_) - 1)-curr );
309  // Extract partition
310  curr = next;
311  if ( curr != std::string::npos ) {
312  next = std::string::npos;
313  std::string partition( path(),
314  curr+(sizeof(sistrip::partition_) - 1),
315  next-(sizeof(sistrip::dir_) - 1)-curr );
316  partition_ = std::atoi( partition.c_str() );
317  }
318  } else {
319  std::stringstream ss;
320  ss << sistrip::root_ << sistrip::dir_;
321  //ss << sistrip::root_ << sistrip::dir_
322  //<< sistrip::unknownView_ << sistrip::dir_;
323  std::string temp( ss.str() );
324  path( temp );
325  }
326 
327  }
328 
329 }
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 220 of file SiStripDetKey.cc.

References sistrip::invalid_, and partition_.

Referenced by SiStripDetKey().

220  {
221 
222  // partition
223  if ( partition_ >= 1 && //sistrip::PARTITION_MIN &&
224  partition_ <= 4 ) { //sistrip::PARTITION_MAX ) {
226  } else if ( partition_ == 0 ) {
227  partition_ = 0;
228  } else { partition_ = sistrip::invalid_; }
229 
230 }
static const uint16_t invalid_
Definition: Constants.h:17
uint16_t partition_
void SiStripDetKey::initGranularity ( )
privatevirtual

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

333  {
334 
336  channel(0);
340  } else if ( partition_ == sistrip::invalid_ ) {
343  }
344 
345 }
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 168 of file SiStripDetKey.cc.

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

168  {
169  SiStripKey& temp = const_cast<SiStripKey&>(key);
170  SiStripDetKey& input = dynamic_cast<SiStripDetKey&>(temp);
171  if ( !(&input) ) { return false; }
172  if ( isEqual(input) ) { return false; }
173  else if ( ( partition_ == 0 || input.partition() == 0 ) &&
174  ( apvPairNumber_ == 0 || input.apvPairNumber() == 0 ) &&
175  ( apvWithinPair_ == 0 || input.apvWithinPair() == 0 ) ) {
176  return true;
177  } else { return false; }
178 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:126
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:24
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 155 of file SiStripDetKey.cc.

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

Referenced by isConsistent().

155  {
156  SiStripKey& temp = const_cast<SiStripKey&>(key);
157  SiStripDetKey& input = dynamic_cast<SiStripDetKey&>(temp);
158  if ( !(&input) ) { return false; }
159  if ( partition_ == input.partition() &&
160  apvPairNumber_ == input.apvPairNumber() &&
161  apvWithinPair_ == input.apvWithinPair() ) {
162  return true;
163  } else { return false; }
164 }
uint16_t apvPairNumber_
const uint32_t & key() const
Definition: SiStripKey.h:126
const uint16_t & partition() const
const uint16_t & apvWithinPair() const
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:24
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 201 of file SiStripDetKey.cc.

References sistrip::APV.

201  {
202  return isInvalid(sistrip::APV);
203 }
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 207 of file SiStripDetKey.cc.

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

207  {
208  if ( gran == sistrip::TRACKER ) { return false; }
209  else if ( gran == sistrip::UNDEFINED_GRAN ||
210  gran == sistrip::UNKNOWN_GRAN ) { return false; }
211 
212  if ( partition_ == sistrip::invalid_ ) {
213  if ( gran == sistrip::PARTITION ) { return true; }
214  }
215  return false;
216 }
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 182 of file SiStripDetKey.cc.

References sistrip::APV.

Referenced by print().

182  {
183  return isValid(sistrip::APV);
184 }
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 188 of file SiStripDetKey.cc.

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

188  {
189  if ( gran == sistrip::TRACKER ) { return true; }
190  else if ( gran == sistrip::UNDEFINED_GRAN ||
191  gran == sistrip::UNKNOWN_GRAN ) { return false; }
192 
193  if ( partition_ != sistrip::invalid_ ) {
194  if ( gran == sistrip::PARTITION ) { return true; }
195  }
196  return false;
197 }
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 356 of file SiStripDetKey.cc.

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

Referenced by operator<<().

356  {
357  ss << " [SiStripDetKey::print]" << std::endl
358  << std::hex
359  << " 32-bit Det key : 0x"
360  << std::setfill('0')
361  << std::setw(8) << key() << std::endl
362  << std::setfill(' ')
363  << std::dec
364  << " Partition : " << partition() << std::endl
365  << " Directory : " << path() << std::endl
366  << " Granularity : "
368  << " Channel : " << channel() << std::endl
369  << " isValid : " << isValid();
370 }
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 349 of file SiStripDetKey.cc.

References partition().

349  {
350  ss << "DET:partition= "
351  << partition();
352 }
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().