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)
 

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

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

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

References HcalHTRData::getFibOrbMsgBCN(), HcalHTRData::is_channel_header(), HcalHTRData::isUnsuppressed(), HcalHTRData::unpack_per_channel_header(), HcalHTRData::wasMarkAndPassZS(), and HcalHTRData::zsBunchMask().

45  {
46  // set parameters
47  digi.setPresamples(presamples);
48  digi.setReadoutIds(eid);
49  int flavor, error_flags, capid0, channelid;
50 
51  HcalHTRData::unpack_per_channel_header(*startPoint,flavor,error_flags,capid0,channelid);
52  bool isCapRotating=!(error_flags&0x1);
53  bool fiberErr=(error_flags&0x2);
54  bool dataValid=!(error_flags&0x2);
55  int fiberchan=channelid&0x3;
56  int fiber=((channelid>>2)&0x7)+1;
57 
58  uint32_t zsmask=hhd.zsBunchMask()>>startSample;
59  digi.setZSInfo(hhd.isUnsuppressed(),hhd.wasMarkAndPassZS(fiber,fiberchan),zsmask);
60 
61  if (expectedTime>=0 && !hhd.isUnsuppressed()) {
62  // std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << std::endl;
63  digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber)-expectedTime);
64  }
65 
66  // what is my sample number?
67  int ncurr=0,ntaken=0;
68  const unsigned short* qie_work=startPoint;
69  for (qie_work++; qie_work!=limit && !HcalHTRData::is_channel_header(*qie_work); qie_work++) {
70  int capidn=(isCapRotating)?((capid0+ncurr)%4):(capid0);
71  int capidn1=(isCapRotating)?((capid0+ncurr+1)%4):(capid0);
72  // two samples in one...
73  HcalQIESample s0((*qie_work)&0x7F,capidn,fiber,fiberchan,dataValid,fiberErr);
74  HcalQIESample s1(((*qie_work)>>8)&0x7F,capidn1,fiber,fiberchan,dataValid,fiberErr);
75 
76  if (ncurr>=startSample && ncurr<=endSample) {
77  digi.setSample(ntaken,s0);
78  ++ntaken;
79  }
80  ncurr++;
81  if (ncurr>=startSample && ncurr<=endSample) {
82  digi.setSample(ntaken,s1);
83  ++ntaken;
84  }
85  ncurr++;
86  }
87  digi.setSize(ntaken);
88  return qie_work;
89  }
bool wasMarkAndPassZS(int fiber, int fiberchan) const
Was this channel passed as part of Mark&amp;Pass ZS?
Definition: HcalHTRData.cc:358
unsigned int getFibOrbMsgBCN(int fiber) const
Get the BCN of the Fiber Orbit Messages.
Definition: HcalHTRData.h:179
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:435
bool isUnsuppressed() const
Is this event an unsuppresed event?
Definition: HcalHTRData.cc:355
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:375