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

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

14  {
15  // set parameters
16  digi.setPresamples(presamples);
17  digi.setReadoutIds(eid);
18 
19  int fiber=startPoint->fiber();
20  int fiberchan=startPoint->fiberChan();
21  uint32_t zsmask=hhd.zsBunchMask()>>startSample;
22  digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
23 
24  if (expectedTime>=0 && !hhd.isUnsuppressed()) {
25  // std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
26  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
27  }
28 
29  // what is my sample number?
30  int myFiberChan=startPoint->fiberAndChan();
31  int ncurr=0,ntaken=0;
32  const HcalQIESample* qie_work=startPoint;
33  while (qie_work!=limit && qie_work->fiberAndChan()==myFiberChan) {
34  if (ncurr>=startSample && ncurr<=endSample) {
35  digi.setSample(ntaken,*qie_work);
36  ++ntaken;
37  }
38  ncurr++;
39  qie_work++;
40  }
41  digi.setSize(ntaken);
42  return qie_work;
43  }
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:177
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
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 47 of file HcalUnpacker.cc.

References 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().

49  {
50  // set parameters
51  digi.setPresamples(presamples);
52  digi.setReadoutIds(eid);
53  int flavor, error_flags, capid0, channelid;
54 
55  HcalHTRData::unpack_per_channel_header(*startPoint,flavor,error_flags,capid0,channelid);
56  bool isCapRotating=!(error_flags&0x1);
57  bool fiberErr=(error_flags&0x2);
58  bool dataValid=!(error_flags&0x2);
59  int fiberchan=channelid&0x3;
60  int fiber=((channelid>>2)&0x7)+1;
61 
62  uint32_t zsmask=hhd.zsBunchMask()>>startSample;
63  digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
64 
65  if (expectedTime>=0 && !hhd.isUnsuppressed()) {
66  // std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
67  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
68  }
69 
70  // what is my sample number?
71  int ncurr=0,ntaken=0;
72  const unsigned short* qie_work=startPoint;
73  // we branch here between normal (flavor=5) and error mode (flavor=6)
74  if (flavor==5) {
75  for (qie_work++; qie_work!=limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
76  int capidn=(isCapRotating)?((capid0+ncurr)%4):(capid0);
77  int capidn1=(isCapRotating)?((capid0+ncurr+1)%4):(capid0);
78  // two samples in one...
79  HcalQIESample s0((*qie_work)&0x7F,capidn,fiber,fiberchan,dataValid,fiberErr);
80  HcalQIESample s1(((*qie_work)>>8)&0x7F,capidn1,fiber,fiberchan,dataValid,fiberErr);
81 
82  if (ncurr>=startSample && ncurr<=endSample) {
83  digi.setSample(ntaken,s0);
84  ++ntaken;
85  }
86  ncurr++;
87  if (ncurr>=startSample && ncurr<=endSample) {
88  digi.setSample(ntaken,s1);
89  ++ntaken;
90  }
91  ncurr++;
92  }
93  digi.setSize(ntaken);
94  } else if (flavor==6) {
95  for (qie_work++; qie_work!=limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
96  if (ncurr>=startSample && ncurr<=endSample) {
97  HcalQIESample sample((*qie_work)&0x7F,((*qie_work)>>8)&0x3,fiber,fiberchan,((*qie_work)>>10)&0x1,((*qie_work)>>11)&0x1);
98  digi.setSample(ntaken,sample);
99  ++ntaken;
100  }
101  ncurr++;
102  }
103  digi.setSize(ntaken);
104  } else {
105  edm::LogWarning("Bad Data") << "Invalid flavor " << flavor;
106  qie_work=limit;
107  }
108  return qie_work;
109  }
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:177
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
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 112 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.

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