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 
9 #include <iomanip>
10 
11 // -----------------------------------------------------------------------------
12 //
13 SiStripFecKey::SiStripFecKey( const uint16_t& fec_crate,
14  const uint16_t& fec_slot,
15  const uint16_t& fec_ring,
16  const uint16_t& ccu_addr,
17  const uint16_t& ccu_chan,
18  const uint16_t& lld_chan,
19  const uint16_t& i2c_addr ) :
20  SiStripKey(),
21  fecCrate_(fec_crate),
22  fecSlot_(fec_slot),
23  fecRing_(fec_ring),
24  ccuAddr_(ccu_addr),
25  ccuChan_(ccu_chan),
26  lldChan_(lld_chan),
27  i2cAddr_(i2c_addr)
28 {
29  // order is important!
30  initFromValue();
31  initFromKey();
32  initFromPath();
34 }
35 
36 // -----------------------------------------------------------------------------
37 //
38 SiStripFecKey::SiStripFecKey( const uint32_t& fec_key ) :
39  SiStripKey(fec_key),
40  fecCrate_(sistrip::invalid_),
41  fecSlot_(sistrip::invalid_),
42  fecRing_(sistrip::invalid_),
43  ccuAddr_(sistrip::invalid_),
44  ccuChan_(sistrip::invalid_),
45  lldChan_(sistrip::invalid_),
46  i2cAddr_(sistrip::invalid_)
47 {
48  // order is important!
49  initFromKey();
50  initFromValue();
51  initFromPath();
53 }
54 
55 // -----------------------------------------------------------------------------
56 //
58  SiStripKey(path),
59  fecCrate_(sistrip::invalid_),
60  fecSlot_(sistrip::invalid_),
61  fecRing_(sistrip::invalid_),
62  ccuAddr_(sistrip::invalid_),
63  ccuChan_(sistrip::invalid_),
64  lldChan_(sistrip::invalid_),
65  i2cAddr_(sistrip::invalid_)
66 {
67  // order is important!
68  initFromPath();
69  initFromValue();
70  initFromKey();
72 }
73 
74 // -----------------------------------------------------------------------------
75 //
77  SiStripKey(),
78  fecCrate_(input.fecCrate()),
79  fecSlot_(input.fecSlot()),
80  fecRing_(input.fecRing()),
81  ccuAddr_(input.ccuAddr()),
82  ccuChan_(input.ccuChan()),
83  lldChan_(input.lldChan()),
84  i2cAddr_(input.i2cAddr())
85 {
86  key(input.key());
87  path(input.path());
88  granularity(input.granularity());
89 }
90 
91 // -----------------------------------------------------------------------------
92 //
94  SiStripKey(),
95  fecCrate_(sistrip::invalid_),
96  fecSlot_(sistrip::invalid_),
97  fecRing_(sistrip::invalid_),
98  ccuAddr_(sistrip::invalid_),
99  ccuChan_(sistrip::invalid_),
100  lldChan_(sistrip::invalid_),
101  i2cAddr_(sistrip::invalid_)
102 {
103  const SiStripFecKey& fec_key = dynamic_cast<const SiStripFecKey&>(input);
104  if ( (&fec_key) ) {
105  key(fec_key.key());
106  path(fec_key.path());
107  granularity(fec_key.granularity());
108  fecCrate_ = fec_key.fecCrate();
109  fecSlot_ = fec_key.fecSlot();
110  fecRing_ = fec_key.fecRing();
111  ccuAddr_ = fec_key.ccuAddr();
112  ccuChan_ = fec_key.ccuChan();
113  lldChan_ = fec_key.lldChan();
114  i2cAddr_ = fec_key.i2cAddr();
115  }
116 }
117 
118 // -----------------------------------------------------------------------------
119 //
121  const sistrip::Granularity& gran ) :
122  SiStripKey(),
123  fecCrate_(0),
124  fecSlot_(0),
125  fecRing_(0),
126  ccuAddr_(0),
127  ccuChan_(0),
128  lldChan_(0),
129  i2cAddr_(0)
130 {
131  const SiStripFecKey& fec_key = dynamic_cast<const SiStripFecKey&>(input);
132  if ( (&fec_key) ) {
133 
134  if ( gran == sistrip::FEC_CRATE || gran == sistrip::FEC_SLOT ||
135  gran == sistrip::FEC_RING || gran == sistrip::CCU_ADDR ||
136  gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
137  gran == sistrip::APV ) {
138  fecCrate_ = fec_key.fecCrate();
139  }
140 
141  if ( gran == sistrip::FEC_SLOT || gran == sistrip::FEC_RING ||
142  gran == sistrip::CCU_ADDR || gran == sistrip::CCU_CHAN ||
143  gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
144  fecSlot_ = fec_key.fecSlot();
145  }
146 
147  if ( gran == sistrip::FEC_RING || gran == sistrip::CCU_ADDR ||
148  gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
149  gran == sistrip::APV ) {
150  fecRing_ = fec_key.fecRing();
151  }
152 
153  if ( gran == sistrip::CCU_ADDR || gran == sistrip::CCU_CHAN ||
154  gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
155  ccuAddr_ = fec_key.ccuAddr();
156  }
157 
158  if ( gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
159  gran == sistrip::APV ) {
160  ccuChan_ = fec_key.ccuChan();
161  }
162 
163  if ( gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
164  lldChan_ = fec_key.lldChan();
165  }
166 
167  if ( gran == sistrip::APV ) {
168  i2cAddr_ = fec_key.i2cAddr();
169  }
170 
171  initFromValue();
172  initFromKey();
173  initFromPath();
174  initGranularity();
175 
176  }
177 
178 }
179 
180 // -----------------------------------------------------------------------------
181 //
183  SiStripKey(),
184  fecCrate_(sistrip::invalid_),
185  fecSlot_(sistrip::invalid_),
186  fecRing_(sistrip::invalid_),
187  ccuAddr_(sistrip::invalid_),
188  ccuChan_(sistrip::invalid_),
189  lldChan_(sistrip::invalid_),
190  i2cAddr_(sistrip::invalid_)
191 {;}
192 
193 // -----------------------------------------------------------------------------
194 //
195 uint16_t SiStripFecKey::hybridPos( const uint16_t& i2c_addr ) {
196  if ( i2c_addr < sistrip::APV_I2C_MIN ||
197  i2c_addr > sistrip::APV_I2C_MAX ) {
198  return sistrip::invalid_;
199  }
200  return ( i2c_addr - sistrip::APV_I2C_MIN + 1 );
201 }
202 
203 // -----------------------------------------------------------------------------
204 //
205 uint16_t SiStripFecKey::i2cAddr( const uint16_t& hybrid_pos ) {
206  if ( !hybrid_pos ||
207  hybrid_pos >
209  sistrip::APV_I2C_MIN + 1 ) ) {
210  return sistrip::invalid_;
211  }
212  return ( hybrid_pos + sistrip::APV_I2C_MIN - 1 );
213 }
214 
215 // -----------------------------------------------------------------------------
216 //
217 uint16_t SiStripFecKey::i2cAddr( const uint16_t& lld_chan,
218  const bool& first_apv ) {
219  if ( lld_chan < sistrip::LLD_CHAN_MIN ||
220  lld_chan > sistrip::LLD_CHAN_MAX ) {
221  return sistrip::invalid_;
222  }
223  return ( sistrip::APV_I2C_MIN + lld_chan * sistrip::APVS_PER_CHAN - (first_apv?2:1) );
224 }
225 
226 // -----------------------------------------------------------------------------
227 //
228 uint16_t SiStripFecKey::lldChan( const uint16_t& i2c_addr ) {
229  if ( i2c_addr == 0 ) { return 0; }
230  else if ( i2c_addr < sistrip::APV_I2C_MIN ||
231  i2c_addr > sistrip::APV_I2C_MAX ) {
232  return sistrip::invalid_;
233  }
234  return ( ( i2c_addr - sistrip::APV_I2C_MIN ) / 2 + 1 );
235 }
236 
237 // -----------------------------------------------------------------------------
238 //
239 bool SiStripFecKey::firstApvOfPair( const uint16_t& i2c_addr ) {
240  if ( i2c_addr < sistrip::APV_I2C_MIN ||
241  i2c_addr > sistrip::APV_I2C_MAX ) {
242  return sistrip::invalid_;
243  }
244  return ( ( ( i2c_addr - sistrip::APV_I2C_MIN ) % 2 ) == 0 );
245 }
246 
247 // -----------------------------------------------------------------------------
248 //
249 bool SiStripFecKey::isEqual( const SiStripKey& key ) const {
250  const SiStripFecKey& input = dynamic_cast<const SiStripFecKey&>(key);
251  if ( !(&input) ) { return false; }
252  if ( fecCrate_ == input.fecCrate() &&
253  fecSlot_ == input.fecSlot() &&
254  fecRing_ == input.fecRing() &&
255  ccuAddr_ == input.ccuAddr() &&
256  ccuChan_ == input.ccuChan() &&
257  lldChan_ == input.lldChan() &&
258  i2cAddr_ == input.i2cAddr() ) {
259  return true;
260  } else { return false; }
261 }
262 
263 // -----------------------------------------------------------------------------
264 //
266  const SiStripFecKey& input = dynamic_cast<const SiStripFecKey&>(key);
267  if ( !(&input) ) { return false; }
268  if ( isEqual(input) ) { return true; }
269  else if ( ( fecCrate_ == 0 || input.fecCrate() == 0 ) &&
270  ( fecSlot_ == 0 || input.fecSlot() == 0 ) &&
271  ( fecRing_ == 0 || input.fecRing() == 0 ) &&
272  ( ccuAddr_ == 0 || input.ccuAddr() == 0 ) &&
273  ( lldChan_ == 0 || input.lldChan() == 0 ) &&
274  ( i2cAddr_ == 0 || input.i2cAddr() == 0 ) ) {
275  return true;
276  } else { return false; }
277 }
278 
279 // -----------------------------------------------------------------------------
280 //
281 bool SiStripFecKey::isValid() const {
282  return isValid(sistrip::APV);
283 }
284 
285 // -----------------------------------------------------------------------------
286 //
287 bool SiStripFecKey::isValid( const sistrip::Granularity& gran ) const {
288  if ( gran == sistrip::FEC_SYSTEM ) { return true; }
289  else if ( gran == sistrip::UNDEFINED_GRAN ||
290  gran == sistrip::UNKNOWN_GRAN ) { return false; }
291 
292  if ( fecCrate_ != sistrip::invalid_ ) {
293  if ( gran == sistrip::FEC_CRATE ) { return true; }
294  if ( fecSlot_ != sistrip::invalid_ ) {
295  if ( gran == sistrip::FEC_RING ) { return true; }
296  if ( fecRing_ != sistrip::invalid_ ) {
297  if ( gran == sistrip::FEC_RING ) { return true; }
298  if ( ccuAddr_ != sistrip::invalid_ ) {
299  if ( gran == sistrip::CCU_ADDR ) { return true; }
300  if ( ccuChan_ != sistrip::invalid_ ) {
301  if ( gran == sistrip::CCU_CHAN ) { return true; }
302  if ( lldChan_ != sistrip::invalid_ ) {
303  if ( gran == sistrip::LLD_CHAN ) { return true; }
304  if ( i2cAddr_ != sistrip::invalid_ ) {
305  if ( gran == sistrip::APV ) { return true; }
306  }
307  }
308  }
309  }
310  }
311  }
312  }
313  return false;
314 }
315 
316 // -----------------------------------------------------------------------------
317 //
319  return isInvalid(sistrip::APV);
320 }
321 
322 // -----------------------------------------------------------------------------
323 //
325  if ( gran == sistrip::FEC_SYSTEM ) { return false; }
326  else if ( gran == sistrip::UNDEFINED_GRAN ||
327  gran == sistrip::UNKNOWN_GRAN ) { return false; }
328 
329  if ( fecCrate_ == sistrip::invalid_ ) {
330  if ( gran == sistrip::FEC_CRATE ) { return true; }
331  if ( fecSlot_ == sistrip::invalid_ ) {
332  if ( gran == sistrip::FEC_RING ) { return true; }
333  if ( fecRing_ == sistrip::invalid_ ) {
334  if ( gran == sistrip::FEC_RING ) { return true; }
335  if ( ccuAddr_ == sistrip::invalid_ ) {
336  if ( gran == sistrip::CCU_ADDR ) { return true; }
337  if ( ccuChan_ == sistrip::invalid_ ) {
338  if ( gran == sistrip::CCU_CHAN ) { return true; }
339  if ( lldChan_ == sistrip::invalid_ ) {
340  if ( gran == sistrip::LLD_CHAN ) { return true; }
341  if ( i2cAddr_ == sistrip::invalid_ ) {
342  if ( gran == sistrip::APV ) { return true; }
343  }
344  }
345  }
346  }
347  }
348  }
349  }
350  return false;
351 }
352 
353 // -----------------------------------------------------------------------------
354 //
356 
357  // FEC crate
361  } else if ( fecCrate_ == 0 ) {
362  fecCrate_ = 0;
363  } else { fecCrate_ = sistrip::invalid_; }
364 
365  // FEC slot
368  fecSlot_ = fecSlot_;
369  } else if ( fecSlot_ == 0 ) {
370  fecSlot_ = 0;
371  } else { fecSlot_ = sistrip::invalid_; }
372 
373  // FEC ring
376  fecRing_ = fecRing_;
377  } else if ( fecRing_ == 0 ) {
378  fecRing_ = 0;
379  } else { fecRing_ = sistrip::invalid_; }
380 
381  // CCU addr
384  ccuAddr_ = ccuAddr_;
385  } else if ( ccuAddr_ == 0 ) {
386  ccuAddr_ = 0;
387  } else { ccuAddr_ = sistrip::invalid_; }
388 
389  // CCU chan
392  ccuChan_ = ccuChan_;
393  } else if ( ccuChan_ == 0 ) {
394  ccuChan_ = 0;
395  } else { ccuChan_ = sistrip::invalid_; }
396 
397  // LLD channel
400  lldChan_ = lldChan_;
401  } else if ( lldChan_ == 0 ) {
402  lldChan_ = 0;
403  } else { lldChan_ = sistrip::invalid_; }
404 
405  // APV I2C address
406  if ( i2cAddr_ >= sistrip::APV_I2C_MIN &&
408  i2cAddr_ = i2cAddr_;
409  if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) {
411  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
412  }
413  } else if ( i2cAddr_ == 0 ) {
414  i2cAddr_ = 0;
415  } else { i2cAddr_ = sistrip::invalid_; }
416 
417 }
418 
419 // -----------------------------------------------------------------------------
420 //
422 
423  if ( key() == sistrip::invalid32_ ) {
424 
425  // ---------- Set FecKey based on member data ----------
426 
427  // Initialise to null value
428  key(0);
429 
430  // Extract FEC crate
433  key( key() | (fecCrate_<<fecCrateOffset_) );
434  } else if ( fecCrate_ == 0 ) {
435  key( key() | (fecCrate_<<fecCrateOffset_) );
436  } else {
438  }
439 
440  // Extract FEC slot
443  key( key() | (fecSlot_<<fecSlotOffset_) );
444  } else if ( fecSlot_ == 0 ) {
445  key( key() | (fecSlot_<<fecSlotOffset_) );
446  } else {
447  key( key() | (fecSlotMask_<<fecSlotOffset_) );
448  }
449 
450  // Extract FEC ring
453  key( key() | (fecRing_<<fecRingOffset_) );
454  } else if ( fecRing_ == 0 ) {
455  key( key() | (fecRing_<<fecRingOffset_) );
456  } else {
457  key( key() | (fecRingMask_<<fecRingOffset_) );
458  }
459 
460  // Extract CCU addr
463  key( key() | (ccuAddr_<<ccuAddrOffset_) );
464  } else if ( ccuAddr_ == 0 ) {
465  key( key() | (ccuAddr_<<ccuAddrOffset_) );
466  } else {
467  key( key() | (ccuAddrMask_<<ccuAddrOffset_) );
468  }
469 
470  // Extract CCU chan
473  key( key() | ( (ccuChan_-(sistrip::CCU_CHAN_MIN-1)) << ccuChanOffset_ ) );
474  } else if ( ccuChan_ == 0 ) {
475  key( key() | (ccuChan_<<ccuChanOffset_) );
476  } else {
477  key( key() | (ccuChanMask_<<ccuChanOffset_) );
478  }
479 
480  // Extract LLD channel
483  key( key() | (lldChan_<<lldChanOffset_) );
484  } else if ( lldChan_ == 0 ) {
485  key( key() | (lldChan_<<lldChanOffset_) );
486  } else {
487  key( key() | (lldChanMask_<<lldChanOffset_) );
488  }
489 
490  // Extract APV I2C address
491  if ( i2cAddr_ >= sistrip::APV_I2C_MIN &&
493  key( key() | ( ( firstApvOfPair( i2cAddr_ ) ? 1 : 2 ) << i2cAddrOffset_ ) ); // key encodes APV number (1 or 2)
494  if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) {
496  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
497  }
498  } else if ( i2cAddr_ == 0 ) {
499  key( key() | (i2cAddr_<<i2cAddrOffset_) );
500  } else {
501  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
502  }
503 
504  } else {
505 
506  // ---------- Set member data based on FEC key ----------
507 
515 
521  else if ( ccuChan_ ) { ccuChan_ += (sistrip::CCU_CHAN_MIN-1); }
524  else if ( i2cAddr_ && lldChan_ != lldChanMask_ ) { i2cAddr_ = i2cAddr( lldChan_, 2-i2cAddr_ ); }
525 
526  }
527 
528 }
529 
530 // -----------------------------------------------------------------------------
531 //
533 
534  if ( path() == sistrip::null_ ) {
535 
536  // ---------- Set directory path based on member data ----------
537 
538  std::stringstream dir;
539 
540  dir << sistrip::root_ << sistrip::dir_
542 
543  // Add FEC crate
544  if ( fecCrate_ ) {
546 
547  // Add FEC slot
548  if ( fecSlot_ ) {
550 
551  // Add FEC ring
552  if ( fecRing_ ) {
554 
555  // Add CCU address
556  if ( ccuAddr_ ) {
558 
559  // Add CCU channel
560  if ( ccuChan_ ) {
562 
563  // Add LLD channel
564  if ( lldChan_ ) {
566 
567  // Add APV I2C address
568  if ( i2cAddr_ ) {
569  dir << sistrip::apv_ << i2cAddr_ << sistrip::dir_;
570  }
571  }
572  }
573  }
574  }
575  }
576  }
577 
578  std::string temp( dir.str() );
579  path( temp );
580 
581  } else {
582 
583  // ---------- Set member data based on directory path ----------
584 
585  fecCrate_ = 0;
586  fecSlot_ = 0;
587  fecRing_ = 0;
588  ccuAddr_ = 0;
589  ccuChan_ = 0;
590  lldChan_ = 0;
591  i2cAddr_ = 0;
592 
593  // Check if root is found
594  if ( path().find( sistrip::root_ ) == std::string::npos ) {
595  std::string temp = path();
597  }
598 
599  size_t curr = 0; // current string position
600  size_t next = 0; // next string position
601  next = path().find( sistrip::controlView_, curr );
602 
603  // Extract view
604  curr = next;
605  if ( curr != std::string::npos ) {
606  next = path().find( sistrip::fecCrate_, curr );
607  std::string control_view( path(),
608  curr+(sizeof(sistrip::controlView_) - 1),
609  next-(sizeof(sistrip::dir_) - 1)-curr );
610 
611  // Extract FEC crate
612  curr = next;
613  if ( curr != std::string::npos ) {
614  next = path().find( sistrip::fecSlot_, curr );
615  std::string fec_crate( path(),
616  curr+(sizeof(sistrip::fecCrate_) - 1),
617  next-(sizeof(sistrip::dir_) - 1)-curr );
618  fecCrate_ = std::atoi( fec_crate.c_str() );
619 
620  // Extract FEC slot
621  curr = next;
622  if ( curr != std::string::npos ) {
623  next = path().find( sistrip::fecRing_, curr );
624  std::string fec_slot( path(),
625  curr+(sizeof(sistrip::fecSlot_) - 1),
626  next-(sizeof(sistrip::dir_) - 1)-curr );
627  fecSlot_ = std::atoi( fec_slot.c_str() );
628 
629  // Extract FEC ring
630  curr = next;
631  if ( curr != std::string::npos ) {
632  next = path().find( sistrip::ccuAddr_, curr );
633  std::string fec_ring( path(),
634  curr+(sizeof(sistrip::fecRing_) - 1),
635  next-(sizeof(sistrip::dir_) - 1)-curr );
636  fecRing_ = std::atoi( fec_ring.c_str() );
637 
638  // Extract CCU address
639  curr = next;
640  if ( curr != std::string::npos ) {
641  next = path().find( sistrip::ccuChan_, curr );
642  std::string ccu_addr( path(),
643  curr+(sizeof(sistrip::ccuAddr_) - 1),
644  next-(sizeof(sistrip::dir_) - 1)-curr );
645  ccuAddr_ = std::atoi( ccu_addr.c_str() );
646 
647  // Extract CCU channel
648  curr = next;
649  if ( curr != std::string::npos ) {
650  next = path().find( sistrip::lldChan_, curr );
651  std::string ccu_chan( path(),
652  curr+(sizeof(sistrip::ccuChan_) - 1),
653  next-(sizeof(sistrip::dir_) - 1)-curr );
654  ccuChan_ = std::atoi( ccu_chan.c_str() );
655 
656  // Extract LLD channel
657  curr = next;
658  if ( curr != std::string::npos ) {
659  next = path().find( sistrip::apv_, curr );
660  std::string lld_chan( path(),
661  curr+(sizeof(sistrip::lldChan_) - 1),
662  next-(sizeof(sistrip::dir_) - 1)-curr );
663  lldChan_ = std::atoi( lld_chan.c_str() );
664 
665  // Extract I2C address
666  curr = next;
667  if ( curr != std::string::npos ) {
668  next = std::string::npos;
669  std::string i2c_addr( path(),
670  curr+(sizeof(sistrip::apv_) - 1),
671  next-curr );
672  i2cAddr_ = std::atoi( i2c_addr.c_str() );
673  }
674  }
675  }
676  }
677  }
678  }
679  }
680  } else {
681  std::stringstream ss;
682  ss << sistrip::root_ << sistrip::dir_;
683  //ss << sistrip::root_ << sistrip::dir_
684  //<< sistrip::unknownView_ << sistrip::dir_;
685  std::string temp( ss.str() );
686  path( temp );
687  }
688 
689  }
690 
691 }
692 
693 // -----------------------------------------------------------------------------
694 //
696 
698  channel(0);
699  if ( fecCrate_ && fecCrate_ != sistrip::invalid_ ) {
702  if ( fecSlot_ && fecSlot_ != sistrip::invalid_ ) {
704  channel(fecSlot_);
705  if ( fecRing_ && fecRing_ != sistrip::invalid_ ) {
707  channel(fecRing_);
708  if ( ccuAddr_ && ccuAddr_ != sistrip::invalid_ ) {
710  channel(ccuAddr_);
711  if ( ccuChan_ && ccuChan_ != sistrip::invalid_ ) {
713  channel(ccuChan_);
714  if ( lldChan_ && lldChan_ != sistrip::invalid_ ) {
716  channel(lldChan_);
717  if ( i2cAddr_ && i2cAddr_ != sistrip::invalid_ ) {
719  channel(i2cAddr_);
720  } else if ( i2cAddr_ == sistrip::invalid_ ) {
723  }
724  } else if ( lldChan_ == sistrip::invalid_ ) {
727  }
728  } else if ( ccuChan_ == sistrip::invalid_ ) {
731  }
732  } else if ( ccuAddr_ == sistrip::invalid_ ) {
735  }
736  } else if ( fecRing_ == sistrip::invalid_ ) {
739  }
740  } else if ( fecSlot_ == sistrip::invalid_ ) {
743  }
744  } else if ( fecCrate_ == sistrip::invalid_ ) {
747  }
748 
749 }
750 
751 // -----------------------------------------------------------------------------
752 //
753 void SiStripFecKey::terse( std::stringstream& ss ) const {
754  ss << "FEC:crate/slot/ring/CCU/module/LLD/I2C= "
755  << fecCrate() << "/"
756  << fecSlot() << "/"
757  << fecRing() << "/"
758  << ccuAddr() << "/"
759  << ccuChan() << "/"
760  << lldChan() << "/"
761  << i2cAddr();
762 // ss << " FecKey"
763 // //<< "=0x"
764 // //<< std::hex
765 // //<< std::setfill('0') << std::setw(8) << key() << std::setfill(' ')
766 // //<< std::dec
767 // //<< ", " << ( isValid() ? "Valid" : "Invalid" )
768 // << ", Crate=" << fecCrate()
769 // << ", Slot=" << fecSlot()
770 // << ", Ring=" << fecRing()
771 // << ", CCU=" << ccuAddr()
772 // << ", module=" << ccuChan()
773 // << ", LLD=" << lldChan()
774 // << ", I2C=" << i2cAddr();
775 }
776 
777 // -----------------------------------------------------------------------------
778 //
779 void SiStripFecKey::print( std::stringstream& ss ) const {
780  ss << " [SiStripFecKey::print]" << std::endl
781  << std::hex
782  << " FEC key : 0x"
783  << std::setfill('0')
784  << std::setw(8) << key() << std::endl
785  << std::setfill(' ')
786  << std::dec
787  << " FEC VME crate : " << fecCrate() << std::endl
788  << " FEC VME slot : " << fecSlot() << std::endl
789  << " FEC control ring : " << fecRing() << std::endl
790  << " CCU I2C address : " << ccuAddr() << std::endl
791  << " CCU chan (FE module) : " << ccuChan() << std::endl
792  << " LaserDriver channel : " << lldChan() << std::endl
793  << " APV I2C address : " << i2cAddr() << std::endl
794  << " Directory : " << path() << std::endl
795  << " Granularity : "
797  << " Channel : " << channel() << std::endl
798  << " isValid : " << isValid();
799 }
800 
801 // -----------------------------------------------------------------------------
802 //
803 std::ostream& operator<< ( std::ostream& os, const SiStripFecKey& input ) {
804  std::stringstream ss;
805  input.print(ss);
806  os << ss.str();
807  return os;
808 }
809 
810 // -----------------------------------------------------------------------------
811 //
813  : mask_( key.fecCrate() ? sistrip::invalid_ : 0,
814  key.fecSlot() ? sistrip::invalid_ : 0,
815  key.fecRing() ? sistrip::invalid_ : 0,
816  key.ccuAddr() ? sistrip::invalid_ : 0,
817  key.ccuChan() ? sistrip::invalid_ : 0,
818  key.lldChan() ? sistrip::invalid_ : 0,
819  key.i2cAddr() ? sistrip::invalid_ : 0 ) {;}
820 
821 // -----------------------------------------------------------------------------
822 //
824  : mask_(SiStripNullKey()) {;}
825 
826 // -----------------------------------------------------------------------------
827 //
828 bool ConsistentWithKey::operator() ( const uint32_t& a, const uint32_t& b ) const {
829  return ( ( a & mask_.key() ) < ( b & mask_.key() ) );
830 }
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:15
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.
static std::string const input
Definition: EdmProvDump.cc:44
const uint32_t & key() const
Definition: SiStripKey.h:125
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:45
static const uint16_t FEC_CRATE_MAX
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:127
static bool firstApvOfPair(const uint16_t &i2c_addr)
static const uint16_t lldChanOffset_
static const char lldChan_[]
static const uint16_t CCU_ADDR_MIN
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:23
const std::string & path() const
Definition: SiStripKey.h:126
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
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:128
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:16
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_
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:22
virtual void terse(std::stringstream &ss) const