CMS 3D CMS Logo

L1GctEmCand.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
5 using std::dec;
6 using std::hex;
7 using std::ostream;
8 using std::string;
9 
10 // default constructor
11 L1GctEmCand::L1GctEmCand() : m_data(0), m_iso(false), m_captureBlock(0), m_captureIndex(0), m_bx(0) {}
12 
13 // construct from raw data, no source (i.e. no capBlock/capIndex); used in GT
14 L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso)
15  : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored
16  m_iso(iso),
17  m_captureBlock(0),
18  m_captureIndex(0),
19  m_bx(0) {}
20 
21 // construct from raw data with source - used in GCT unpacker
22 L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso, uint16_t block, uint16_t index, int16_t bx)
23  : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored
24  m_iso(iso),
25  m_captureBlock(block & 0xfff),
26  m_captureIndex(index & 0xff),
27  m_bx(bx) {}
28 
29 // construct from content - used in GCT emulator
30 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
31 L1GctEmCand::L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso)
32  : m_data(0), // override below
33  m_iso(iso),
34  m_captureBlock(0),
35  m_captureIndex(0),
36  m_bx(0)
37 
38 {
39  construct(rank, eta, phi);
40 }
41 
42 // construct from content, with source (i.e. capBlock/capIndex); will be used in GCT emulator one day?
43 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
44 L1GctEmCand::L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso, uint16_t block, uint16_t index, int16_t bx)
45  : m_data(0), // override below
46  m_iso(iso),
47  m_captureBlock(block & 0xfff),
48  m_captureIndex(index & 0xff),
49  m_bx(bx) {
50  construct(rank, eta, phi);
51 }
52 
53 // construct from RCT output candidate
55  : m_data(0), // override below
56  m_iso(c.isolated()),
57  m_captureBlock(0),
58  m_captureIndex(0),
59  m_bx(c.bx()) {
60  unsigned eta = ((c.regionId().rctEta() & 0x7) | (c.regionId().ieta() < 11 ? 0x8 : 0x0));
61  construct(c.rank(), eta, c.regionId().iphi());
62 }
63 
64 // destructor
66 
67 // name of candidate type
68 string L1GctEmCand::name() const { return (isolated() ? "iso EM" : "non iso EM"); }
69 
70 // return region object
72  // get global eta
73  unsigned eta = (etaSign() == 1 ? 10 - (etaIndex() & 0x7) : 11 + (etaIndex() & 0x7));
74  return L1CaloRegionDetId(eta, phiIndex());
75 }
76 
77 // construct from rank, eta, phi
78 void L1GctEmCand::construct(unsigned rank, unsigned eta, unsigned phi) {
79  if (rank > 0) {
80  m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10);
81  } else {
82  // Default values for zero rank electrons,
83  // different in hardware for positive and negative eta
84  if ((eta & 0x8) == 0) {
85  m_data = 0x7000;
86  } else {
87  m_data = 0x7400;
88  }
89  }
90 }
91 
92 // pretty print
93 ostream& operator<<(ostream& s, const L1GctEmCand& cand) {
94  s << "L1GctEmCand : ";
95  s << "rank=" << cand.rank();
96  s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0x7) << ", phi=" << cand.phiIndex();
97  s << ", iso=" << cand.isolated();
98  s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx();
99  return s;
100 }
GlobalTrackerMuonAlignment_cfi.isolated
isolated
Definition: GlobalTrackerMuonAlignment_cfi.py:4
funct::false
false
Definition: Factorize.h:34
L1GctEmCand::~L1GctEmCand
~L1GctEmCand() override
destructor (virtual to prevent compiler warnings)
Definition: L1GctEmCand.cc:65
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:162
operator<<
ostream & operator<<(ostream &s, const L1GctEmCand &cand)
Definition: L1GctEmCand.cc:93
L1GctEmCand
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
L1GctEmCand::construct
void construct(unsigned rank, unsigned eta, unsigned phi)
Definition: L1GctEmCand.cc:78
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1GctEmCand::m_data
uint16_t m_data
Definition: L1GctEmCand.h:95
L1CaloRegionDetId
Definition: L1CaloRegionDetId.h:18
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1GctEmCand::name
std::string name() const
name of object
Definition: L1GctEmCand.cc:68
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GctEmCand::regionId
L1CaloRegionDetId regionId() const override
region associated with the candidate
Definition: L1GctEmCand.cc:71
PVValHelper::phi
Definition: PVValidationHelpers.h:68
cand
Definition: decayParser.h:34
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1GctEmCand::etaSign
unsigned etaSign() const override
get eta sign (1 for -ve Z, 0 for +ve Z)
Definition: L1GctEmCand.h:65
DDAxes::phi
L1GctEmCand.h
L1GctEmCand::isolated
bool isolated() const
which stream did this come from
Definition: L1GctEmCand.h:71
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
L1GctEmCand::etaIndex
unsigned etaIndex() const override
get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
Definition: L1GctEmCand.h:62
L1GctEmCand::L1GctEmCand
L1GctEmCand()
default constructor (for vector initialisation etc.)
Definition: L1GctEmCand.cc:11
L1GctEmCand::rank
unsigned rank() const override
get rank bits
Definition: L1GctEmCand.h:59
L1CaloEmCand
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
L1GctEmCand::phiIndex
unsigned phiIndex() const override
get phi index (0-17)
Definition: L1GctEmCand.h:68