CMS 3D CMS Logo

MPUnpacker_0x1001000b.cc
Go to the documentation of this file.
3 
5 
6 #include "CaloCollections.h"
8 
9 namespace l1t {
10  namespace stage2 {
11 
13  if ((blkId == BLK_TOT_NEG) || (blkId == BLK_X_NEG) || (blkId == BLK_Y_NEG)) {
14  return -1;
15  }
16  return 1;
17  }
18 
20  LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize()
21  << " AMC = " << block.amc().getAMCNumber();
22 
23  // check this is the correct MP
24  unsigned int amc = block.amc().getAMCNumber();
25  unsigned int bxid = block.amc().getBX();
26  LogDebug("L1T") << "Unpacking AMC " << amc << " for BX " << bxid;
27 
28  auto res1_ = static_cast<CaloCollections*>(coll)->getMPJets();
29  auto res2_ = static_cast<CaloCollections*>(coll)->getMPEtSums();
30  auto res3_ = static_cast<CaloCollections*>(coll)->getMPEGammas();
31  auto res4_ = static_cast<CaloCollections*>(coll)->getMPTaus();
32 
33  res1_->setBXRange(0, 0);
34  res2_->setBXRange(0, 0);
35  res3_->setBXRange(0, 0);
36  res4_->setBXRange(0, 0);
37 
38  // Initialise frame indices for each data type
39  int unsigned fet = 0;
40  int unsigned fht = 2;
41  int unsigned feg = 3;
42  int unsigned ftau = 5;
43  int unsigned fjet = 7;
44 
45  // ===== Jets and Sums =====
46 
47  // ET / MET(x) / MET (y)
48 
49  uint32_t raw_data = block.payload()[fet];
50 
52 
53  switch (block.header().getID()) {
54  case BLK_TOT_POS:
55  et.setType(l1t::EtSum::kTotalEt);
56  et.setHwPt((uint32_t(raw_data & 0xFFFFFF) << 16) >> 16);
57  break;
58  case BLK_X_POS:
59  et.setType(l1t::EtSum::kTotalEtx);
60  et.setHwPt((uint32_t(raw_data)));
61  break;
62  case BLK_Y_POS:
63  et.setType(l1t::EtSum::kTotalEty);
64  et.setHwPt((uint32_t(raw_data)));
65  break;
66  case BLK_TOT_NEG:
67  et.setType(l1t::EtSum::kTotalEt);
68  et.setHwPt((uint32_t(raw_data & 0xFFFFFF) << 16) >> 16);
69  break;
70  case BLK_X_NEG:
71  et.setType(l1t::EtSum::kTotalEtx);
72  et.setHwPt((uint32_t(raw_data)));
73  break;
74  case BLK_Y_NEG:
75  et.setType(l1t::EtSum::kTotalEty);
76  et.setHwPt((uint32_t(raw_data)));
77  break;
78  default:
79  break;
80  }
81 
82  LogDebug("L1T") << "ET/METx/METy: pT " << et.hwPt();
83 
84  res2_->push_back(0, et);
85 
86  // HT / MHT(x)/ MHT (y)
87 
88  raw_data = block.payload()[fht];
89 
90  l1t::EtSum ht = l1t::EtSum();
91 
92  //ht.setHwPt(raw_data & 0xFFFFF);
93  ht.setHwPt((uint32_t(raw_data & 0xFFFFFF) << 16) >> 16);
94  switch (block.header().getID()) {
95  case BLK_TOT_POS:
97  break;
98  case BLK_X_POS:
100  break;
101  case BLK_Y_POS:
103  break;
104  case BLK_TOT_NEG:
106  break;
107  case BLK_X_NEG:
109  break;
110  case BLK_Y_NEG:
112  break;
113  default:
114  break;
115  }
116 
117  LogDebug("L1T") << "HT/MHTx/MHTy: pT " << ht.hwPt();
118 
119  res2_->push_back(0, ht);
120 
121  // Two jets
122  for (unsigned nJet = 0; nJet < 2; nJet++) {
123  raw_data = block.payload()[fjet + nJet];
124 
125  if (raw_data == 0)
126  continue;
127 
128  l1t::Jet jet = l1t::Jet();
129 
130  int etasign = etaSign(block.header().getID());
131 
132  LogDebug("L1") << "block ID=" << block.header().getID() << " etasign=" << etasign;
133 
134  int mpEta = etasign * (raw_data & 0x3F);
135  jet.setHwEta(CaloTools::caloEta(mpEta));
136  jet.setHwPhi((raw_data >> 6) & 0x7F);
137  jet.setHwPt((raw_data >> 13) & 0xFFFF);
138  jet.setHwQual((raw_data >> 29) & 0x1);
139 
140  LogDebug("L1T") << "Jet: eta " << jet.hwEta() << " phi " << jet.hwPhi() << " pT " << jet.hwPt() << " qual "
141  << jet.hwQual();
142 
143  jet.setP4(l1t::CaloTools::p4MP(&jet));
144  res1_->push_back(0, jet);
145  }
146 
147  // ===== EGammas =====
148 
149  // Two EGammas
150 
151  for (unsigned nEG = 0; nEG < 2; nEG++) {
152  raw_data = block.payload()[feg + nEG];
153 
154  if (raw_data == 0)
155  continue;
156 
157  l1t::EGamma eg = l1t::EGamma();
158 
159  int etasign = etaSign(block.header().getID());
160 
161  LogDebug("L1") << "block ID=" << block.header().getID() << " etasign=" << etasign;
162 
163  eg.setHwEta(etasign * ((raw_data >> 3) & 0x3F));
164  eg.setHwPhi((raw_data >> 9) & 0x7F);
165  eg.setHwPt((raw_data >> 20) & 0xFFF);
166  eg.setHwIso((raw_data >> 1) & 0x3);
167  eg.setHwQual((raw_data >> 16) & 0xf);
168 
169  LogDebug("L1T") << "Egamma: eta " << eg.hwEta() << " phi " << eg.hwPhi() << " pT " << eg.hwPt() << " qual "
170  << eg.hwQual();
171 
172  eg.setP4(l1t::CaloTools::p4MP(&eg));
173  res3_->push_back(0, eg);
174  }
175 
176  // ===== Taus =====
177 
178  // Two taus
179 
180  for (unsigned nTau = 0; nTau < 2; nTau++) {
181  raw_data = block.payload()[ftau + nTau];
182 
183  if (raw_data == 0)
184  continue;
185 
186  l1t::Tau tau = l1t::Tau();
187 
188  int etasign = etaSign(block.header().getID());
189 
190  LogDebug("L1") << "block ID=" << block.header().getID() << " etasign=" << etasign;
191 
192  tau.setHwEta(etasign * ((raw_data >> 3) & 0x3F));
193  tau.setHwPhi((raw_data >> 9) & 0x7F);
194  tau.setHwPt((raw_data >> 20) & 0xFFF);
195  tau.setHwIso((raw_data >> 1) & 0x3);
196  tau.setHwQual((raw_data >> 16) & 0xf);
197 
198  LogDebug("L1T") << "Tau: eta " << tau.hwEta() << " phi " << tau.hwPhi() << " pT " << tau.hwPt() << " qual "
199  << tau.hwQual();
200 
201  tau.setP4(l1t::CaloTools::p4MP(&tau));
202  res4_->push_back(0, tau);
203  }
204 
205  return true;
206  }
207  } // namespace stage2
208 } // namespace l1t
209 
l1t::EtSum::kTotalHty
Definition: EtSum.h:30
l1t::CaloTools::caloEta
static int caloEta(int ietaMP)
Definition: CaloTools.cc:234
l1t::EtSum::setType
void setType(EtSumType type)
Definition: EtSum.cc:11
l1t::EtSum::kTotalEtx
Definition: EtSum.h:27
CaloTools.h
l1t::L1Candidate::hwPhi
int hwPhi() const
Definition: L1Candidate.h:37
MessageLogger.h
l1t::stage2::MPUnpacker_0x1001000b
Definition: MPUnpacker_0x1001000b.h:8
metsig::tau
Definition: SignAlgoResolutions.h:49
L1TRate_Offline_cfi.Tau
Tau
Definition: L1TRate_Offline_cfi.py:43
l1t::stage2::MPUnpacker_0x1001000b::BLK_TOT_POS
Definition: MPUnpacker_0x1001000b.h:10
l1t::L1Candidate::hwQual
int hwQual() const
Definition: L1Candidate.h:38
l1t::EtSum::kTotalEty
Definition: EtSum.h:28
l1t::stage2::MPUnpacker_0x1001000b::etaSign
int etaSign(int blkId)
Definition: MPUnpacker_0x1001000b.cc:12
l1t::stage2::MPUnpacker_0x1001000b::BLK_Y_NEG
Definition: MPUnpacker_0x1001000b.h:10
l1t::stage2::MPUnpacker_0x1001000b::unpack
bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: MPUnpacker_0x1001000b.cc:19
l1t::EtSum::kTotalHt
Definition: EtSum.h:24
l1t::Tau
Definition: Tau.h:20
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
l1t::L1Candidate::hwEta
int hwEta() const
Definition: L1Candidate.h:36
l1t::stage2::MPUnpacker_0x1001000b::BLK_X_NEG
Definition: MPUnpacker_0x1001000b.h:10
l1t::L1Candidate::setHwQual
void setHwQual(int qual)
Definition: L1Candidate.h:31
L1TRate_cfi.Jet
Jet
Definition: L1TRate_cfi.py:43
UnpackerFactory.h
l1t::Jet
Definition: Jet.h:20
l1t::stage2::MPUnpacker_0x1001000b::BLK_Y_POS
Definition: MPUnpacker_0x1001000b.h:10
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
l1t
delete x;
Definition: CaloConfig.h:22
l1t::EtSum
Definition: EtSum.h:20
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
l1t::EGamma
Definition: EGamma.h:20
l1t::L1Candidate::setHwPt
void setHwPt(int pt)
Definition: L1Candidate.h:28
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
l1t::L1Candidate::setHwEta
void setHwEta(int eta)
Definition: L1Candidate.h:29
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
l1t::stage2::MPUnpacker_0x1001000b::BLK_TOT_NEG
Definition: MPUnpacker_0x1001000b.h:10
metsig::jet
Definition: SignAlgoResolutions.h:47
l1t::stage2::MPUnpacker_0x1001000b::BLK_X_POS
Definition: MPUnpacker_0x1001000b.h:10
l1t::UnpackerCollections
Definition: UnpackerCollections.h:9
HLT_FULL_cff.EGamma
EGamma
Definition: HLT_FULL_cff.py:3928
l1t::L1Candidate::setHwIso
void setHwIso(int iso)
Definition: L1Candidate.h:32
l1t::L1Candidate::hwPt
int hwPt() const
Definition: L1Candidate.h:35
amc
Definition: AMCSpec.h:8
l1t::EtSum::kTotalHtx
Definition: EtSum.h:29
DEFINE_L1T_UNPACKER
#define DEFINE_L1T_UNPACKER(type)
Definition: UnpackerFactory.h:23
l1t::L1Candidate::setHwPhi
void setHwPhi(int phi)
Definition: L1Candidate.h:30
CaloCollections.h
l1t::Block
Definition: Block.h:70
l1t::EtSum::kTotalEt
Definition: EtSum.h:23
l1t::CaloTools::p4MP
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:369
MPUnpacker_0x1001000b.h