CMS 3D CMS Logo

L1CaloRegion.cc
Go to the documentation of this file.
1 
2 
4 
5 using std::dec;
6 using std::endl;
7 using std::hex;
8 using std::ostream;
9 
10 // default constructor
11 L1CaloRegion::L1CaloRegion() : m_id(), m_data(0), m_bx(0) {}
12 
13 // constructor for RCT emulator (HB/HE regions)
15  unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn)
16  : m_id(crate, card, rgn),
17  m_data(0), // over-ridden below
18  m_bx(0) {
20 }
21 
22 // constructor for RCT emulator (HF regions)
23 L1CaloRegion::L1CaloRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn)
24  : m_id(crate, 999, rgn),
25  m_data(0), // over-ridden below
26  m_bx(0) {
27  pack((et & 0xff), (et >= 0xff), fineGrain, false, false);
28 }
29 
30 // construct from global eta, phi indices
32  unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi)
33  : m_id(ieta, iphi),
34  m_data(0), // over-ridden below
35  m_bx(0) {
37 }
38 
39 //constructor for unpacking
40 L1CaloRegion::L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx)
41  : m_id(ieta, iphi), m_data(data), m_bx(bx) {}
42 
43 // destructor
45 
46 // named ctors
47 
48 // for HB/HE from RCT indices
50  unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn) {
52  r.setRegionId(L1CaloRegionDetId(crate, card, rgn));
53  r.setBx(0);
54  r.pack(et, overFlow, tauVeto, mip, quiet);
55  return r;
56 }
57 
58 // for HF from RCT indices
59 L1CaloRegion L1CaloRegion::makeHFRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn) {
61  r.setRegionId(L1CaloRegionDetId(crate, 999, rgn));
62  r.setBx(0);
63  r.pack((et & 0xff), (et >= 0xff), fineGrain, false, false);
64  return r;
65 }
66 
67 // HB/HE/HF from GCT indices
69  unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi) {
71  r.setRegionId(L1CaloRegionDetId(ieta, iphi));
72  r.setBx(0);
73  r.pack(et, overFlow, fineGrain, mip, quiet);
74  return r;
75 }
76 
77 //constructor for unpacking
79  uint16_t data, unsigned ieta, unsigned iphi, uint16_t block, uint16_t index, int16_t bx) {
81  r.setRegionId(L1CaloRegionDetId(ieta, iphi));
82  r.setRawData(data);
83  r.setCaptureBlock(block);
84  r.setCaptureIndex(index);
85  r.setBx(bx);
86  return r;
87 }
88 
90  const bool overFlow,
91  const bool fineGrain,
92  const unsigned ieta,
93  const unsigned iphi,
94  const int16_t bx) {
96  r.setRegionId(L1CaloRegionDetId(ieta, iphi));
97  r.setBx(bx);
98  r.pack12BitsEt(et, overFlow, fineGrain, false, false);
99  return r;
100 }
101 
102 // set BX
103 void L1CaloRegion::setBx(int16_t bx) { m_bx = bx; }
104 
105 // set mip bit
106 void L1CaloRegion::setMip(bool mip) {
107  if (mip) {
108  m_data |= 0x1000;
109  } else {
110  m_data &= 0xefff;
111  }
112 }
113 
114 // set quiet bit
115 void L1CaloRegion::setQuiet(bool quiet) {
116  if (quiet) {
117  m_data |= 0x2000;
118  } else {
119  m_data &= 0xdfff;
120  }
121 }
122 
123 void L1CaloRegion::pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet) {
124  bool checkOvF = overFlow || (et >= 0x400);
125  m_data = (et & 0x3ff) | ((checkOvF) ? 0x400 : 0x0) | ((fineGrain) ? 0x800 : 0x0) | ((mip) ? 0x1000 : 0x0) |
126  ((quiet) ? 0x2000 : 0x0);
127 }
128 
129 void L1CaloRegion::pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet) {
130  bool checkOvF = overFlow || (et >= 0x400);
131  m_data = (et & 0xfff) | ((checkOvF) ? 0x400 : 0x0) | ((fineGrain) ? 0x800 : 0x0) | ((mip) ? 0x1000 : 0x0) |
132  ((quiet) ? 0x2000 : 0x0);
133 }
134 
135 // print to stream
136 ostream& operator<<(ostream& os, const L1CaloRegion& reg) {
137  os << "L1CaloRegion:";
138  os << " Et=" << reg.et();
139  os << " o/f=" << reg.overFlow();
140  os << " f/g=" << reg.fineGrain();
141  os << " tau=" << reg.tauVeto() << endl;
142  os << " RCT crate=" << reg.rctCrate();
143  os << " RCT card=" << reg.rctCard();
144  os << " RCT rgn=" << reg.rctRegionIndex();
145  os << " RCT eta=" << reg.rctEta();
146  os << " RCT phi=" << reg.rctPhi() << endl;
147  os << " GCT eta=" << reg.gctEta();
148  os << " GCT phi=" << reg.gctPhi() << endl;
149  os << hex << " cap block=" << reg.capBlock() << dec << ", index=" << reg.capIndex() << ", BX=" << reg.bx();
150  return os;
151 }
L1CaloRegion::fineGrain
bool fineGrain() const
get fine grain bit
Definition: L1CaloRegion.h:102
L1CaloRegion::capIndex
unsigned capIndex() const
what index within capture block
Definition: L1CaloRegion.h:162
L1CaloRegion::setBx
void setBx(int16_t bx)
set bx
Definition: L1CaloRegion.cc:103
L1CaloRegion
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:21
L1CaloRegion::gctEta
unsigned gctEta() const
get GCT eta index
Definition: L1CaloRegion.h:153
L1CaloRegion::bx
int16_t bx() const
get bunch-crossing index
Definition: L1CaloRegion.h:165
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
operator<<
ostream & operator<<(ostream &os, const L1CaloRegion &reg)
Definition: L1CaloRegion.cc:136
L1CaloRegion::makeRegionFromGctIndices
static L1CaloRegion makeRegionFromGctIndices(const unsigned et, const bool overFlow, const bool fineGrain, const bool mip, const bool quiet, const unsigned ieta, const unsigned iphi)
construct region from GCT indices
Definition: L1CaloRegion.cc:68
L1CaloRegion::rctEta
unsigned rctEta() const
get local eta index (within RCT crate)
Definition: L1CaloRegion.h:147
L1CaloRegion::makeHFRegion
static L1CaloRegion makeHFRegion(const unsigned et, const bool fineGrain, const unsigned crate, const unsigned rgn)
construct HF region from components
Definition: L1CaloRegion.cc:59
L1CaloRegion::setQuiet
void setQuiet(bool quiet)
set quiet bit (required for GCT emulator standalone operation)
Definition: L1CaloRegion.cc:115
L1CaloRegion::setMip
void setMip(bool mip)
set MIP bit (required for GCT emulator standalone operation)
Definition: L1CaloRegion.cc:106
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
L1CaloRegion::m_bx
int16_t m_bx
Definition: L1CaloRegion.h:198
L1CaloRegionDetId
Definition: L1CaloRegionDetId.h:18
L1CaloRegion::L1CaloRegion
L1CaloRegion()
default constructor
Definition: L1CaloRegion.cc:11
L1CaloRegion::pack12BitsEt
void pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet)
pack the raw data from arguments (used in constructors)
Definition: L1CaloRegion.cc:129
L1CaloRegion::makeRegionFromUnpacker
static L1CaloRegion makeRegionFromUnpacker(const uint16_t data, const unsigned ieta, const unsigned iphi, const uint16_t block, const uint16_t index, const int16_t bx)
constructor from raw data and GCT indices for unpacking
Definition: L1CaloRegion.cc:78
L1CaloRegion::mip
bool mip() const
get MIP bit
Definition: L1CaloRegion.h:105
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
L1CaloRegion::overFlow
bool overFlow() const
get overflow
Definition: L1CaloRegion.h:96
L1CaloRegion::rctCrate
unsigned rctCrate() const
get RCT crate ID
Definition: L1CaloRegion.h:138
L1CaloRegion::et
unsigned et() const
get Et
Definition: L1CaloRegion.h:90
L1CaloRegion::rctCard
unsigned rctCard() const
get RCT reciever card ID (valid output for HB/HE)
Definition: L1CaloRegion.h:141
L1CaloRegion::~L1CaloRegion
~L1CaloRegion()
destructor
Definition: L1CaloRegion.cc:44
L1CaloRegion::m_data
uint16_t m_data
region data : et, overflow, fine grain/tau veto, mip and quiet bits
Definition: L1CaloRegion.h:195
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
L1CaloRegion::capBlock
unsigned capBlock() const
which capture block did this come from
Definition: L1CaloRegion.h:159
alignCSCRings.r
r
Definition: alignCSCRings.py:93
L1CaloRegion::makeHBHERegion
static L1CaloRegion makeHBHERegion(const unsigned et, const bool overFlow, const bool tauVeto, const bool mip, const bool quiet, const unsigned crate, const unsigned card, const unsigned rgn)
constructor HB/HE region from components
Definition: L1CaloRegion.cc:49
L1CaloRegion::pack
void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet)
pack the raw data from arguments (used in constructors)
Definition: L1CaloRegion.cc:123
L1CaloRegion::tauVeto
bool tauVeto() const
get tau veto bit
Definition: L1CaloRegion.h:99
L1CaloRegion::quiet
bool quiet() const
get quiet bit
Definition: L1CaloRegion.h:108
L1CaloRegion::makeGctJetRegion
static L1CaloRegion makeGctJetRegion(const unsigned et, const bool overFlow, const bool fineGrain, const unsigned ieta, const unsigned iphi, const int16_t bx)
construct region for use in GCT internal jet-finding
Definition: L1CaloRegion.cc:89
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
L1CaloRegion::rctPhi
unsigned rctPhi() const
get local phi index (within RCT crate)
Definition: L1CaloRegion.h:150
L1CaloRegion::rctRegionIndex
unsigned rctRegionIndex() const
get RCT region index
Definition: L1CaloRegion.h:144
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
L1CaloRegion::gctPhi
unsigned gctPhi() const
get GCT phi index
Definition: L1CaloRegion.h:156
L1CaloRegion.h