#include <IORawData/CaloPatterns/interface/HcalFiberPattern.h>
Public Member Functions | |
int | crate () const |
int | fiber () const |
HcalElectronicsId | getId (int fiberChan) |
std::vector< HcalQIESample > | getSamples (int bunch, int npresamples, int nsamples, int fiberChan) |
HcalFiberPattern (const std::map< std::string, std::string > ¶ms, const std::vector< uint32_t > &data) | |
int | slot () const |
Private Member Functions | |
HcalQIESample | unpack (int bc, int fc) |
Private Attributes | |
int | crate_ |
int | dcc_ |
int | fiber_ |
std::vector< uint32_t > | pattern_ |
int | slot_ |
int | spigot_ |
int | tb_ |
Definition at line 16 of file HcalFiberPattern.h.
HcalFiberPattern::HcalFiberPattern | ( | const std::map< std::string, std::string > & | params, | |
const std::vector< uint32_t > & | data | |||
) |
Definition at line 10 of file HcalFiberPattern.cc.
References crate_, dcc_, fiber_, setIf(), slot_, spigot_, and tb_.
00010 : pattern_(data) { 00011 crate_=setIf("CRATE",params); 00012 slot_=setIf("SLOT",params); 00013 fiber_=setIf("FIBER",params); 00014 dcc_=setIf("DCC",params); 00015 spigot_=setIf("SPIGOT",params); 00016 tb_=setIf("TOPBOTTOM",params); 00017 }
int HcalFiberPattern::crate | ( | ) | const [inline] |
int HcalFiberPattern::fiber | ( | ) | const [inline] |
HcalElectronicsId HcalFiberPattern::getId | ( | int | fiberChan | ) |
std::vector< HcalQIESample > HcalFiberPattern::getSamples | ( | int | bunch, | |
int | npresamples, | |||
int | nsamples, | |||
int | fiberChan | |||
) |
Definition at line 46 of file HcalFiberPattern.cc.
References Exception, i, pattern_, and unpack().
00046 { 00047 if (bunch<npresamples) throw cms::Exception("InvalidArgument") << "Asked for " << npresamples << " presamples with event at bunch " << bunch; 00048 if (nsamples-npresamples+bunch>=(int)(pattern_.size()/2)) throw cms::Exception("InvalidArgument") << "Asked for " << nsamples << " with event at " << bunch << " and " << npresamples << " presamples, but only " << pattern_.size()/2 << " bunches are available"; 00049 00050 std::vector<HcalQIESample> retval; 00051 retval.reserve(nsamples); 00052 00053 for (int i=0; i<nsamples; i++) { 00054 int bc=bunch+i-npresamples; 00055 retval.push_back(unpack(bc,fiberChan)); 00056 } 00057 return retval; 00058 }
HcalQIESample HcalFiberPattern::unpack | ( | int | bc, | |
int | fc | |||
) | [private] |
Definition at line 19 of file HcalFiberPattern.cc.
References ecalMGPA::adc(), fiber_, pattern_, w1, and w2.
Referenced by getSamples().
00019 { 00020 uint32_t w1=pattern_[bc*2]; // lsw 00021 uint32_t w2=pattern_[bc*2+1]; // msw 00022 00023 int adc=0, capid=0; 00024 bool dv=(w1&0x10000)!=0; 00025 bool er=(w1&0x20000)!=0; 00026 00027 switch (fc) { 00028 case (0): 00029 adc=(w2&0xFE00)>>9; 00030 capid=(w1&0x0180)>>7; 00031 break; 00032 case (1): 00033 adc=(w2&0xFE)>>1; 00034 capid=(w1&0x0060)>>5; 00035 break; 00036 case (2): 00037 adc=(w1&0xFE00)>>9; 00038 capid=(w1&0x0018)>>3; 00039 break; 00040 default: 00041 break; 00042 } 00043 return HcalQIESample(adc,capid,fiber_,fc,dv,er); 00044 }
int HcalFiberPattern::crate_ [private] |
Definition at line 26 of file HcalFiberPattern.h.
Referenced by crate(), getId(), and HcalFiberPattern().
int HcalFiberPattern::dcc_ [private] |
int HcalFiberPattern::fiber_ [private] |
Definition at line 26 of file HcalFiberPattern.h.
Referenced by fiber(), getId(), HcalFiberPattern(), and unpack().
std::vector<uint32_t> HcalFiberPattern::pattern_ [private] |
int HcalFiberPattern::slot_ [private] |
Definition at line 26 of file HcalFiberPattern.h.
Referenced by getId(), HcalFiberPattern(), and slot().
int HcalFiberPattern::spigot_ [private] |
int HcalFiberPattern::tb_ [private] |