CMS 3D CMS Logo

HFRecHitAuxSetter.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <type_traits>
3 
5 
8 
10  const unsigned anodeStates[2],
11  const unsigned u_soiPhase,
12  HFRecHit* rechit) {
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
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 }
CaloRecHitAuxSetter::setField
constexpr void setField(uint32_t *u, const unsigned mask, const unsigned offset, const unsigned value)
Definition: CaloRecHitAuxSetter.h:8
HFQIE10Info
Definition: HFQIE10Info.h:15
HFAnodeStatus::N_POSSIBLE_STATES
Definition: HFAnodeStatus.h:14
HFPreRecHit::getHFQIE10Info
constexpr HFQIE10Info const * getHFQIE10Info(unsigned index) const
Definition: HFPreRecHit.h:39
HFRecHitAuxSetter::OFF_STATUS
static const unsigned OFF_STATUS
Definition: HFRecHitAuxSetter.h:32
HFRecHitAuxSetter::MASK_SOI
static const unsigned MASK_SOI
Definition: HFRecHitAuxSetter.h:19
HFRecHitAuxSetter::MASK_CAPID
static const unsigned MASK_CAPID
Definition: HFRecHitAuxSetter.h:25
HFRecHit
Definition: HFRecHit.h:11
CaloRecHit::setAux
constexpr void setAux(uint32_t value)
Definition: CaloRecHit.h:49
HFRecHitAuxSetter::MASK_STATUS
static const unsigned MASK_STATUS
Definition: HFRecHitAuxSetter.h:31
HFQIE10Info::getRaw
constexpr raw_type getRaw(const unsigned which) const
Definition: HFQIE10Info.h:85
HFRecHitAuxSetter.h
HFQIE10Info::nRaw
constexpr unsigned nRaw() const
Definition: HFQIE10Info.h:83
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
HFAnodeStatus.h
HFRecHit::setAuxHF
constexpr void setAuxHF(const uint32_t u)
Definition: HFRecHit.h:28
printConversionInfo.aux
aux
Definition: printConversionInfo.py:19
HFRecHitAuxSetter::OFF_SOI
static const unsigned OFF_SOI
Definition: HFRecHitAuxSetter.h:20
HFRecHitAuxSetter::OFF_CAPID
static const unsigned OFF_CAPID
Definition: HFRecHitAuxSetter.h:26
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
QIE10DataFrame::Sample
Definition: QIE10DataFrame.h:20
HFPreRecHit
Definition: HFPreRecHit.h:14
CaloRecHitAuxSetter.h
CaloRecHitAuxSetter
Definition: CaloRecHitAuxSetter.h:7
HFQIE10Info::soi
constexpr unsigned soi() const
Definition: HFQIE10Info.h:84
HFRecHitAuxSetter::setAux
static void setAux(const HFPreRecHit &prehit, const unsigned anodeStates[2], unsigned soiPhase, HFRecHit *rechit)
Definition: HFRecHitAuxSetter.cc:9