CMS 3D CMS Logo

HcalFinegrainBit.cc
Go to the documentation of this file.
2 
3 #include <cassert>
4 
6  if (version_ == 0) {
7  std::bitset<2> result;
8 
9  // First layer consistent with a MIP
10  result[0] = tower[is_mip][0];
11 
12  // First layer consistent with a MIP, at least one layer with more
13  // than MIP energy deposition
14  result[1] = result[0] & (tower[is_above_mip].count() > 0);
15 
16  // There layers consistent with a MIP
17  // result[2] = tower[is_mip].count() >= 3;
18 
19  // Unset
20  // result[3] = false;
21 
22  return result;
23  }
24  if (version_ == 1) {
25  std::bitset<2> result;
26 
27  // All algorithms the same for testing purposes
28  result[0] = result[1] = tower[is_mip][0];
29 
30  return result;
31  }
32  if (version_ == 2) {
33  std::bitset<2> result;
34 
35  // All algorithms the same for testing purposes
36  result[0] = result[1] = true;
37 
38  return result;
39  }
40  return 0;
41 }
42 
43 // timing/depth LLP bit setting
45  std::bitset<6> result;
46 
47  int tp_ieta = id.ieta();
48 
49  int Ndelayed = 0;
50  int NveryDelayed = 0;
51  int Nprompt = 0;
52  const int MinE = 64;
53 
54  int DeepEnergy = 0;
55  int EarlyEnergy = 0;
56  const int deepLayerMinE = 80;
57  const int earlyLayerMaxE = 16;
58 
59  for (size_t i = 0; i < 7; i++) {
60  int ADC = tower[i].first;
61  int TDC = tower[i].second;
62 
63  // timing bits
64  if (TDC < 50) { // exclude error code for TDC in HE (unpacked)
65  if (abs(tp_ieta) <=
66  16) { // in HB, TDC values are compressed. 01 = first delayed range, 10 = second delayed range
67  if (TDC == 1 && ADC >= MinE)
68  Ndelayed += 1;
69  if (TDC == 2 && ADC >= MinE)
70  NveryDelayed += 1;
71  if (TDC == 0 && ADC >= MinE)
72  Nprompt += 1;
73  }
74  if (abs(tp_ieta) > 16 &&
75  i >= 1) { // in HE, TDC values are uncompressed (0-49). Exclude depth 1 in HE due to backgrounds
76  if (TDC > tdc_HE[abs(tp_ieta) - 1][i] && TDC <= tdc_HE[abs(tp_ieta) - 1][i] + 2 && ADC >= MinE)
77  Ndelayed += 1;
78  if (TDC > tdc_HE[abs(tp_ieta) - 1][i] + 2 && ADC >= MinE)
79  NveryDelayed += 1;
80  if (TDC <= tdc_HE[abs(tp_ieta) - 1][i] && TDC >= 0 && ADC >= MinE)
81  Nprompt += 1;
82  }
83  }
84 
85  // depth bit
86  if (i <= 1 && ADC >= earlyLayerMaxE)
87  EarlyEnergy += 1; // early layers, depth 1 and 2
88  if (i >= 2 && ADC >= deepLayerMinE)
89  DeepEnergy += 1; // deep layers, 3+
90  }
91 
92  // very delayed (100000), slightly delayed (010000), prompt (001000), 2 reserved bits (000110), depth flag (000001)
93  if (DeepEnergy > 0 && EarlyEnergy == 0)
94  result[0] = true; // 000001
95  else
96  result[0] = false;
97  if (Nprompt > 0)
98  result[3] = true; // 001000
99  else
100  result[3] = false;
101  if (Ndelayed > 0)
102  result[4] = true; // 010000
103  else
104  result[4] = false;
105  if (NveryDelayed > 0)
106  result[5] = true; // 100000
107  else
108  result[5] = false;
109  result[1] = result[2] = false; // 000110 in HcalTriggerPrimitiveAlgo.cc, set to MIP bits from above
110 
111  return result;
112 }
HcalFinegrainBit::version_
int version_
Definition: HcalFinegrainBit.h:26
mps_fire.i
i
Definition: mps_fire.py:428
HcalFinegrainBit::tdc_HE
const int tdc_HE[29][7]
Definition: HcalFinegrainBit.h:29
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
HcalFinegrainBit::compute
std::bitset< 2 > compute(const Tower &) const
Definition: HcalFinegrainBit.cc:5
HcalFinegrainBit.h
ADC
Definition: ZdcTBAnalysis.h:46
TDC
Definition: ZdcTBAnalysis.h:25
HcalFinegrainBit::is_mip
const int is_mip
Definition: HcalFinegrainBit.h:23
HcalFinegrainBit::TowerTDC
std::array< std::pair< int, int >, 7 > TowerTDC
Definition: HcalFinegrainBit.h:14
HcalFinegrainBit::Tower
std::array< std::bitset< 6 >, 2 > Tower
Definition: HcalFinegrainBit.h:12
HLT_FULL_cff.MinE
MinE
Definition: HLT_FULL_cff.py:8766
HcalFinegrainBit::is_above_mip
const int is_above_mip
Definition: HcalFinegrainBit.h:24
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalTrigTowerDetId
Definition: HcalTrigTowerDetId.h:14