CMS 3D CMS Logo

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

◆ unpack()

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 17 of file HcalUnpacker.cc.

25  {
26  // set parameters
27  digi.setPresamples(presamples);
28  digi.setReadoutIds(eid);
29 
30  int fiber = startPoint->fiber();
31  int fiberchan = startPoint->fiberChan();
32  uint32_t zsmask = hhd.zsBunchMask() >> startSample;
33  digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
34 
35  if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
36 #ifdef DebugLog
37  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
38 #endif
39  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
40  }
41 
42  // what is my sample number?
43  int myFiberChan = startPoint->fiberAndChan();
44  int ncurr = 0, ntaken = 0;
45  const HcalQIESample* qie_work = startPoint;
46  while (qie_work != limit && qie_work->fiberAndChan() == myFiberChan) {
47  if (ncurr >= startSample && ncurr <= endSample) {
48  digi.setSample(ntaken, *qie_work);
49  ++ntaken;
50  }
51  ncurr++;
52  qie_work++;
53  }
54  digi.setSize(ntaken);
55  return qie_work;
56  }

References gather_cfg::cout, runTauDisplay::eid, HcalQIESample::fiber(), HcalQIESample::fiberAndChan(), HcalQIESample::fiberChan(), HcalHTRData::getFibOrbMsgBCN(), HcalHTRData::isUnsuppressed(), remoteMonitoring_LED_IterMethod_cfg::limit, hcalTTPDigis_cfi::presamples, HcalHTRData::wasMarkAndPassZS(), and HcalHTRData::zsBunchMask().

◆ unpack_compact() [1/2]

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 59 of file HcalUnpacker.cc.

67  {
68  // set parameters
69  digi.setPresamples(presamples);
70  digi.setReadoutIds(eid);
71  int flavor, error_flags, capid0, channelid;
72 
73  HcalHTRData::unpack_per_channel_header(*startPoint, flavor, error_flags, capid0, channelid);
74  bool isCapRotating = !(error_flags & 0x1);
75  bool fiberErr = (error_flags & 0x2);
76  bool dataValid = !(error_flags & 0x2);
77  int fiberchan = channelid & 0x3;
78  int fiber = ((channelid >> 2) & 0x7) + 1;
79 
80  uint32_t zsmask = hhd.zsBunchMask() >> startSample;
81  digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
82 
83  if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
84 #ifdef DebugLog
85  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
86 #endif
87  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
88  }
89 
90  // what is my sample number?
91  int ncurr = 0, ntaken = 0;
92  const unsigned short* qie_work = startPoint;
93  // we branch here between normal (flavor=5) and error mode (flavor=6)
94  if (flavor == 5) {
95  for (qie_work++; qie_work != limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
96  int capidn = (isCapRotating) ? ((capid0 + ncurr) % 4) : (capid0);
97  int capidn1 = (isCapRotating) ? ((capid0 + ncurr + 1) % 4) : (capid0);
98  // two samples in one...
99  HcalQIESample s0((*qie_work) & 0x7F, capidn, fiber, fiberchan, dataValid, fiberErr);
100  HcalQIESample s1(((*qie_work) >> 8) & 0x7F, capidn1, fiber, fiberchan, dataValid, fiberErr);
101 
102  if (ncurr >= startSample && ncurr <= endSample) {
103  digi.setSample(ntaken, s0);
104  ++ntaken;
105  }
106  ncurr++;
107  if (ncurr >= startSample && ncurr <= endSample) {
108  digi.setSample(ntaken, s1);
109  ++ntaken;
110  }
111  ncurr++;
112  }
113  digi.setSize(ntaken);
114  } else if (flavor == 6) {
115  for (qie_work++; qie_work != limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
116  if (ncurr >= startSample && ncurr <= endSample) {
117  HcalQIESample sample((*qie_work) & 0x7F,
118  ((*qie_work) >> 8) & 0x3,
119  fiber,
120  fiberchan,
121  ((*qie_work) >> 10) & 0x1,
122  ((*qie_work) >> 11) & 0x1);
123  digi.setSample(ntaken, sample);
124  ++ntaken;
125  }
126 
127  ncurr++;
128  }
129  digi.setSize(ntaken);
130  } else {
131  edm::LogWarning("Bad Data") << "Invalid flavor " << flavor;
132  qie_work = limit;
133  }
134  return qie_work;
135  }

References gather_cfg::cout, runTauDisplay::eid, HcalHTRData::getFibOrbMsgBCN(), HcalHTRData::is_channel_header(), HcalHTRData::isUnsuppressed(), remoteMonitoring_LED_IterMethod_cfg::limit, hcalTTPDigis_cfi::presamples, simplePhotonAnalyzer_cfi::sample, HcalHTRData::unpack_per_channel_header(), HcalHTRData::wasMarkAndPassZS(), testProducerWithPsetDescEmpty_cfi::x1, and HcalHTRData::zsBunchMask().

◆ unpack_compact() [2/2]

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 138 of file HcalUnpacker.cc.

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

References runTauDisplay::eid, mps_fire::i, hcalTTPDigis_cfi::presamples, alignCSCRings::s, and simplePhotonAnalyzer_cfi::sample.

mps_fire.i
i
Definition: mps_fire.py:355
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
HcalHTRData::zsBunchMask
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:400
HcalHTRData::isUnsuppressed
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:378
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalHTRData::wasMarkAndPassZS
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&Pass ZS?
Definition: HcalHTRData.cc:379
HcalQIESample::fiberAndChan
constexpr int fiberAndChan() const
get the id channel
Definition: HcalQIESample.h:57
HcalQIESample
Definition: HcalQIESample.h:32
HcalHTRData::unpack_per_channel_header
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
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HcalHTRData::is_channel_header
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
HcalQIESample::fiber
constexpr int fiber() const
get the fiber number
Definition: HcalQIESample.h:53
hcalTTPDigis_cfi.presamples
presamples
Definition: hcalTTPDigis_cfi.py:9
edm::LogWarning
Definition: MessageLogger.h:141
HcalQIESample::fiberChan
constexpr int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:55
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
remoteMonitoring_LED_IterMethod_cfg.limit
limit
Definition: remoteMonitoring_LED_IterMethod_cfg.py:427
HcalHTRData::getFibOrbMsgBCN
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:180