CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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().

16  {
17  // set parameters
18  digi.setPresamples(presamples);
19  digi.setReadoutIds(eid);
20 
21  int fiber=startPoint->fiber();
22  int fiberchan=startPoint->fiberChan();
23  uint32_t zsmask=hhd.zsBunchMask()>>startSample;
24  digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
25 
26  if (expectedTime>=0 && !hhd.isUnsuppressed()) {
27 #ifdef DebugLog
28  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
29 #endif
30  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
31  }
32 
33  // what is my sample number?
34  int myFiberChan=startPoint->fiberAndChan();
35  int ncurr=0,ntaken=0;
36  const HcalQIESample* qie_work=startPoint;
37  while (qie_work!=limit && qie_work->fiberAndChan()==myFiberChan) {
38  if (ncurr>=startSample && ncurr<=endSample) {
39  digi.setSample(ntaken,*qie_work);
40  ++ntaken;
41  }
42  ncurr++;
43  qie_work++;
44  }
45  digi.setSize(ntaken);
46  return qie_work;
47  }
int fiberAndChan() const
get the id channel
Definition: HcalQIESample.h:36
int fiberChan() const
get the fiber channel number
Definition: HcalQIESample.h:34
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&amp;Pass ZS?
Definition: HcalHTRData.cc:356
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:178
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:353
int fiber() const
get the fiber number
Definition: HcalQIESample.h:32
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:373
tuple cout
Definition: gather_cfg.py:145
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 51 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().

53  {
54  // set parameters
55  digi.setPresamples(presamples);
56  digi.setReadoutIds(eid);
57  int flavor, error_flags, capid0, channelid;
58 
59  HcalHTRData::unpack_per_channel_header(*startPoint,flavor,error_flags,capid0,channelid);
60  bool isCapRotating=!(error_flags&0x1);
61  bool fiberErr=(error_flags&0x2);
62  bool dataValid=!(error_flags&0x2);
63  int fiberchan=channelid&0x3;
64  int fiber=((channelid>>2)&0x7)+1;
65 
66  uint32_t zsmask=hhd.zsBunchMask()>>startSample;
67  digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
68 
69  if (expectedTime>=0 && !hhd.isUnsuppressed()) {
70 #ifdef DebugLog
71  std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
72 #endif
73  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
74  }
75 
76  // what is my sample number?
77  int ncurr=0,ntaken=0;
78  const unsigned short* qie_work=startPoint;
79  // we branch here between normal (flavor=5) and error mode (flavor=6)
80  if (flavor==5) {
81  for (qie_work++; qie_work!=limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
82  int capidn=(isCapRotating)?((capid0+ncurr)%4):(capid0);
83  int capidn1=(isCapRotating)?((capid0+ncurr+1)%4):(capid0);
84  // two samples in one...
85  HcalQIESample s0((*qie_work)&0x7F,capidn,fiber,fiberchan,dataValid,fiberErr);
86  HcalQIESample s1(((*qie_work)>>8)&0x7F,capidn1,fiber,fiberchan,dataValid,fiberErr);
87 
88  if (ncurr>=startSample && ncurr<=endSample) {
89  digi.setSample(ntaken,s0);
90  ++ntaken;
91  }
92  ncurr++;
93  if (ncurr>=startSample && ncurr<=endSample) {
94  digi.setSample(ntaken,s1);
95  ++ntaken;
96  }
97  ncurr++;
98  }
99  digi.setSize(ntaken);
100  } else if (flavor==6) {
101  for (qie_work++; qie_work!=limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
102  if (ncurr>=startSample && ncurr<=endSample) {
103  HcalQIESample sample((*qie_work)&0x7F,((*qie_work)>>8)&0x3,fiber,fiberchan,((*qie_work)>>10)&0x1,((*qie_work)>>11)&0x1);
104  digi.setSample(ntaken,sample);
105  ++ntaken;
106  }
107  ncurr++;
108  }
109  digi.setSize(ntaken);
110  } else {
111  edm::LogWarning("Bad Data") << "Invalid flavor " << flavor;
112  qie_work=limit;
113  }
114  return qie_work;
115  }
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&amp;Pass ZS?
Definition: HcalHTRData.cc:356
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:178
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:433
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:353
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:90
uint32_t zsBunchMask() const
ZS Bunch Mask (if available)
Definition: HcalHTRData.cc:373
tuple cout
Definition: gather_cfg.py:145
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 118 of file HcalUnpacker.cc.

References HcalUHTRData::const_iterator::adc(), HcalUHTRData::const_iterator::capid0(), HcalUHTRData::const_iterator::channelid(), HcalUHTRData::const_iterator::errFlags(), i, HcalUHTRData::const_iterator::isHeader(), and alignCSCRings::s.

119  {
120  // set parameters
121  digi.setPresamples(presamples-startSample);
122  digi.setReadoutIds(eid);
123  int error_flags=i.errFlags();
124  int capid0=i.capid0();
125 
126  bool isCapRotating=!(error_flags&0x1);
127  bool fiberErr=(error_flags&0x2);
128  bool dataValid=!(error_flags&0x2);
129  int fiberchan=i.channelid()&0x3;
130  int fiber=((i.channelid()>>2)&0x7)+1;
131 
132  // digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
133 
134  // what is my sample number?
135  int ncurr=0,ntaken=0;
136  for (++i; i!=iend && !i.isHeader(); ++i) {
137  int capidn=(isCapRotating)?((capid0+ncurr)%4):(capid0);
138 
139  HcalQIESample s(i.adc(),capidn,fiber,fiberchan,dataValid,fiberErr);
140 
141  if (ncurr>=startSample && ncurr<=endSample) {
142  digi.setSample(ntaken,s);
143  ++ntaken;
144  }
145  ncurr++;
146  }
147  digi.setSize(ntaken);
148  }
int i
Definition: DBlmapReader.cc:9