CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
HcalUnpacker_impl Namespace Reference

Functions

template<class DigiClass >
const HcalQIESampleunpack (const HcalQIESample *startPoint, const HcalQIESample *limit, DigiClass &digi, int presamples, const HcalElectronicsId &eid, int startSample, int endSample, int expectedTime, const HcalHTRData &hhd)
 
template<class DigiClass >
const unsigned short * unpack_compact (const unsigned short *startPoint, const unsigned short *limit, DigiClass &digi, int presamples, const HcalElectronicsId &eid, int startSample, int endSample, int expectedTime, const HcalHTRData &hhd)
 
template<class DigiClass >
void unpack_compact (HcalUHTRData::const_iterator &i, const HcalUHTRData::const_iterator &iend, DigiClass &digi, int presamples, const HcalElectronicsId &eid, int startSample, int endSample)
 

Function Documentation

template<class DigiClass >
const HcalQIESample* HcalUnpacker_impl::unpack ( const HcalQIESample startPoint,
const HcalQIESample limit,
DigiClass &  digi,
int  presamples,
const HcalElectronicsId eid,
int  startSample,
int  endSample,
int  expectedTime,
const HcalHTRData hhd 
)

Definition at line 16 of file HcalUnpacker.cc.

References gather_cfg::cout, HcalQIESample::fiber(), HcalQIESample::fiberAndChan(), HcalQIESample::fiberChan(), HcalHTRData::getFibOrbMsgBCN(), HcalHTRData::isUnsuppressed(), HcalHTRData::wasMarkAndPassZS(), and HcalHTRData::zsBunchMask().

24  {
25  // set parameters
26  digi.setPresamples(presamples);
27  digi.setReadoutIds(eid);
28 
29  int fiber = startPoint->fiber();
30  int fiberchan = startPoint->fiberChan();
31  uint32_t zsmask = hhd.zsBunchMask() >> startSample;
32  digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
33 
34  if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
35 #ifdef DebugLog
36  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
37 #endif
38  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
39  }
40 
41  // what is my sample number?
42  int myFiberChan = startPoint->fiberAndChan();
43  int ncurr = 0, ntaken = 0;
44  const HcalQIESample* qie_work = startPoint;
45  while (qie_work != limit && qie_work->fiberAndChan() == myFiberChan) {
46  if (ncurr >= startSample && ncurr <= endSample) {
47  digi.setSample(ntaken, *qie_work);
48  ++ntaken;
49  }
50  ncurr++;
51  qie_work++;
52  }
53  digi.setSize(ntaken);
54  return qie_work;
55  }
constexpr int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:55
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&amp;Pass ZS?
Definition: HcalHTRData.cc:379
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:180
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:400
tuple cout
Definition: gather_cfg.py:144
constexpr int fiber() const
get the fiber number
Definition: HcalQIESample.h:53
constexpr int fiberAndChan() const
get the id channel
Definition: HcalQIESample.h:57
template<class DigiClass >
const unsigned short* HcalUnpacker_impl::unpack_compact ( const unsigned short *  startPoint,
const unsigned short *  limit,
DigiClass &  digi,
int  presamples,
const HcalElectronicsId eid,
int  startSample,
int  endSample,
int  expectedTime,
const HcalHTRData hhd 
)

Definition at line 58 of file HcalUnpacker.cc.

References gather_cfg::cout, HcalHTRData::getFibOrbMsgBCN(), HcalHTRData::is_channel_header(), HcalHTRData::isUnsuppressed(), MessageLogger_cff::limit, compare_using_db::sample, HcalHTRData::unpack_per_channel_header(), HcalHTRData::wasMarkAndPassZS(), and HcalHTRData::zsBunchMask().

66  {
67  // set parameters
68  digi.setPresamples(presamples);
69  digi.setReadoutIds(eid);
70  int flavor, error_flags, capid0, channelid;
71 
72  HcalHTRData::unpack_per_channel_header(*startPoint, flavor, error_flags, capid0, channelid);
73  bool isCapRotating = !(error_flags & 0x1);
74  bool fiberErr = (error_flags & 0x2);
75  bool dataValid = !(error_flags & 0x2);
76  int fiberchan = channelid & 0x3;
77  int fiber = ((channelid >> 2) & 0x7) + 1;
78 
79  uint32_t zsmask = hhd.zsBunchMask() >> startSample;
80  digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
81 
82  if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
83 #ifdef DebugLog
84  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
85 #endif
86  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
87  }
88 
89  // what is my sample number?
90  int ncurr = 0, ntaken = 0;
91  const unsigned short* qie_work = startPoint;
92  // we branch here between normal (flavor=5) and error mode (flavor=6)
93  if (flavor == 5) {
94  for (qie_work++; qie_work != limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
95  int capidn = (isCapRotating) ? ((capid0 + ncurr) % 4) : (capid0);
96  int capidn1 = (isCapRotating) ? ((capid0 + ncurr + 1) % 4) : (capid0);
97  // two samples in one...
98  HcalQIESample s0((*qie_work) & 0x7F, capidn, fiber, fiberchan, dataValid, fiberErr);
99  HcalQIESample s1(((*qie_work) >> 8) & 0x7F, capidn1, fiber, fiberchan, dataValid, fiberErr);
100 
101  if (ncurr >= startSample && ncurr <= endSample) {
102  digi.setSample(ntaken, s0);
103  ++ntaken;
104  }
105  ncurr++;
106  if (ncurr >= startSample && ncurr <= endSample) {
107  digi.setSample(ntaken, s1);
108  ++ntaken;
109  }
110  ncurr++;
111  }
112  digi.setSize(ntaken);
113  } else if (flavor == 6) {
114  for (qie_work++; qie_work != limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
115  if (ncurr >= startSample && ncurr <= endSample) {
116  HcalQIESample sample((*qie_work) & 0x7F,
117  ((*qie_work) >> 8) & 0x3,
118  fiber,
119  fiberchan,
120  ((*qie_work) >> 10) & 0x1,
121  ((*qie_work) >> 11) & 0x1);
122  digi.setSample(ntaken, sample);
123  ++ntaken;
124  }
125 
126  ncurr++;
127  }
128  digi.setSize(ntaken);
129  } else {
130  edm::LogWarning("Bad Data") << "Invalid flavor " << flavor;
131  qie_work = limit;
132  }
133  return qie_work;
134  }
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&amp;Pass ZS?
Definition: HcalHTRData.cc:379
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:180
static bool unpack_per_channel_header(unsigned short, int &flav, int &error_flags, int &capid0, int &channelid)
Unpack a per-channel header word (compact format)
Definition: HcalHTRData.cc:455
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378
static bool is_channel_header(unsigned short value)
check top bit to see if this is a compact format channel header word
Definition: HcalHTRData.h:92
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:400
tuple cout
Definition: gather_cfg.py:144
Log< level::Warning, false > LogWarning
template<class DigiClass >
void HcalUnpacker_impl::unpack_compact ( HcalUHTRData::const_iterator i,
const HcalUHTRData::const_iterator iend,
DigiClass &  digi,
int  presamples,
const HcalElectronicsId eid,
int  startSample,
int  endSample 
)

Definition at line 137 of file HcalUnpacker.cc.

References HcalUHTRData::const_iterator::adc(), HcalUHTRData::const_iterator::capid(), HcalUHTRData::const_iterator::capid0(), HcalUHTRData::const_iterator::channelid(), HcalUHTRData::const_iterator::dataValid(), HcalUHTRData::const_iterator::errFlags(), HcalUHTRData::const_iterator::flavor(), mps_fire::i, HcalUHTRData::const_iterator::isHeader(), alignCSCRings::s, and compare_using_db::sample.

143  {
144  // set parameters
145  digi.setPresamples(presamples - startSample);
146  digi.setReadoutIds(eid);
147  int error_flags = i.errFlags();
148  int capid0 = i.capid0();
149  int flavor = i.flavor();
150 
151  bool isCapRotating = !(error_flags & 0x1);
152  bool fiberErr = (error_flags & 0x2);
153  bool dataValid = !(error_flags & 0x2);
154  int fiberchan = i.channelid() & 0x3;
155  int fiber = ((i.channelid() >> 2) & 0x7) + 1;
156 
157  // digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
158 
159  // what is my sample number?
160  int ncurr = 0, ntaken = 0;
161  if (flavor == 5) {
162  for (++i; i != iend && !i.isHeader(); ++i) {
163  int capidn = (isCapRotating) ? ((capid0 + ncurr) % 4) : (capid0);
164 
165  HcalQIESample s(i.adc(), capidn, fiber, fiberchan, dataValid, fiberErr);
166 
167  if (ncurr >= startSample && ncurr <= endSample) {
168  digi.setSample(ntaken, s);
169  ++ntaken;
170  }
171  ncurr++;
172  }
173  digi.setSize(ntaken);
174  } else if (flavor == 7) { //similar to VME flavor 6, used for premix in MC
175  for (++i; i != iend && !i.isHeader(); ++i) {
176  if (ncurr >= startSample && ncurr <= endSample) {
177  HcalQIESample sample(i.adc(), i.capid(), fiber, fiberchan, i.dataValid(), i.errFlags());
178  digi.setSample(ntaken, sample);
179  ++ntaken;
180  }
181  ncurr++;
182  }
183  digi.setSize(ntaken);
184  }
185  }