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.23 2012/07/04 19:04:51 eulisse 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 //
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  const SiStripFecKey& fec_key = dynamic_cast<const SiStripFecKey&>(input);
105  if ( (&fec_key) ) {
106  key(fec_key.key());
107  path(fec_key.path());
108  granularity(fec_key.granularity());
109  fecCrate_ = fec_key.fecCrate();
110  fecSlot_ = fec_key.fecSlot();
111  fecRing_ = fec_key.fecRing();
112  ccuAddr_ = fec_key.ccuAddr();
113  ccuChan_ = fec_key.ccuChan();
114  lldChan_ = fec_key.lldChan();
115  i2cAddr_ = fec_key.i2cAddr();
116  }
117 }
118 
119 // -----------------------------------------------------------------------------
120 //
122  const sistrip::Granularity& gran ) :
123  SiStripKey(),
124  fecCrate_(0),
125  fecSlot_(0),
126  fecRing_(0),
127  ccuAddr_(0),
128  ccuChan_(0),
129  lldChan_(0),
130  i2cAddr_(0)
131 {
132  const SiStripFecKey& fec_key = dynamic_cast<const SiStripFecKey&>(input);
133  if ( (&fec_key) ) {
134 
135  if ( gran == sistrip::FEC_CRATE || gran == sistrip::FEC_SLOT ||
136  gran == sistrip::FEC_RING || gran == sistrip::CCU_ADDR ||
137  gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
138  gran == sistrip::APV ) {
139  fecCrate_ = fec_key.fecCrate();
140  }
141 
142  if ( gran == sistrip::FEC_SLOT || gran == sistrip::FEC_RING ||
143  gran == sistrip::CCU_ADDR || gran == sistrip::CCU_CHAN ||
144  gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
145  fecSlot_ = fec_key.fecSlot();
146  }
147 
148  if ( gran == sistrip::FEC_RING || gran == sistrip::CCU_ADDR ||
149  gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
150  gran == sistrip::APV ) {
151  fecRing_ = fec_key.fecRing();
152  }
153 
154  if ( gran == sistrip::CCU_ADDR || gran == sistrip::CCU_CHAN ||
155  gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
156  ccuAddr_ = fec_key.ccuAddr();
157  }
158 
159  if ( gran == sistrip::CCU_CHAN || gran == sistrip::LLD_CHAN ||
160  gran == sistrip::APV ) {
161  ccuChan_ = fec_key.ccuChan();
162  }
163 
164  if ( gran == sistrip::LLD_CHAN || gran == sistrip::APV ) {
165  lldChan_ = fec_key.lldChan();
166  }
167 
168  if ( gran == sistrip::APV ) {
169  i2cAddr_ = fec_key.i2cAddr();
170  }
171 
172  initFromValue();
173  initFromKey();
174  initFromPath();
175  initGranularity();
176 
177  }
178 
179 }
180 
181 // -----------------------------------------------------------------------------
182 //
184  SiStripKey(),
185  fecCrate_(sistrip::invalid_),
186  fecSlot_(sistrip::invalid_),
187  fecRing_(sistrip::invalid_),
188  ccuAddr_(sistrip::invalid_),
189  ccuChan_(sistrip::invalid_),
190  lldChan_(sistrip::invalid_),
191  i2cAddr_(sistrip::invalid_)
192 {;}
193 
194 // -----------------------------------------------------------------------------
195 //
196 uint16_t SiStripFecKey::hybridPos( const uint16_t& i2c_addr ) {
197  if ( i2c_addr < sistrip::APV_I2C_MIN ||
198  i2c_addr > sistrip::APV_I2C_MAX ) {
199  return sistrip::invalid_;
200  }
201  return ( i2c_addr - sistrip::APV_I2C_MIN + 1 );
202 }
203 
204 // -----------------------------------------------------------------------------
205 //
206 uint16_t SiStripFecKey::i2cAddr( const uint16_t& hybrid_pos ) {
207  if ( !hybrid_pos ||
208  hybrid_pos >
210  sistrip::APV_I2C_MIN + 1 ) ) {
211  return sistrip::invalid_;
212  }
213  return ( hybrid_pos + sistrip::APV_I2C_MIN - 1 );
214 }
215 
216 // -----------------------------------------------------------------------------
217 //
218 uint16_t SiStripFecKey::i2cAddr( const uint16_t& lld_chan,
219  const bool& first_apv ) {
220  if ( lld_chan < sistrip::LLD_CHAN_MIN ||
221  lld_chan > sistrip::LLD_CHAN_MAX ) {
222  return sistrip::invalid_;
223  }
224  return ( sistrip::APV_I2C_MIN + lld_chan * sistrip::APVS_PER_CHAN - (first_apv?2:1) );
225 }
226 
227 // -----------------------------------------------------------------------------
228 //
229 uint16_t SiStripFecKey::lldChan( const uint16_t& i2c_addr ) {
230  if ( i2c_addr == 0 ) { return 0; }
231  else if ( i2c_addr < sistrip::APV_I2C_MIN ||
232  i2c_addr > sistrip::APV_I2C_MAX ) {
233  return sistrip::invalid_;
234  }
235  return ( ( i2c_addr - sistrip::APV_I2C_MIN ) / 2 + 1 );
236 }
237 
238 // -----------------------------------------------------------------------------
239 //
240 bool SiStripFecKey::firstApvOfPair( const uint16_t& i2c_addr ) {
241  if ( i2c_addr < sistrip::APV_I2C_MIN ||
242  i2c_addr > sistrip::APV_I2C_MAX ) {
243  return sistrip::invalid_;
244  }
245  return ( ( ( i2c_addr - sistrip::APV_I2C_MIN ) % 2 ) == 0 );
246 }
247 
248 // -----------------------------------------------------------------------------
249 //
250 bool SiStripFecKey::isEqual( const SiStripKey& key ) const {
251  const SiStripFecKey& input = dynamic_cast<const SiStripFecKey&>(key);
252  if ( !(&input) ) { return false; }
253  if ( fecCrate_ == input.fecCrate() &&
254  fecSlot_ == input.fecSlot() &&
255  fecRing_ == input.fecRing() &&
256  ccuAddr_ == input.ccuAddr() &&
257  ccuChan_ == input.ccuChan() &&
258  lldChan_ == input.lldChan() &&
259  i2cAddr_ == input.i2cAddr() ) {
260  return true;
261  } else { return false; }
262 }
263 
264 // -----------------------------------------------------------------------------
265 //
267  const SiStripFecKey& input = dynamic_cast<const SiStripFecKey&>(key);
268  if ( !(&input) ) { return false; }
269  if ( isEqual(input) ) { return true; }
270  else if ( ( fecCrate_ == 0 || input.fecCrate() == 0 ) &&
271  ( fecSlot_ == 0 || input.fecSlot() == 0 ) &&
272  ( fecRing_ == 0 || input.fecRing() == 0 ) &&
273  ( ccuAddr_ == 0 || input.ccuAddr() == 0 ) &&
274  ( lldChan_ == 0 || input.lldChan() == 0 ) &&
275  ( i2cAddr_ == 0 || input.i2cAddr() == 0 ) ) {
276  return true;
277  } else { return false; }
278 }
279 
280 // -----------------------------------------------------------------------------
281 //
282 bool SiStripFecKey::isValid() const {
283  return isValid(sistrip::APV);
284 }
285 
286 // -----------------------------------------------------------------------------
287 //
288 bool SiStripFecKey::isValid( const sistrip::Granularity& gran ) const {
289  if ( gran == sistrip::FEC_SYSTEM ) { return true; }
290  else if ( gran == sistrip::UNDEFINED_GRAN ||
291  gran == sistrip::UNKNOWN_GRAN ) { return false; }
292 
293  if ( fecCrate_ != sistrip::invalid_ ) {
294  if ( gran == sistrip::FEC_CRATE ) { return true; }
295  if ( fecSlot_ != sistrip::invalid_ ) {
296  if ( gran == sistrip::FEC_RING ) { return true; }
297  if ( fecRing_ != sistrip::invalid_ ) {
298  if ( gran == sistrip::FEC_RING ) { return true; }
299  if ( ccuAddr_ != sistrip::invalid_ ) {
300  if ( gran == sistrip::CCU_ADDR ) { return true; }
301  if ( ccuChan_ != sistrip::invalid_ ) {
302  if ( gran == sistrip::CCU_CHAN ) { return true; }
303  if ( lldChan_ != sistrip::invalid_ ) {
304  if ( gran == sistrip::LLD_CHAN ) { return true; }
305  if ( i2cAddr_ != sistrip::invalid_ ) {
306  if ( gran == sistrip::APV ) { return true; }
307  }
308  }
309  }
310  }
311  }
312  }
313  }
314  return false;
315 }
316 
317 // -----------------------------------------------------------------------------
318 //
320  return isInvalid(sistrip::APV);
321 }
322 
323 // -----------------------------------------------------------------------------
324 //
326  if ( gran == sistrip::FEC_SYSTEM ) { return false; }
327  else if ( gran == sistrip::UNDEFINED_GRAN ||
328  gran == sistrip::UNKNOWN_GRAN ) { return false; }
329 
330  if ( fecCrate_ == sistrip::invalid_ ) {
331  if ( gran == sistrip::FEC_CRATE ) { return true; }
332  if ( fecSlot_ == sistrip::invalid_ ) {
333  if ( gran == sistrip::FEC_RING ) { return true; }
334  if ( fecRing_ == sistrip::invalid_ ) {
335  if ( gran == sistrip::FEC_RING ) { return true; }
336  if ( ccuAddr_ == sistrip::invalid_ ) {
337  if ( gran == sistrip::CCU_ADDR ) { return true; }
338  if ( ccuChan_ == sistrip::invalid_ ) {
339  if ( gran == sistrip::CCU_CHAN ) { return true; }
340  if ( lldChan_ == sistrip::invalid_ ) {
341  if ( gran == sistrip::LLD_CHAN ) { return true; }
342  if ( i2cAddr_ == sistrip::invalid_ ) {
343  if ( gran == sistrip::APV ) { return true; }
344  }
345  }
346  }
347  }
348  }
349  }
350  }
351  return false;
352 }
353 
354 // -----------------------------------------------------------------------------
355 //
357 
358  // FEC crate
362  } else if ( fecCrate_ == 0 ) {
363  fecCrate_ = 0;
364  } else { fecCrate_ = sistrip::invalid_; }
365 
366  // FEC slot
369  fecSlot_ = fecSlot_;
370  } else if ( fecSlot_ == 0 ) {
371  fecSlot_ = 0;
372  } else { fecSlot_ = sistrip::invalid_; }
373 
374  // FEC ring
377  fecRing_ = fecRing_;
378  } else if ( fecRing_ == 0 ) {
379  fecRing_ = 0;
380  } else { fecRing_ = sistrip::invalid_; }
381 
382  // CCU addr
385  ccuAddr_ = ccuAddr_;
386  } else if ( ccuAddr_ == 0 ) {
387  ccuAddr_ = 0;
388  } else { ccuAddr_ = sistrip::invalid_; }
389 
390  // CCU chan
393  ccuChan_ = ccuChan_;
394  } else if ( ccuChan_ == 0 ) {
395  ccuChan_ = 0;
396  } else { ccuChan_ = sistrip::invalid_; }
397 
398  // LLD channel
401  lldChan_ = lldChan_;
402  } else if ( lldChan_ == 0 ) {
403  lldChan_ = 0;
404  } else { lldChan_ = sistrip::invalid_; }
405 
406  // APV I2C address
407  if ( i2cAddr_ >= sistrip::APV_I2C_MIN &&
409  i2cAddr_ = i2cAddr_;
410  if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) {
412  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
413  }
414  } else if ( i2cAddr_ == 0 ) {
415  i2cAddr_ = 0;
416  } else { i2cAddr_ = sistrip::invalid_; }
417 
418 }
419 
420 // -----------------------------------------------------------------------------
421 //
423 
424  if ( key() == sistrip::invalid32_ ) {
425 
426  // ---------- Set FecKey based on member data ----------
427 
428  // Initialise to null value
429  key(0);
430 
431  // Extract FEC crate
434  key( key() | (fecCrate_<<fecCrateOffset_) );
435  } else if ( fecCrate_ == 0 ) {
436  key( key() | (fecCrate_<<fecCrateOffset_) );
437  } else {
439  }
440 
441  // Extract FEC slot
444  key( key() | (fecSlot_<<fecSlotOffset_) );
445  } else if ( fecSlot_ == 0 ) {
446  key( key() | (fecSlot_<<fecSlotOffset_) );
447  } else {
448  key( key() | (fecSlotMask_<<fecSlotOffset_) );
449  }
450 
451  // Extract FEC ring
454  key( key() | (fecRing_<<fecRingOffset_) );
455  } else if ( fecRing_ == 0 ) {
456  key( key() | (fecRing_<<fecRingOffset_) );
457  } else {
458  key( key() | (fecRingMask_<<fecRingOffset_) );
459  }
460 
461  // Extract CCU addr
464  key( key() | (ccuAddr_<<ccuAddrOffset_) );
465  } else if ( ccuAddr_ == 0 ) {
466  key( key() | (ccuAddr_<<ccuAddrOffset_) );
467  } else {
468  key( key() | (ccuAddrMask_<<ccuAddrOffset_) );
469  }
470 
471  // Extract CCU chan
474  key( key() | ( (ccuChan_-(sistrip::CCU_CHAN_MIN-1)) << ccuChanOffset_ ) );
475  } else if ( ccuChan_ == 0 ) {
476  key( key() | (ccuChan_<<ccuChanOffset_) );
477  } else {
478  key( key() | (ccuChanMask_<<ccuChanOffset_) );
479  }
480 
481  // Extract LLD channel
484  key( key() | (lldChan_<<lldChanOffset_) );
485  } else if ( lldChan_ == 0 ) {
486  key( key() | (lldChan_<<lldChanOffset_) );
487  } else {
488  key( key() | (lldChanMask_<<lldChanOffset_) );
489  }
490 
491  // Extract APV I2C address
492  if ( i2cAddr_ >= sistrip::APV_I2C_MIN &&
494  key( key() | ( ( firstApvOfPair( i2cAddr_ ) ? 1 : 2 ) << i2cAddrOffset_ ) ); // key encodes APV number (1 or 2)
495  if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) {
497  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
498  }
499  } else if ( i2cAddr_ == 0 ) {
500  key( key() | (i2cAddr_<<i2cAddrOffset_) );
501  } else {
502  key( key() | (i2cAddrMask_<<i2cAddrOffset_) );
503  }
504 
505  } else {
506 
507  // ---------- Set member data based on FEC key ----------
508 
516 
522  else if ( ccuChan_ ) { ccuChan_ += (sistrip::CCU_CHAN_MIN-1); }
525  else if ( i2cAddr_ && lldChan_ != lldChanMask_ ) { i2cAddr_ = i2cAddr( lldChan_, 2-i2cAddr_ ); }
526 
527  }
528 
529 }
530 
531 // -----------------------------------------------------------------------------
532 //
534 
535  if ( path() == sistrip::null_ ) {
536 
537  // ---------- Set directory path based on member data ----------
538 
539  std::stringstream dir;
540 
541  dir << sistrip::root_ << sistrip::dir_
543 
544  // Add FEC crate
545  if ( fecCrate_ ) {
547 
548  // Add FEC slot
549  if ( fecSlot_ ) {
551 
552  // Add FEC ring
553  if ( fecRing_ ) {
555 
556  // Add CCU address
557  if ( ccuAddr_ ) {
559 
560  // Add CCU channel
561  if ( ccuChan_ ) {
563 
564  // Add LLD channel
565  if ( lldChan_ ) {
567 
568  // Add APV I2C address
569  if ( i2cAddr_ ) {
570  dir << sistrip::apv_ << i2cAddr_ << sistrip::dir_;
571  }
572  }
573  }
574  }
575  }
576  }
577  }
578 
579  std::string temp( dir.str() );
580  path( temp );
581 
582  } else {
583 
584  // ---------- Set member data based on directory path ----------
585 
586  fecCrate_ = 0;
587  fecSlot_ = 0;
588  fecRing_ = 0;
589  ccuAddr_ = 0;
590  ccuChan_ = 0;
591  lldChan_ = 0;
592  i2cAddr_ = 0;
593 
594  // Check if root is found
595  if ( path().find( sistrip::root_ ) == std::string::npos ) {
596  std::string temp = path();
598  }
599 
600  size_t curr = 0; // current string position
601  size_t next = 0; // next string position
602  next = path().find( sistrip::controlView_, curr );
603 
604  // Extract view
605  curr = next;
606  if ( curr != std::string::npos ) {
607  next = path().find( sistrip::fecCrate_, curr );
608  std::string control_view( path(),
609  curr+(sizeof(sistrip::controlView_) - 1),
610  next-(sizeof(sistrip::dir_) - 1)-curr );
611 
612  // Extract FEC crate
613  curr = next;
614  if ( curr != std::string::npos ) {
615  next = path().find( sistrip::fecSlot_, curr );
616  std::string fec_crate( path(),
617  curr+(sizeof(sistrip::fecCrate_) - 1),
618  next-(sizeof(sistrip::dir_) - 1)-curr );
619  fecCrate_ = std::atoi( fec_crate.c_str() );
620 
621  // Extract FEC slot
622  curr = next;
623  if ( curr != std::string::npos ) {
624  next = path().find( sistrip::fecRing_, curr );
625  std::string fec_slot( path(),
626  curr+(sizeof(sistrip::fecSlot_) - 1),
627  next-(sizeof(sistrip::dir_) - 1)-curr );
628  fecSlot_ = std::atoi( fec_slot.c_str() );
629 
630  // Extract FEC ring
631  curr = next;
632  if ( curr != std::string::npos ) {
633  next = path().find( sistrip::ccuAddr_, curr );
634  std::string fec_ring( path(),
635  curr+(sizeof(sistrip::fecRing_) - 1),
636  next-(sizeof(sistrip::dir_) - 1)-curr );
637  fecRing_ = std::atoi( fec_ring.c_str() );
638 
639  // Extract CCU address
640  curr = next;
641  if ( curr != std::string::npos ) {
642  next = path().find( sistrip::ccuChan_, curr );
643  std::string ccu_addr( path(),
644  curr+(sizeof(sistrip::ccuAddr_) - 1),
645  next-(sizeof(sistrip::dir_) - 1)-curr );
646  ccuAddr_ = std::atoi( ccu_addr.c_str() );
647 
648  // Extract CCU channel
649  curr = next;
650  if ( curr != std::string::npos ) {
651  next = path().find( sistrip::lldChan_, curr );
652  std::string ccu_chan( path(),
653  curr+(sizeof(sistrip::ccuChan_) - 1),
654  next-(sizeof(sistrip::dir_) - 1)-curr );
655  ccuChan_ = std::atoi( ccu_chan.c_str() );
656 
657  // Extract LLD channel
658  curr = next;
659  if ( curr != std::string::npos ) {
660  next = path().find( sistrip::apv_, curr );
661  std::string lld_chan( path(),
662  curr+(sizeof(sistrip::lldChan_) - 1),
663  next-(sizeof(sistrip::dir_) - 1)-curr );
664  lldChan_ = std::atoi( lld_chan.c_str() );
665 
666  // Extract I2C address
667  curr = next;
668  if ( curr != std::string::npos ) {
669  next = std::string::npos;
670  std::string i2c_addr( path(),
671  curr+(sizeof(sistrip::apv_) - 1),
672  next-curr );
673  i2cAddr_ = std::atoi( i2c_addr.c_str() );
674  }
675  }
676  }
677  }
678  }
679  }
680  }
681  } else {
682  std::stringstream ss;
683  ss << sistrip::root_ << sistrip::dir_;
684  //ss << sistrip::root_ << sistrip::dir_
685  //<< sistrip::unknownView_ << sistrip::dir_;
686  std::string temp( ss.str() );
687  path( temp );
688  }
689 
690  }
691 
692 }
693 
694 // -----------------------------------------------------------------------------
695 //
697 
699  channel(0);
700  if ( fecCrate_ && fecCrate_ != sistrip::invalid_ ) {
703  if ( fecSlot_ && fecSlot_ != sistrip::invalid_ ) {
705  channel(fecSlot_);
706  if ( fecRing_ && fecRing_ != sistrip::invalid_ ) {
708  channel(fecRing_);
709  if ( ccuAddr_ && ccuAddr_ != sistrip::invalid_ ) {
711  channel(ccuAddr_);
712  if ( ccuChan_ && ccuChan_ != sistrip::invalid_ ) {
714  channel(ccuChan_);
715  if ( lldChan_ && lldChan_ != sistrip::invalid_ ) {
717  channel(lldChan_);
718  if ( i2cAddr_ && i2cAddr_ != sistrip::invalid_ ) {
720  channel(i2cAddr_);
721  } else if ( i2cAddr_ == sistrip::invalid_ ) {
724  }
725  } else if ( lldChan_ == sistrip::invalid_ ) {
728  }
729  } else if ( ccuChan_ == sistrip::invalid_ ) {
732  }
733  } else if ( ccuAddr_ == sistrip::invalid_ ) {
736  }
737  } else if ( fecRing_ == sistrip::invalid_ ) {
740  }
741  } else if ( fecSlot_ == sistrip::invalid_ ) {
744  }
745  } else if ( fecCrate_ == sistrip::invalid_ ) {
748  }
749 
750 }
751 
752 // -----------------------------------------------------------------------------
753 //
754 void SiStripFecKey::terse( std::stringstream& ss ) const {
755  ss << "FEC:crate/slot/ring/CCU/module/LLD/I2C= "
756  << fecCrate() << "/"
757  << fecSlot() << "/"
758  << fecRing() << "/"
759  << ccuAddr() << "/"
760  << ccuChan() << "/"
761  << lldChan() << "/"
762  << i2cAddr();
763 // ss << " FecKey"
764 // //<< "=0x"
765 // //<< std::hex
766 // //<< std::setfill('0') << std::setw(8) << key() << std::setfill(' ')
767 // //<< std::dec
768 // //<< ", " << ( isValid() ? "Valid" : "Invalid" )
769 // << ", Crate=" << fecCrate()
770 // << ", Slot=" << fecSlot()
771 // << ", Ring=" << fecRing()
772 // << ", CCU=" << ccuAddr()
773 // << ", module=" << ccuChan()
774 // << ", LLD=" << lldChan()
775 // << ", I2C=" << i2cAddr();
776 }
777 
778 // -----------------------------------------------------------------------------
779 //
780 void SiStripFecKey::print( std::stringstream& ss ) const {
781  ss << " [SiStripFecKey::print]" << std::endl
782  << std::hex
783  << " FEC key : 0x"
784  << std::setfill('0')
785  << std::setw(8) << key() << std::endl
786  << std::setfill(' ')
787  << std::dec
788  << " FEC VME crate : " << fecCrate() << std::endl
789  << " FEC VME slot : " << fecSlot() << std::endl
790  << " FEC control ring : " << fecRing() << std::endl
791  << " CCU I2C address : " << ccuAddr() << std::endl
792  << " CCU chan (FE module) : " << ccuChan() << std::endl
793  << " LaserDriver channel : " << lldChan() << std::endl
794  << " APV I2C address : " << i2cAddr() << std::endl
795  << " Directory : " << path() << std::endl
796  << " Granularity : "
798  << " Channel : " << channel() << std::endl
799  << " isValid : " << isValid();
800 }
801 
802 // -----------------------------------------------------------------------------
803 //
804 std::ostream& operator<< ( std::ostream& os, const SiStripFecKey& input ) {
805  std::stringstream ss;
806  input.print(ss);
807  os << ss.str();
808  return os;
809 }
810 
811 // -----------------------------------------------------------------------------
812 //
814  : mask_( key.fecCrate() ? sistrip::invalid_ : 0,
815  key.fecSlot() ? sistrip::invalid_ : 0,
816  key.fecRing() ? sistrip::invalid_ : 0,
817  key.ccuAddr() ? sistrip::invalid_ : 0,
818  key.ccuChan() ? sistrip::invalid_ : 0,
819  key.lldChan() ? sistrip::invalid_ : 0,
820  key.i2cAddr() ? sistrip::invalid_ : 0 ) {;}
821 
822 // -----------------------------------------------------------------------------
823 //
825  : mask_(SiStripNullKey()) {;}
826 
827 // -----------------------------------------------------------------------------
828 //
829 bool ConsistentWithKey::operator() ( const uint32_t& a, const uint32_t& b ) const {
830  return ( ( a & mask_.key() ) < ( b & mask_.key() ) );
831 }
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
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