CMS 3D CMS Logo

Functions | Variables
HFTimingTrust Namespace Reference

Functions

template<class T , class V >
void checkHFTimErr (T &rechit, const V &digi, int level1, int level2)
 
double timerr_hf (double rectime, double ampl)
 

Variables

static const float hfterrlut [195]
 

Function Documentation

◆ checkHFTimErr()

template<class T , class V >
void HFTimingTrust::checkHFTimErr ( T rechit,
const V &  digi,
int  level1,
int  level2 
)

Definition at line 11 of file HFTimingTrustFlag.cc.

11  {
12  // Get rechit timing
13  double rectime = rechit.time();
14 
15  if (rectime > -100 && rectime < 250) {
16  // Get signal from digi
17  double ampl = 0;
18  double sum = 0;
19  int maxI = -1;
20  for (int i = 0; i < digi.size(); ++i) {
21  sum += digi.sample(i).nominal_fC();
22  if (digi.sample(i).nominal_fC() > ampl) {
23  ampl = digi.sample(i).nominal_fC();
24  maxI = i;
25  }
26  }
27  if (ampl > 1 && maxI > 0 && maxI < digi.size() - 1) {
28  ampl = ampl + digi.sample(maxI - 1).nominal_fC() + digi.sample(maxI + 1).nominal_fC();
29  ampl -= (sum - ampl) * 3.0 / (digi.size() - 3);
30  if (ampl > 3) {
31  int timerr = (int)timerr_hf(rectime, ampl);
32  uint32_t status = 0;
33  if (timerr < 0)
34  status = 3; // unreconstructable time
35  else if (timerr <= level1)
36  status = 0; // time reconstructed; precision better than level1 value
37  else if (timerr <= level2)
38  status = 1; // precision worse than level1 value
39  else
40  status = 2; //precision worse than level 2 value
41  rechit.setFlagField(status, HcalCaloFlagLabels::HFTimingTrustBits, 2);
42  return;
43  }
44  }
45 
46  } // if (rectime > -100 && rectime < -250)
47  // if rectime outside expected range, set flag field to 3 (unreconstructable)?
48  rechit.setFlagField(3, HcalCaloFlagLabels::HFTimingTrustBits, 2);
49  return;
50  }

References HcalCaloFlagLabels::HFTimingTrustBits, mps_fire::i, createfilelist::int, findQualityFiles::maxI, mps_update::status, and timerr_hf().

◆ timerr_hf()

double HFTimingTrust::timerr_hf ( double  rectime,
double  ampl 
)

Definition at line 65 of file HFTimingTrustFlag.cc.

65  {
66  int itim, iampl, index;
67  double tim;
68  if (rectime > 0)
69  tim = rectime - ((int)(rectime / 25)) * 25;
70  else
71  tim = rectime - ((int)(rectime / 25)) * 25 + 25;
72  itim = (int)(tim / 2.0);
73 
74  iampl = 0;
75  static const double bampl[15] = {3, 5, 8, 12, 19, 30, 47, 73, 115, 182, 287, 452, 712, 1120, 1766};
76  if (ampl >= bampl[14])
77  iampl = 14;
78  else {
79  for (int i = 1; i <= 14; i++) {
80  if (ampl < bampl[i]) {
81  iampl = i - 1;
82  break;
83  }
84  }
85  }
86 
87  index = itim + iampl * 13;
88 
89  double y1 = hfterrlut[index];
90  double y2 = 0;
91  double v1 = y1;
92  if (itim < 12) {
93  y2 = hfterrlut[index + 1];
94  v1 = y1 + (y2 - y1) * (tim / 2.0 - (float)itim);
95  }
96  double yy1 = 0;
97  double yy2 = 0;
98  double v2 = 0;
99  if (iampl < 14) {
100  yy1 = hfterrlut[index + 13];
101  if (itim == 12)
102  v2 = yy1;
103  else {
104  yy2 = hfterrlut[index + 14];
105  v2 = yy1 + (yy2 - yy1) * (tim / 2.0 - (float)itim);
106  }
107  v1 = v1 + (v2 - v1) * (ampl - bampl[iampl]) / (bampl[iampl + 1] - bampl[iampl]);
108  }
109 
110  return v1;
111  }

References hfterrlut, mps_fire::i, createfilelist::int, testProducerWithPsetDescEmpty_cfi::y1, and testProducerWithPsetDescEmpty_cfi::y2.

Referenced by checkHFTimErr().

Variable Documentation

◆ hfterrlut

const float HFTimingTrust::hfterrlut[195]
static
Initial value:
= {
3.42, 3.04, 9.18, 8.97, 8.49, 8.08, 8.01, 8.30, 8.75, 8.22, 7.21, 5.04, 2.98, 2.04, 1.22, 7.58, 7.79, 7.11,
6.93, 7.03, 7.27, 7.23, 6.53, 4.59, 2.40, 1.46, 1.31, 0.42, 5.95, 6.48, 6.29, 5.84, 5.97, 6.31, 6.00, 4.37,
2.37, 1.03, 0.72, 0.81, 0.27, 3.98, 5.57, 5.04, 5.10, 5.21, 5.18, 4.22, 2.23, 1.07, 0.66, 0.40, 0.48, 0.17,
2.51, 4.70, 4.28, 4.29, 4.36, 3.84, 2.40, 1.15, 0.68, 0.40, 0.24, 0.29, 0.11, 0.81, 3.71, 3.47, 3.48, 3.52,
2.58, 1.25, 0.71, 0.41, 0.26, 0.16, 0.16, 0.08, 0.27, 2.88, 2.63, 2.76, 2.33, 1.31, 0.72, 0.44, 0.27, 0.16,
0.11, 0.10, 0.06, 0.15, 2.11, 2.00, 1.84, 1.46, 0.79, 0.45, 0.26, 0.17, 0.10, 0.08, 0.05, 0.04, 0.10, 1.58,
1.49, 1.25, 0.90, 0.48, 0.29, 0.17, 0.10, 0.06, 0.06, 0.02, 0.03, 0.06, 1.26, 1.03, 0.77, 0.57, 0.30, 0.18,
0.11, 0.06, 0.04, 0.05, 0.01, 0.02, 0.04, 0.98, 0.66, 0.47, 0.39, 0.18, 0.11, 0.07, 0.04, 0.03, 0.04, 0.01,
0.02, 0.02, 0.86, 0.44, 0.30, 0.27, 0.11, 0.07, 0.04, 0.03, 0.02, 0.04, 0.01, 0.02, 0.02, 0.80, 0.30, 0.21,
0.17, 0.07, 0.04, 0.03, 0.02, 0.01, 0.04, 0.01, 0.02, 0.01, 0.76, 0.22, 0.17, 0.12, 0.05, 0.03, 0.02, 0.01,
0.01, 0.04, 0.01, 0.02, 0.01, 0.76, 0.17, 0.14, 0.09, 0.03, 0.02, 0.01, 0.01, 0.01, 0.04}

Definition at line 52 of file HFTimingTrustFlag.cc.

Referenced by timerr_hf().

mps_fire.i
i
Definition: mps_fire.py:355
HcalCaloFlagLabels::HFTimingTrustBits
Definition: HcalCaloFlagLabels.h:32
mps_update.status
status
Definition: mps_update.py:69
findQualityFiles.maxI
int maxI
Definition: findQualityFiles.py:182
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
HFTimingTrust::timerr_hf
double timerr_hf(double rectime, double ampl)
Definition: HFTimingTrustFlag.cc:65
createfilelist.int
int
Definition: createfilelist.py:10
HFTimingTrust::hfterrlut
static const float hfterrlut[195]
Definition: HFTimingTrustFlag.cc:52
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46