CMS 3D CMS Logo

List of all members | Static Public Member Functions | Static Public Attributes
HFRecHitAuxSetter Struct Reference

#include <HFRecHitAuxSetter.h>

Static Public Member Functions

static void setAux (const HFPreRecHit &prehit, const unsigned anodeStates[2], unsigned soiPhase, HFRecHit *rechit)
 

Static Public Attributes

static const unsigned MASK_ADC = 0xffffff
 
static const unsigned MASK_CAPID = 0x3
 
static const unsigned MASK_SOI = 0x3
 
static const unsigned MASK_STATUS = 0xf
 
static const unsigned OFF_ADC = 0
 
static const unsigned OFF_CAPID = 26
 
static const unsigned OFF_SOI = 24
 
static const unsigned OFF_STATUS = 28
 

Detailed Description

Definition at line 10 of file HFRecHitAuxSetter.h.

Member Function Documentation

void HFRecHitAuxSetter::setAux ( const HFPreRecHit prehit,
const unsigned  anodeStates[2],
unsigned  soiPhase,
HFRecHit rechit 
)
static

Definition at line 9 of file HFRecHitAuxSetter.cc.

References printConversionInfo::aux, HFPreRecHit::getHFQIE10Info(), HFQIE10Info::getRaw(), MASK_CAPID, MASK_SOI, MASK_STATUS, HFAnodeStatus::N_POSSIBLE_STATES, HFQIE10Info::nRaw(), OFF_CAPID, OFF_SOI, OFF_STATUS, CaloRecHit::setAux(), HFRecHit::setAuxHF(), CaloRecHitAuxSetter::setField(), edm::shift, HFQIE10Info::soi(), and mitigatedMETSequence_cff::U.

Referenced by HFSimpleTimeCheck::reconstruct().

12  {
13  using namespace CaloRecHitAuxSetter;
14 
15  const int wantedPhase = u_soiPhase < 2U ? u_soiPhase : 2U;
16 
17  for (unsigned ianode = 0; ianode < 2; ++ianode) {
18  uint32_t aux = 0;
19  const HFQIE10Info* anodeInfo = prehit.getHFQIE10Info(ianode);
20  if (anodeInfo) {
21  const int nRaw = anodeInfo->nRaw();
22  const int soiStored = anodeInfo->soi();
23  if (soiStored < nRaw) {
24  // SOI is in the raw data. Figure out a good
25  // way to map ADCs into the three bytes available.
26  int shift = 0;
27  int nStore = nRaw;
28  if (nRaw > 3) {
29  nStore = 3;
30  if (soiStored > wantedPhase)
31  shift = soiStored - wantedPhase;
32  if (shift + nStore > nRaw)
33  shift = nRaw - nStore;
34  }
35 
36  // Fill out the ADC fields
37  for (int iadc = 0; iadc < nStore; ++iadc) {
38  const int istored = iadc + shift;
39  const QIE10DataFrame::Sample ts(anodeInfo->getRaw(istored));
40  setField(&aux, 0xff, iadc * 8, ts.adc());
41  if (istored == soiStored)
42  setField(&aux, MASK_CAPID, OFF_CAPID, ts.capid());
43  }
44  setField(&aux, MASK_SOI, OFF_SOI, soiStored - shift);
45  } else
46  setField(&aux, MASK_SOI, OFF_SOI, 3U);
47  }
48 
49  // Remember anode status
50  static_assert(HFAnodeStatus::N_POSSIBLE_STATES <= MASK_STATUS + 1,
51  "Possible states enum must fit into the bit field");
52  setField(&aux, MASK_STATUS, OFF_STATUS, anodeStates[ianode]);
53 
54  // Fill the aux field in the rechit
55  if (ianode)
56  rechit->setAuxHF(aux);
57  else
58  rechit->setAux(aux);
59  }
60 }
constexpr void setField(uint32_t *u, const unsigned mask, const unsigned offset, const unsigned value)
static const unsigned OFF_CAPID
void setAuxHF(const uint32_t u)
Definition: HFRecHit.h:28
static const unsigned OFF_STATUS
unsigned nRaw() const
Definition: HFQIE10Info.h:83
static const unsigned MASK_STATUS
static const unsigned OFF_SOI
HFQIE10Info const * getHFQIE10Info(unsigned index) const
Definition: HFPreRecHit.h:39
static const unsigned MASK_CAPID
static const unsigned MASK_SOI
raw_type getRaw(const unsigned which) const
Definition: HFQIE10Info.h:85
unsigned soi() const
Definition: HFQIE10Info.h:84
static unsigned int const shift
constexpr void setAux(uint32_t value)
Definition: CaloRecHit.h:49

Member Data Documentation

const unsigned HFRecHitAuxSetter::MASK_ADC = 0xffffff
static

Definition at line 12 of file HFRecHitAuxSetter.h.

const unsigned HFRecHitAuxSetter::MASK_CAPID = 0x3
static

Definition at line 25 of file HFRecHitAuxSetter.h.

Referenced by setAux().

const unsigned HFRecHitAuxSetter::MASK_SOI = 0x3
static

Definition at line 19 of file HFRecHitAuxSetter.h.

Referenced by setAux().

const unsigned HFRecHitAuxSetter::MASK_STATUS = 0xf
static

Definition at line 31 of file HFRecHitAuxSetter.h.

Referenced by HFFlexibleTimeCheck::reconstruct(), and setAux().

const unsigned HFRecHitAuxSetter::OFF_ADC = 0
static

Definition at line 13 of file HFRecHitAuxSetter.h.

const unsigned HFRecHitAuxSetter::OFF_CAPID = 26
static

Definition at line 26 of file HFRecHitAuxSetter.h.

Referenced by setAux().

const unsigned HFRecHitAuxSetter::OFF_SOI = 24
static

Definition at line 20 of file HFRecHitAuxSetter.h.

Referenced by setAux().

const unsigned HFRecHitAuxSetter::OFF_STATUS = 28
static

Definition at line 32 of file HFRecHitAuxSetter.h.

Referenced by HFFlexibleTimeCheck::reconstruct(), and setAux().