CMS 3D CMS Logo

HBHERecHitAuxSetter.cc
Go to the documentation of this file.
3 
5  HBHERecHit* rechit)
6 {
7  using namespace CaloRecHitAuxSetter;
8 
9  uint32_t aux = 0, auxHBHE = 0, auxPhase1 = 0;
10 
11  // Pack ADC values
12  unsigned nSamples = info.nSamples();
13  if (nSamples > 10)
14  nSamples = 10;
15  for (unsigned i=0; i<4 && i<nSamples; ++i)
16  setField(&aux, 0xff, i*8, info.tsAdc(i));
17  for (unsigned i=4; i<8 && i<nSamples; ++i)
18  setField(&auxHBHE, 0xff, (i-4)*8, info.tsAdc(i));
19  for (unsigned i=8; i<nSamples; ++i)
20  setField(&auxPhase1, 0xff, (i-8)*8, info.tsAdc(i));
21 
22  // Pack other fields
23  setField(&auxPhase1, MASK_NSAMPLES, OFF_NSAMPLES, nSamples);
24  unsigned soi = info.soi();
25  if (soi > 10)
26  soi = 10;
27  setField(&auxPhase1, MASK_SOI, OFF_SOI, soi);
28  setField(&auxPhase1, MASK_CAPID, OFF_CAPID, info.capid());
29 
30  // Pack status bits
31  setBit(&auxPhase1, OFF_TDC_TIME, info.hasTimeInfo());
32  setBit(&auxPhase1, OFF_DROPPED, info.isDropped());
33  setBit(&auxPhase1, OFF_LINK_ERR, info.hasLinkError());
34  setBit(&auxPhase1, OFF_CAPID_ERR, info.hasCapidError());
35 
36  // Copy the aux words into the rechit
37  rechit->setAux(aux);
38  rechit->setAuxHBHE(auxHBHE);
39  rechit->setAuxPhase1(auxPhase1);
40 }
static const TGPicture * info(bool iBackgroundIsBlack)
static const unsigned MASK_NSAMPLES
constexpr void setField(uint32_t *u, const unsigned mask, const unsigned offset, const unsigned value)
bool hasTimeInfo() const
static const unsigned OFF_SOI
static const unsigned MASK_CAPID
unsigned soi() const
static const unsigned OFF_NSAMPLES
static const unsigned OFF_DROPPED
static const unsigned OFF_CAPID
static const unsigned OFF_TDC_TIME
static const unsigned OFF_CAPID_ERR
static const unsigned OFF_LINK_ERR
static const unsigned MASK_SOI
void setAuxHBHE(const uint32_t aux)
Definition: HBHERecHit.h:53
constexpr size_t nSamples
void setBit(int &_bitArray, unsigned _iBit)
static void setAux(const HBHEChannelInfo &info, HBHERecHit *rechit)
bool hasLinkError() const
bool isDropped() const
constexpr void setAux(uint32_t value)
Definition: CaloRecHit.h:51
unsigned nSamples() const
int capid() const
uint8_t tsAdc(const unsigned ts) const
void setAuxPhase1(const uint32_t aux)
Definition: HBHERecHit.h:56
bool hasCapidError() const