CMS 3D CMS Logo

HBHERecHitAuxSetter.h
Go to the documentation of this file.
1 #ifndef DataFormats_HcalRecHit_HBHERecHitAuxSetter_h_
2 #define DataFormats_HcalRecHit_HBHERecHitAuxSetter_h_
3 
7 
8 //
9 // Set rechit "auxiliary words" for the Phase 1 HBHE reco.
10 //
11 // The standars CaloRecHit "aux" word contains ADC values 0-3.
12 //
13 // The "auxHBHE" word of HBHERecHit contains ADC values 4-7.
14 //
15 // The "auxPhase1" word of HBHERecHit contains ADC values 8-9
16 // and other info, as specified by the masks and offsets below.
17 //
19  static const unsigned MASK_ADC = 0xffff;
20  static const unsigned OFF_ADC = 0;
21 
22  // How many ADC values are actually stored
23  static const unsigned MASK_NSAMPLES = 0xf;
24  static const unsigned OFF_NSAMPLES = 16;
25 
26  // Which ADC corresponds to the sample of interest.
27  static const unsigned MASK_SOI = 0xf;
28  static const unsigned OFF_SOI = 20;
29 
30  // CAPID for the sample of interest.
31  static const unsigned MASK_CAPID = 0x3;
32  static const unsigned OFF_CAPID = 24;
33 
34  // Various status bits (pack bools from HBHEChannelInfo)
35  static const unsigned OFF_TDC_TIME = 26;
36  static const unsigned OFF_DROPPED = 27;
37  static const unsigned OFF_LINK_ERR = 28;
38  static const unsigned OFF_CAPID_ERR = 29;
39 
40  // Flag identifying combined "Plan 1" rechits
41  static const unsigned OFF_COMBINED = 30;
42 
43  // Main function for setting the aux words.
44  constexpr static void setAux(const HBHEChannelInfo& info, HBHERecHit* rechit);
45 };
46 
48  using namespace CaloRecHitAuxSetter;
49 
50  uint32_t aux = 0, auxHBHE = 0, auxPhase1 = 0;
51 
52  // Pack ADC values
53  unsigned nSamples = info.nSamples();
54  if (nSamples > 10)
55  nSamples = 10;
56  for (unsigned i = 0; i < 4 && i < nSamples; ++i)
57  setField(&aux, 0xff, i * 8, info.tsAdc(i));
58  for (unsigned i = 4; i < 8 && i < nSamples; ++i)
59  setField(&auxHBHE, 0xff, (i - 4) * 8, info.tsAdc(i));
60  for (unsigned i = 8; i < nSamples; ++i)
61  setField(&auxPhase1, 0xff, (i - 8) * 8, info.tsAdc(i));
62 
63  // Pack other fields
65  unsigned soi = info.soi();
66  if (soi > 10)
67  soi = 10;
68  setField(&auxPhase1, MASK_SOI, OFF_SOI, soi);
69  setField(&auxPhase1, MASK_CAPID, OFF_CAPID, info.capid());
70 
71  // Pack status bits
72  setBit(&auxPhase1, OFF_TDC_TIME, info.hasTimeInfo());
73  setBit(&auxPhase1, OFF_DROPPED, info.isDropped());
74  setBit(&auxPhase1, OFF_LINK_ERR, info.hasLinkError());
75  setBit(&auxPhase1, OFF_CAPID_ERR, info.hasCapidError());
76 
77  // Copy the aux words into the rechit
78  rechit->setAux(aux);
79  rechit->setAuxHBHE(auxHBHE);
80  rechit->setAuxPhase1(auxPhase1);
81 }
82 
83 #endif // DataFormats_HcalRecHit_HBHERecHitAuxSetter_h_
HBHERecHitAuxSetter::MASK_CAPID
static const unsigned MASK_CAPID
Definition: HBHERecHitAuxSetter.h:31
CaloRecHitAuxSetter::setField
constexpr void setField(uint32_t *u, const unsigned mask, const unsigned offset, const unsigned value)
Definition: CaloRecHitAuxSetter.h:8
HBHERecHitAuxSetter::OFF_COMBINED
static const unsigned OFF_COMBINED
Definition: HBHERecHitAuxSetter.h:41
mps_fire.i
i
Definition: mps_fire.py:428
HBHERecHitAuxSetter::setAux
constexpr static void setAux(const HBHEChannelInfo &info, HBHERecHit *rechit)
Definition: HBHERecHitAuxSetter.h:47
HBHERecHit
Definition: HBHERecHit.h:13
HBHERecHitAuxSetter::OFF_CAPID_ERR
static const unsigned OFF_CAPID_ERR
Definition: HBHERecHitAuxSetter.h:38
HBHERecHitAuxSetter::OFF_TDC_TIME
static const unsigned OFF_TDC_TIME
Definition: HBHERecHitAuxSetter.h:35
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
HBHERecHitAuxSetter::OFF_DROPPED
static const unsigned OFF_DROPPED
Definition: HBHERecHitAuxSetter.h:36
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
HBHERecHitAuxSetter::OFF_CAPID
static const unsigned OFF_CAPID
Definition: HBHERecHitAuxSetter.h:32
HBHERecHitAuxSetter::MASK_NSAMPLES
static const unsigned MASK_NSAMPLES
Definition: HBHERecHitAuxSetter.h:23
HBHERecHit::setAuxHBHE
constexpr void setAuxHBHE(const uint32_t aux)
Definition: HBHERecHit.h:52
setBit
void setBit(int &_bitArray, unsigned _iBit)
Definition: EcalCondDBWriter.cc:17
CaloRecHit::setAux
constexpr void setAux(uint32_t value)
Definition: CaloRecHit.h:49
HBHERecHitAuxSetter::MASK_SOI
static const unsigned MASK_SOI
Definition: HBHERecHitAuxSetter.h:27
HBHERecHitAuxSetter
Definition: HBHERecHitAuxSetter.h:18
HBHEChannelInfo.h
printConversionInfo.aux
aux
Definition: printConversionInfo.py:19
HBHERecHitAuxSetter::OFF_ADC
static const unsigned OFF_ADC
Definition: HBHERecHitAuxSetter.h:20
HBHERecHit.h
HBHERecHitAuxSetter::OFF_NSAMPLES
static const unsigned OFF_NSAMPLES
Definition: HBHERecHitAuxSetter.h:24
HBHERecHitAuxSetter::MASK_ADC
static const unsigned MASK_ADC
Definition: HBHERecHitAuxSetter.h:19
HBHERecHitAuxSetter::OFF_LINK_ERR
static const unsigned OFF_LINK_ERR
Definition: HBHERecHitAuxSetter.h:37
HBHERecHitAuxSetter::OFF_SOI
static const unsigned OFF_SOI
Definition: HBHERecHitAuxSetter.h:28
CaloRecHitAuxSetter.h
CaloRecHitAuxSetter
Definition: CaloRecHitAuxSetter.h:7
HBHEChannelInfo
Definition: HBHEChannelInfo.h:15
HBHERecHit::setAuxPhase1
constexpr void setAuxPhase1(const uint32_t aux)
Definition: HBHERecHit.h:55