CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripFecKey.cc
Go to the documentation of this file.
1 // Last commit: $Id: SiStripFecKey.cc,v 1.22 2009/10/23 13:07:17 lowette Exp $
2 
10 #include <iomanip>
11 
12 // -----------------------------------------------------------------------------
13 //
14 SiStripFecKey::SiStripFecKey( const uint16_t& fec_crate,
15  const uint16_t& fec_slot,
16  const uint16_t& fec_ring,
17  const uint16_t& ccu_addr,
18  const uint16_t& ccu_chan,
19  const uint16_t& lld_chan,
20  const uint16_t& i2c_addr ) :
21  SiStripKey(),
22  fecCrate_(fec_crate),
23  fecSlot_(fec_slot),
24  fecRing_(fec_ring),
25  ccuAddr_(ccu_addr),
26  ccuChan_(ccu_chan),
27  lldChan_(lld_chan),
28  i2cAddr_(i2c_addr)
29 {
30  // order is important!
31  initFromValue();
32  initFromKey();
33  initFromPath();
35 }
36 
37 // -----------------------------------------------------------------------------
38 //
39 SiStripFecKey::SiStripFecKey( const uint32_t& fec_key ) :
40  SiStripKey(fec_key),
41  fecCrate_(sistrip::invalid_),
42  fecSlot_(sistrip::invalid_),
43  fecRing_(sistrip::invalid_),
44  ccuAddr_(sistrip::invalid_),
45  ccuChan_(sistrip::invalid_),
46  lldChan_(sistrip::invalid_),
47  i2cAddr_(sistrip::invalid_)
48 {
49  // order is important!
50  initFromKey();
51  initFromValue();
52  initFromPath();
54 }
55 
56 // -----------------------------------------------------------------------------
57 //
58 SiStripFecKey::SiStripFecKey( const std::string& path ) :
59  SiStripKey(path),
60  fecCrate_(sistrip::invalid_),
61  fecSlot_(sistrip::invalid_),
62  fecRing_(sistrip::invalid_),
63  ccuAddr_(sistrip::invalid_),
64  ccuChan_(sistrip::invalid_),
65  lldChan_(sistrip::invalid_),
66  i2cAddr_(sistrip::invalid_)
67 {
68  // order is important!
69  initFromPath();
70  initFromValue();
71  initFromKey();
73 }
74 
75 // -----------------------------------------------------------------------------
76 //
78  SiStripKey(),
79  fecCrate_(input.fecCrate()),
80  fecSlot_(input.fecSlot()),
81  fecRing_(input.fecRing()),
82  ccuAddr_(input.ccuAddr()),
83  ccuChan_(input.ccuChan()),
84  lldChan_(input.lldChan()),
85  i2cAddr_(input.i2cAddr())
86 {
87  key(input.key());
88  path(input.path());
89  granularity(input.granularity());
90 }
91 
92 // -----------------------------------------------------------------------------
93 //
95  SiStripKey(),
96  fecCrate_(sistrip::invalid_),
97  fecSlot_(sistrip::invalid_),
98  fecRing_(sistrip::invalid_),
99  ccuAddr_(sistrip::invalid_),
100  ccuChan_(sistrip::invalid_),
101  lldChan_(sistrip::invalid_),
102  i2cAddr_(sistrip::invalid_)
103 {
104  SiStripKey& temp = const_cast<SiStripKey&>(input);
105  SiStripFecKey& fec_key = dynamic_cast<SiStripFecKey&>(temp);
106  if ( (&fec_key) ) {
107  key(fec_key.key());
108  path(fec_key.path());
109  granularity(fec_key.granularity());
110  fecCrate_ = fec_key.fecCrate();
111  fecSlot_ = fec_key.fecSlot();
112  fecRing_ = fec_key.fecRing();
113  ccuAddr_ = fec_key.ccuAddr();
114  ccuChan_ = fec_key.ccuChan();
115  lldChan_ = fec_key.lldChan();
116  i2cAddr_ = fec_key.i2cAddr();
117  }
118 }
119 
120 // -----------------------------------------------------------------------------
121 //
123  const sistrip::Granularity& gran ) :
124  SiStripKey(),
125  fecCrate_(0),
126  fecSlot_(0),
127  fecRing_(0),
128  ccuAddr_(0),
129  ccuChan_(0),
130  lldChan_(0),
131  i2cAddr_(0)
132 {
133  SiStripKey& temp = const_cast<SiStripKey&>(input);
134  SiStripFecKey& fec_key = dynamic_cast<SiStripFecKey&>(temp);
135  if ( (&fec_key) ) {
136 
137  if ( gran == sistrip::FEC_CRATE || gran == sistrip::FEC_SLOT ||
138  gran == sistrip::FEC_RING || gran == sistrip::CCU_ADDR ||
139  gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
140  gran == sistrip::APV ) {
141  fecCrate_ = fec_key.fecCrate();
142  }
143 
144  if ( gran == sistrip::FEC_SLOT || gran == sistrip::FEC_RING ||
145  gran == sistrip::CCU_ADDR || gran == sistrip::CCU_CHAN ||
146  gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
147  fecSlot_ = fec_key.fecSlot();
148  }
149 
150  if ( gran == sistrip::FEC_RING || gran == sistrip::CCU_ADDR ||
151  gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
152  gran == sistrip::APV ) {
153  fecRing_ = fec_key.fecRing();
154  }
155 
156  if ( gran == sistrip::CCU_ADDR || gran == sistrip::CCU_CHAN ||
157  gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
158  ccuAddr_ = fec_key.ccuAddr();
159  }
160 
161  if ( gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
162  gran == sistrip::APV ) {
163  ccuChan_ = fec_key.ccuChan();
164  }
165 
166  if ( gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
167  lldChan_ = fec_key.lldChan();
168  }
169 
170  if ( gran == sistrip::APV ) {
171  i2cAddr_ = fec_key.i2cAddr();
172  }
173 
174  initFromValue();
175  initFromKey();
176  initFromPath();
177  initGranularity();
178 
179  }
180 
181 }
182 
183 // -----------------------------------------------------------------------------
184 //
186  SiStripKey(),
187  fecCrate_(sistrip::invalid_),
188  fecSlot_(sistrip::invalid_),
189  fecRing_(sistrip::invalid_),
190  ccuAddr_(sistrip::invalid_),
191  ccuChan_(sistrip::invalid_),
192  lldChan_(sistrip::invalid_),
193  i2cAddr_(sistrip::invalid_)
194 {;}
195 
196 // -----------------------------------------------------------------------------
197 //
198 uint16_t SiStripFecKey::hybridPos( const uint16_t& i2c_addr ) {
199  if ( i2c_addr < sistrip::APV_I2C_MIN ||
200  i2c_addr > sistrip::APV_I2C_MAX ) {
201  return sistrip::invalid_;
202  }
203  return ( i2c_addr - sistrip::APV_I2C_MIN + 1 );
204 }
205 
206 // -----------------------------------------------------------------------------
207 //
208 uint16_t SiStripFecKey::i2cAddr( const uint16_t& hybrid_pos ) {
209  if ( !hybrid_pos ||
210  hybrid_pos >
212  sistrip::APV_I2C_MIN + 1 ) ) {
213  return sistrip::invalid_;
214  }
215  return ( hybrid_pos + sistrip::APV_I2C_MIN - 1 );
216 }
217 
218 // -----------------------------------------------------------------------------
219 //
220 uint16_t SiStripFecKey::i2cAddr( const uint16_t& lld_chan,
221  const bool& first_apv ) {
222  if ( lld_chan < sistrip::LLD_CHAN_MIN ||
223  lld_chan > sistrip::LLD_CHAN_MAX ) {
224  return sistrip::invalid_;
225  }
226  return ( sistrip::APV_I2C_MIN + lld_chan * sistrip::APVS_PER_CHAN - (first_apv?2:1) );
227 }
228 
229 // -----------------------------------------------------------------------------
230 //
231 uint16_t SiStripFecKey::lldChan( const uint16_t& i2c_addr ) {
232  if ( i2c_addr == 0 ) { return 0; }
233  else if ( i2c_addr < sistrip::APV_I2C_MIN ||
234  i2c_addr > sistrip::APV_I2C_MAX ) {
235  return sistrip::invalid_;
236  }
237  return ( ( i2c_addr - sistrip::APV_I2C_MIN ) / 2 + 1 );
238 }
239 
240 // -----------------------------------------------------------------------------
241 //
242 bool SiStripFecKey::firstApvOfPair( const uint16_t& i2c_addr ) {
243  if ( i2c_addr < sistrip::APV_I2C_MIN ||
244  i2c_addr > sistrip::APV_I2C_MAX ) {
245  return sistrip::invalid_;
246  }
247  return ( ( ( i2c_addr - sistrip::APV_I2C_MIN ) % 2 ) == 0 );
248 }
249 
250 // -----------------------------------------------------------------------------
251 //
252 bool SiStripFecKey::isEqual( const SiStripKey& key ) const {
253  SiStripKey& temp = const_cast<SiStripKey&>(key);
254  SiStripFecKey& input = dynamic_cast<SiStripFecKey&>(temp);
255  if ( !(&input) ) { return false; }
256  if ( fecCrate_ == input.fecCrate() &&
257  fecSlot_ == input.fecSlot() &&
258  fecRing_ == input.fecRing() &&
259  ccuAddr_ == input.ccuAddr() &&
260  ccuChan_ == input.ccuChan() &&
261  lldChan_ == input.lldChan() &&
262  i2cAddr_ == input.i2cAddr() ) {
263  return true;
264  } else { return false; }
265 }
266 
267 // -----------------------------------------------------------------------------
268 //
270  SiStripKey& temp = const_cast<SiStripKey&>(key);
271  SiStripFecKey& input = dynamic_cast<SiStripFecKey&>(temp);
272  if ( !(&input) ) { return false; }
273  if ( isEqual(input) ) { return true; }
274  else if ( ( fecCrate_ == 0 || input.fecCrate() == 0 ) &&
275  ( fecSlot_ == 0 || input.fecSlot() == 0 ) &&
276  ( fecRing_ == 0 || input.fecRing() == 0 ) &&
277  ( ccuAddr_ == 0 || input.ccuAddr() == 0 ) &&
278  ( lldChan_ == 0 || input.lldChan() == 0 ) &&
279  ( i2cAddr_ == 0 || input.i2cAddr() == 0 ) ) {
280  return true;
281  } else { return false; }
282 }
283 
284 // -----------------------------------------------------------------------------
285 //
286 bool SiStripFecKey::isValid() const {
287  return isValid(sistrip::APV);
288 }
289 
290 // -----------------------------------------------------------------------------
291 //
292 bool SiStripFecKey::isValid( const sistrip::Granularity& gran ) const {
293  if ( gran == sistrip::FEC_SYSTEM ) { return true; }
294  else if ( gran == sistrip::UNDEFINED_GRAN ||
295  gran == sistrip::UNKNOWN_GRAN ) { return false; }
296 
297  if ( fecCrate_ != sistrip::invalid_ ) {
298  if ( gran == sistrip::FEC_CRATE ) { return true; }
299  if ( fecSlot_ != sistrip::invalid_ ) {
300  if ( gran == sistrip::FEC_RING ) { return true; }
301  if ( fecRing_ != sistrip::invalid_ ) {
302  if ( gran == sistrip::FEC_RING ) { return true; }
303  if ( ccuAddr_ != sistrip::invalid_ ) {
304  if ( gran == sistrip::CCU_ADDR ) { return true; }
305  if ( ccuChan_ != sistrip::invalid_ ) {
306  if ( gran == sistrip::CCU_CHAN ) { return true; }
307  if ( lldChan_ != sistrip::invalid_ ) {
308  if ( gran == sistrip::LLD_CHAN ) { return true; }
309  if ( i2cAddr_ != sistrip::invalid_ ) {
310  if ( gran == sistrip::APV ) { return true; }
311  }
312  }
313  }
314  }
315  }
316  }
317  }
318  return false;
319 }
320 
321 // -----------------------------------------------------------------------------
322 //
324  return isInvalid(sistrip::APV);
325 }
326 
327 // -----------------------------------------------------------------------------
328 //
330  if ( gran == sistrip::FEC_SYSTEM ) { return false; }
331  else if ( gran == sistrip::UNDEFINED_GRAN ||
332  gran == sistrip::UNKNOWN_GRAN ) { return false; }
333 
334  if ( fecCrate_ == sistrip::invalid_ ) {
335  if ( gran == sistrip::FEC_CRATE ) { return true; }
336  if ( fecSlot_ == sistrip::invalid_ ) {
337  if ( gran == sistrip::FEC_RING ) { return true; }
338  if ( fecRing_ == sistrip::invalid_ ) {
339  if ( gran == sistrip::FEC_RING ) { return true; }
340  if ( ccuAddr_ == sistrip::invalid_ ) {
341  if ( gran == sistrip::CCU_ADDR ) { return true; }
342  if ( ccuChan_ == sistrip::invalid_ ) {
343  if ( gran == sistrip::CCU_CHAN ) { return true; }
344  if ( lldChan_ == sistrip::invalid_ ) {
345  if ( gran == sistrip::LLD_CHAN ) { return true; }
346  if ( i2cAddr_ == sistrip::invalid_ ) {
347  if ( gran == sistrip::APV ) { return true; }
348  }
349  }
350  }
351  }
352  }
353  }
354  }
355  return false;
356 }
357 
358 // -----------------------------------------------------------------------------
359 //
361 
362  // FEC crate
366  } else if ( fecCrate_ == 0 ) {
367  fecCrate_ = 0;
368  } else { fecCrate_ = sistrip::invalid_; }
369 
370  // FEC slot
373  fecSlot_ = fecSlot_;
374  } else if ( fecSlot_ == 0 ) {
375  fecSlot_ = 0;
376  } else { fecSlot_ = sistrip::invalid_; }
377 
378  // FEC ring
381  fecRing_ = fecRing_;
382  } else if ( fecRing_ == 0 ) {
383  fecRing_ = 0;
384  } else { fecRing_ = sistrip::invalid_; }
385 
386  // CCU addr
389  ccuAddr_ = ccuAddr_;
390  } else if ( ccuAddr_ == 0 ) {
391  ccuAddr_ = 0;
392  } else { ccuAddr_ = sistrip::invalid_; }
393 
394  // CCU chan
397  ccuChan_ = ccuChan_;
398  } else if ( ccuChan_ == 0 ) {
399  ccuChan_ = 0;
400  } else { ccuChan_ = sistrip::invalid_; }
401 
402  // LLD channel
405  lldChan_ = lldChan_;
406  } else if ( lldChan_ == 0 ) {
407  lldChan_ = 0;
408  } else { lldChan_ = sistrip::invalid_; }
409 
410  // APV I2C address
411  if ( i2cAddr_ >= sistrip::APV_I2C_MIN &&
413  i2cAddr_ = i2cAddr_;
414  if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) {
416  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
417  }
418  } else if ( i2cAddr_ == 0 ) {
419  i2cAddr_ = 0;
420  } else { i2cAddr_ = sistrip::invalid_; }
421 
422 }
423 
424 // -----------------------------------------------------------------------------
425 //
427 
428  if ( key() == sistrip::invalid32_ ) {
429 
430  // ---------- Set FecKey based on member data ----------
431 
432  // Initialise to null value
433  key(0);
434 
435  // Extract FEC crate
438  key( key() | (fecCrate_<<fecCrateOffset_) );
439  } else if ( fecCrate_ == 0 ) {
440  key( key() | (fecCrate_<<fecCrateOffset_) );
441  } else {
443  }
444 
445  // Extract FEC slot
448  key( key() | (fecSlot_<<fecSlotOffset_) );
449  } else if ( fecSlot_ == 0 ) {
450  key( key() | (fecSlot_<<fecSlotOffset_) );
451  } else {
452  key( key() | (fecSlotMask_<<fecSlotOffset_) );
453  }
454 
455  // Extract FEC ring
458  key( key() | (fecRing_<<fecRingOffset_) );
459  } else if ( fecRing_ == 0 ) {
460  key( key() | (fecRing_<<fecRingOffset_) );
461  } else {
462  key( key() | (fecRingMask_<<fecRingOffset_) );
463  }
464 
465  // Extract CCU addr
468  key( key() | (ccuAddr_<<ccuAddrOffset_) );
469  } else if ( ccuAddr_ == 0 ) {
470  key( key() | (ccuAddr_<<ccuAddrOffset_) );
471  } else {
472  key( key() | (ccuAddrMask_<<ccuAddrOffset_) );
473  }
474 
475  // Extract CCU chan
478  key( key() | ( (ccuChan_-(sistrip::CCU_CHAN_MIN-1)) << ccuChanOffset_ ) );
479  } else if ( ccuChan_ == 0 ) {
480  key( key() | (ccuChan_<<ccuChanOffset_) );
481  } else {
482  key( key() | (ccuChanMask_<<ccuChanOffset_) );
483  }
484 
485  // Extract LLD channel
488  key( key() | (lldChan_<<lldChanOffset_) );
489  } else if ( lldChan_ == 0 ) {
490  key( key() | (lldChan_<<lldChanOffset_) );
491  } else {
492  key( key() | (lldChanMask_<<lldChanOffset_) );
493  }
494 
495  // Extract APV I2C address
496  if ( i2cAddr_ >= sistrip::APV_I2C_MIN &&
498  key( key() | ( ( firstApvOfPair( i2cAddr_ ) ? 1 : 2 ) << i2cAddrOffset_ ) ); // key encodes APV number (1 or 2)
499  if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) {
501  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
502  }
503  } else if ( i2cAddr_ == 0 ) {
504  key( key() | (i2cAddr_<<i2cAddrOffset_) );
505  } else {
506  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
507  }
508 
509  } else {
510 
511  // ---------- Set member data based on FEC key ----------
512 
520 
526  else if ( ccuChan_ ) { ccuChan_ += (sistrip::CCU_CHAN_MIN-1); }
529  else if ( i2cAddr_ && lldChan_ != lldChanMask_ ) { i2cAddr_ = i2cAddr( lldChan_, 2-i2cAddr_ ); }
530 
531  }
532 
533 }
534 
535 // -----------------------------------------------------------------------------
536 //
538 
539  if ( path() == sistrip::null_ ) {
540 
541  // ---------- Set directory path based on member data ----------
542 
543  std::stringstream dir;
544 
545  dir << sistrip::root_ << sistrip::dir_
547 
548  // Add FEC crate
549  if ( fecCrate_ ) {
551 
552  // Add FEC slot
553  if ( fecSlot_ ) {
555 
556  // Add FEC ring
557  if ( fecRing_ ) {
559 
560  // Add CCU address
561  if ( ccuAddr_ ) {
563 
564  // Add CCU channel
565  if ( ccuChan_ ) {
567 
568  // Add LLD channel
569  if ( lldChan_ ) {
571 
572  // Add APV I2C address
573  if ( i2cAddr_ ) {
574  dir << sistrip::apv_ << i2cAddr_ << sistrip::dir_;
575  }
576  }
577  }
578  }
579  }
580  }
581  }
582 
583  std::string temp( dir.str() );
584  path( temp );
585 
586  } else {
587 
588  // ---------- Set member data based on directory path ----------
589 
590  fecCrate_ = 0;
591  fecSlot_ = 0;
592  fecRing_ = 0;
593  ccuAddr_ = 0;
594  ccuChan_ = 0;
595  lldChan_ = 0;
596  i2cAddr_ = 0;
597 
598  // Check if root is found
599  if ( path().find( sistrip::root_ ) == std::string::npos ) {
600  std::string temp = path();
601  path( std::string(sistrip::root_) + sistrip::dir_ + temp );
602  }
603 
604  size_t curr = 0; // current string position
605  size_t next = 0; // next string position
606  next = path().find( sistrip::controlView_, curr );
607 
608  // Extract view
609  curr = next;
610  if ( curr != std::string::npos ) {
611  next = path().find( sistrip::fecCrate_, curr );
612  std::string control_view( path(),
613  curr+(sizeof(sistrip::controlView_) - 1),
614  next-(sizeof(sistrip::dir_) - 1)-curr );
615 
616  // Extract FEC crate
617  curr = next;
618  if ( curr != std::string::npos ) {
619  next = path().find( sistrip::fecSlot_, curr );
620  std::string fec_crate( path(),
621  curr+(sizeof(sistrip::fecCrate_) - 1),
622  next-(sizeof(sistrip::dir_) - 1)-curr );
623  fecCrate_ = std::atoi( fec_crate.c_str() );
624 
625  // Extract FEC slot
626  curr = next;
627  if ( curr != std::string::npos ) {
628  next = path().find( sistrip::fecRing_, curr );
629  std::string fec_slot( path(),
630  curr+(sizeof(sistrip::fecSlot_) - 1),
631  next-(sizeof(sistrip::dir_) - 1)-curr );
632  fecSlot_ = std::atoi( fec_slot.c_str() );
633 
634  // Extract FEC ring
635  curr = next;
636  if ( curr != std::string::npos ) {
637  next = path().find( sistrip::ccuAddr_, curr );
638  std::string fec_ring( path(),
639  curr+(sizeof(sistrip::fecRing_) - 1),
640  next-(sizeof(sistrip::dir_) - 1)-curr );
641  fecRing_ = std::atoi( fec_ring.c_str() );
642 
643  // Extract CCU address
644  curr = next;
645  if ( curr != std::string::npos ) {
646  next = path().find( sistrip::ccuChan_, curr );
647  std::string ccu_addr( path(),
648  curr+(sizeof(sistrip::ccuAddr_) - 1),
649  next-(sizeof(sistrip::dir_) - 1)-curr );
650  ccuAddr_ = std::atoi( ccu_addr.c_str() );
651 
652  // Extract CCU channel
653  curr = next;
654  if ( curr != std::string::npos ) {
655  next = path().find( sistrip::lldChan_, curr );
656  std::string ccu_chan( path(),
657  curr+(sizeof(sistrip::ccuChan_) - 1),
658  next-(sizeof(sistrip::dir_) - 1)-curr );
659  ccuChan_ = std::atoi( ccu_chan.c_str() );
660 
661  // Extract LLD channel
662  curr = next;
663  if ( curr != std::string::npos ) {
664  next = path().find( sistrip::apv_, curr );
665  std::string lld_chan( path(),
666  curr+(sizeof(sistrip::lldChan_) - 1),
667  next-(sizeof(sistrip::dir_) - 1)-curr );
668  lldChan_ = std::atoi( lld_chan.c_str() );
669 
670  // Extract I2C address
671  curr = next;
672  if ( curr != std::string::npos ) {
673  next = std::string::npos;
674  std::string i2c_addr( path(),
675  curr+(sizeof(sistrip::apv_) - 1),
676  next-curr );
677  i2cAddr_ = std::atoi( i2c_addr.c_str() );
678  }
679  }
680  }
681  }
682  }
683  }
684  }
685  } else {
686  std::stringstream ss;
687  ss << sistrip::root_ << sistrip::dir_;
688  //ss << sistrip::root_ << sistrip::dir_
689  //<< sistrip::unknownView_ << sistrip::dir_;
690  std::string temp( ss.str() );
691  path( temp );
692  }
693 
694  }
695 
696 }
697 
698 // -----------------------------------------------------------------------------
699 //
701 
703  channel(0);
704  if ( fecCrate_ && fecCrate_ != sistrip::invalid_ ) {
707  if ( fecSlot_ && fecSlot_ != sistrip::invalid_ ) {
709  channel(fecSlot_);
710  if ( fecRing_ && fecRing_ != sistrip::invalid_ ) {
712  channel(fecRing_);
713  if ( ccuAddr_ && ccuAddr_ != sistrip::invalid_ ) {
715  channel(ccuAddr_);
716  if ( ccuChan_ && ccuChan_ != sistrip::invalid_ ) {
718  channel(ccuChan_);
719  if ( lldChan_ && lldChan_ != sistrip::invalid_ ) {
721  channel(lldChan_);
722  if ( i2cAddr_ && i2cAddr_ != sistrip::invalid_ ) {
724  channel(i2cAddr_);
725  } else if ( i2cAddr_ == sistrip::invalid_ ) {
728  }
729  } else if ( lldChan_ == sistrip::invalid_ ) {
732  }
733  } else if ( ccuChan_ == sistrip::invalid_ ) {
736  }
737  } else if ( ccuAddr_ == sistrip::invalid_ ) {
740  }
741  } else if ( fecRing_ == sistrip::invalid_ ) {
744  }
745  } else if ( fecSlot_ == sistrip::invalid_ ) {
748  }
749  } else if ( fecCrate_ == sistrip::invalid_ ) {
752  }
753 
754 }
755 
756 // -----------------------------------------------------------------------------
757 //
758 void SiStripFecKey::terse( std::stringstream& ss ) const {
759  ss << "FEC:crate/slot/ring/CCU/module/LLD/I2C= "
760  << fecCrate() << "/"
761  << fecSlot() << "/"
762  << fecRing() << "/"
763  << ccuAddr() << "/"
764  << ccuChan() << "/"
765  << lldChan() << "/"
766  << i2cAddr();
767 // ss << " FecKey"
768 // //<< "=0x"
769 // //<< std::hex
770 // //<< std::setfill('0') << std::setw(8) << key() << std::setfill(' ')
771 // //<< std::dec
772 // //<< ", " << ( isValid() ? "Valid" : "Invalid" )
773 // << ", Crate=" << fecCrate()
774 // << ", Slot=" << fecSlot()
775 // << ", Ring=" << fecRing()
776 // << ", CCU=" << ccuAddr()
777 // << ", module=" << ccuChan()
778 // << ", LLD=" << lldChan()
779 // << ", I2C=" << i2cAddr();
780 }
781 
782 // -----------------------------------------------------------------------------
783 //
784 void SiStripFecKey::print( std::stringstream& ss ) const {
785  ss << " [SiStripFecKey::print]" << std::endl
786  << std::hex
787  << " FEC key : 0x"
788  << std::setfill('0')
789  << std::setw(8) << key() << std::endl
790  << std::setfill(' ')
791  << std::dec
792  << " FEC VME crate : " << fecCrate() << std::endl
793  << " FEC VME slot : " << fecSlot() << std::endl
794  << " FEC control ring : " << fecRing() << std::endl
795  << " CCU I2C address : " << ccuAddr() << std::endl
796  << " CCU chan (FE module) : " << ccuChan() << std::endl
797  << " LaserDriver channel : " << lldChan() << std::endl
798  << " APV I2C address : " << i2cAddr() << std::endl
799  << " Directory : " << path() << std::endl
800  << " Granularity : "
802  << " Channel : " << channel() << std::endl
803  << " isValid : " << isValid();
804 }
805 
806 // -----------------------------------------------------------------------------
807 //
808 std::ostream& operator<< ( std::ostream& os, const SiStripFecKey& input ) {
809  std::stringstream ss;
810  input.print(ss);
811  os << ss.str();
812  return os;
813 }
814 
815 // -----------------------------------------------------------------------------
816 //
818  : mask_( key.fecCrate() ? sistrip::invalid_ : 0,
819  key.fecSlot() ? sistrip::invalid_ : 0,
820  key.fecRing() ? sistrip::invalid_ : 0,
821  key.ccuAddr() ? sistrip::invalid_ : 0,
822  key.ccuChan() ? sistrip::invalid_ : 0,
823  key.lldChan() ? sistrip::invalid_ : 0,
824  key.i2cAddr() ? sistrip::invalid_ : 0 ) {;}
825 
826 // -----------------------------------------------------------------------------
827 //
829  : mask_(SiStripNullKey()) {;}
830 
831 // -----------------------------------------------------------------------------
832 //
833 bool ConsistentWithKey::operator() ( const uint32_t& a, const uint32_t& b ) const {
834  return ( ( a & mask_.key() ) < ( b & mask_.key() ) );
835 }
uint16_t ccuAddr_
static const uint16_t ccuChanOffset_
static const uint16_t APV_I2C_MIN
static const uint16_t ccuChanMask_
static const uint16_t i2cAddrOffset_
const uint16_t & fecRing() const
static const char dir_[]
static const uint16_t CCU_ADDR_MAX
static const uint16_t CCU_CHAN_MAX
uint16_t fecSlot_
Various generic constants used by DQM.
static const uint16_t CCU_CHAN_MIN
static const uint32_t invalid32_
Definition: Constants.h:16
uint16_t ccuChan_
static const uint16_t LLD_CHAN_MIN
static const uint16_t LLD_CHAN_MAX
static const uint16_t fecSlotMask_
uint16_t lldChan_
static const uint16_t fecRingOffset_
uint16_t fecCrate_
virtual void print(std::stringstream &ss) const
static const uint16_t FEC_CRATE_MIN
static std::string granularity(const sistrip::Granularity &)
uint16_t fecRing_
const uint16_t & lldChan() const
static const uint16_t CRATE_SLOT_MAX
const uint16_t & fecSlot() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const uint16_t & i2cAddr() const
static const uint16_t fecCrateMask_
static const uint16_t FEC_RING_MAX
static const char fecSlot_[]
Constants and enumerated types for sistrip::View.
const uint32_t & key() const
Definition: SiStripKey.h:126
static const char ccuChan_[]
static const char ccuAddr_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:46
static const uint16_t FEC_CRATE_MAX
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:128
static bool firstApvOfPair(const uint16_t &i2c_addr)
static const uint16_t lldChanOffset_
static const char lldChan_[]
static const uint16_t CCU_ADDR_MIN
list path
Definition: scaleCards.py:51
static uint16_t hybridPos(const uint16_t &i2c_addr)
void initFromValue()
static const char controlView_[]
bool isInvalid() const
static const char fecCrate_[]
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
static const char apv_[]
const uint16_t & fecCrate() const
static const uint16_t FEC_RING_MIN
static const uint16_t lldChanMask_
static const uint16_t CRATE_SLOT_MIN
bool isEqual(const SiStripKey &) const
const uint16_t & channel() const
Definition: SiStripKey.h:129
static const uint16_t fecSlotOffset_
Constants and enumerated types for FED/FEC systems.
uint16_t i2cAddr_
static const char fecRing_[]
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:17
double b
Definition: hdecay.h:120
bool operator()(const uint32_t &, const uint32_t &) const
static const uint16_t APVS_PER_CHAN
static const uint16_t ccuAddrMask_
SiStripFecKey mask_
list key
Definition: combine.py:13
bool isValid() const
static const uint16_t APV_I2C_MAX
double a
Definition: hdecay.h:121
Concrete implementation of abstract base, signifying null values or an &quot;unknown&quot; position or view...
static const char root_[]
static const uint16_t i2cAddrMask_
const uint16_t & ccuChan() const
static const uint16_t fecRingMask_
dbl *** dir
Definition: mlp_gen.cc:35
static const uint16_t fecCrateOffset_
void initGranularity()
bool isConsistent(const SiStripKey &) const
static const uint16_t ccuAddrOffset_
static const char null_[]
Definition: Constants.h:23
virtual void terse(std::stringstream &ss) const