CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HcalFinegrainBit Class Reference

#include <HcalFinegrainBit.h>

Public Types

typedef std::array< std::bitset< 6 >, 2 > Tower
 
typedef std::array< std::pair< std::pair< int, bool >, std::pair< int, int > >, 7 > TowerTDC
 

Public Member Functions

std::bitset< 2 > compute (const Tower &) const
 
std::bitset< 6 > compute (const TowerTDC &, const HcalTrigTowerDetId &) const
 
 HcalFinegrainBit (int version)
 

Private Attributes

const int is_above_mip = 1
 
const int is_mip = 0
 
const int tdc_boundary [29][7]
 
int version_
 

Detailed Description

Definition at line 8 of file HcalFinegrainBit.h.

Member Typedef Documentation

◆ Tower

typedef std::array<std::bitset<6>, 2> HcalFinegrainBit::Tower

Definition at line 12 of file HcalFinegrainBit.h.

◆ TowerTDC

typedef std::array<std::pair<std::pair<int, bool>, std::pair<int, int> >, 7> HcalFinegrainBit::TowerTDC

Definition at line 14 of file HcalFinegrainBit.h.

Constructor & Destructor Documentation

◆ HcalFinegrainBit()

HcalFinegrainBit::HcalFinegrainBit ( int  version)
inline

Definition at line 16 of file HcalFinegrainBit.h.

Member Function Documentation

◆ compute() [1/2]

std::bitset< 2 > HcalFinegrainBit::compute ( const Tower tower) const

Definition at line 5 of file HcalFinegrainBit.cc.

References is_above_mip, is_mip, mps_fire::result, l1tHGCalTowerProducer_cfi::tower, and version_.

Referenced by HcalTriggerPrimitiveAlgo::analyzeQIE11().

5  {
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 }
const int is_above_mip

◆ compute() [2/2]

std::bitset< 6 > HcalFinegrainBit::compute ( const TowerTDC tower,
const HcalTrigTowerDetId id 
) const

Definition at line 44 of file HcalFinegrainBit.cc.

References funct::abs(), mps_fire::i, gmt_cfi::Nprompt, mps_fire::result, tdc_boundary, and l1tHGCalTowerProducer_cfi::tower.

44  {
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  int EarlyEnergy = 0;
53  int DeepEnergy = 0;
54 
55  for (size_t i = 0; i < 7; i++) {
56  int bit12_15set = tower[i].first.first;
57  bool is_compressed = tower[i].first.second;
58  int bit12 = (bit12_15set & 0b0001); // low depth 1,2 energy
59  int bit13 = (bit12_15set & 0b0010) >> 1; // high depth 3+ energy
60  int bit14 = (bit12_15set & 0b0100) >> 2; // prompt energy passed
61  int bit15 = (bit12_15set & 0b1000) >> 3; // delayed energy passed
62  int TDC = tower[i].second.first;
63  int ADC = tower[i].second.second;
64 
65  // timing bits
66  if (TDC < 50) { // exclude error code for TDC in HE (unpacked)
67  if ((abs(tp_ieta) <= 16) || (i >= 1)) {
68  // count delayed / prompt hits either in HB, or in HE (excluding depth 1 due to backgrounds in HE)
69  // Sim packing into Raw, has uncompressed TDC values (0-49) at the trigger primitive level. Packing (compressing HB TDC 6:2) happens in packer.
70  // Hcal digis have compressed HB TDC (0-3)
71  if (is_compressed == 1) {
72  if (TDC == 1 && bit15 == 1)
73  Ndelayed += 1;
74  if (TDC == 2 && bit15 == 1)
75  NveryDelayed += 1;
76  if (TDC == 0 && bit14 == 1)
77  Nprompt += 1;
78  } else {
79  if (TDC > tdc_boundary[abs(tp_ieta) - 1][i] && TDC <= tdc_boundary[abs(tp_ieta) - 1][i] + 2 && bit15 == 1)
80  Ndelayed += 1;
81  if (TDC > tdc_boundary[abs(tp_ieta) - 1][i] + 2 && bit15 == 1)
82  NveryDelayed += 1;
83  if (TDC <= tdc_boundary[abs(tp_ieta) - 1][i] && TDC >= 0 && bit14 == 1)
84  Nprompt += 1;
85  }
86  }
87  }
88 
89  // depth bit
90  if (ADC > 0 && bit12 == 0)
91  EarlyEnergy +=
92  1; // early layers, depth 1 and 2. If bit12 = 0, too much energy in early layers. Require ADC > 0 to ensure valid hit in cell
93  if (ADC > 0 && bit13 == 1)
94  DeepEnergy +=
95  1; // deep layers, 3+. If bit13 = 1, energy in deep layers. Require ADC > 0 to ensure valid hit in cell
96  }
97 
98  // very delayed (001000), slightly delayed (000100), prompt (000010), depth flag (000001), 2 reserved bits (110000)
99  if (DeepEnergy > 0 && EarlyEnergy == 0)
100  result[0] = true; // 000001
101  else
102  result[0] = false;
103  if (Nprompt > 0)
104  result[1] = true; // 000010
105  else
106  result[1] = false;
107  if (Ndelayed > 0)
108  result[2] = true; // 000100
109  else
110  result[2] = false;
111  if (NveryDelayed > 0)
112  result[3] = true; // 001000
113  else
114  result[3] = false;
115  result[4] = result[5] = false; // 110000 in HcalTriggerPrimitiveAlgo.cc, set to MIP bits from above
116 
117  return result;
118 }
Nprompt
Definition: gmt_cfi.py:81
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const int tdc_boundary[29][7]

Member Data Documentation

◆ is_above_mip

const int HcalFinegrainBit::is_above_mip = 1
private

Definition at line 24 of file HcalFinegrainBit.h.

Referenced by compute().

◆ is_mip

const int HcalFinegrainBit::is_mip = 0
private

Definition at line 23 of file HcalFinegrainBit.h.

Referenced by compute().

◆ tdc_boundary

const int HcalFinegrainBit::tdc_boundary[29][7]
private
Initial value:
= {
{8, 14, 15, 17, 0, 0, 0}, {8, 14, 15, 17, 0, 0, 0}, {8, 14, 14, 17, 0, 0, 0}, {8, 14, 14, 17, 0, 0, 0},
{8, 13, 14, 16, 0, 0, 0}, {8, 13, 14, 16, 0, 0, 0}, {8, 12, 14, 15, 0, 0, 0}, {8, 12, 14, 15, 0, 0, 0},
{7, 12, 13, 15, 0, 0, 0}, {7, 12, 13, 15, 0, 0, 0}, {7, 12, 13, 15, 0, 0, 0}, {7, 12, 13, 15, 0, 0, 0},
{7, 11, 12, 14, 0, 0, 0}, {7, 11, 12, 14, 0, 0, 0}, {7, 11, 12, 14, 0, 0, 0}, {7, 11, 12, 7, 0, 0, 0},
{0, 12, 10, 0, 0, 0, 0}, {0, 9, 10, 9, 10, 0, 0}, {16, 9, 9, 9, 11, 10, 0}, {17, 8, 9, 8, 9, 10, 0},
{9, 7, 7, 7, 9, 6, 0}, {8, 7, 7, 6, 6, 6, 0}, {8, 6, 6, 6, 7, 7, 0}, {7, 6, 6, 6, 7, 6, 0},
{7, 6, 6, 6, 6, 6, 0}, {6, 6, 6, 6, 6, 6, 0}, {6, 5, 6, 6, 6, 7, 10}, {9, 9, 9, 5, 5, 6, 6},
{0, 0, 0, 0, 0, 0, 0}}

Definition at line 29 of file HcalFinegrainBit.h.

Referenced by compute().

◆ version_

int HcalFinegrainBit::version_
private

Definition at line 26 of file HcalFinegrainBit.h.

Referenced by compute().