CMS 3D CMS Logo

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

#include <L1TrackerEtMissEmulatorProducer.cc>

Inheritance diagram for L1TrackerEtMissEmulatorProducer:
edm::stream::EDProducer<>

Public Types

typedef std::vector< L1TTTrackTypeL1TTTrackCollectionType
 
typedef TTTrack< Ref_Phase2TrackerDigi_L1TTTrackType
 
typedef l1t::VertexWordCollection L1VertexCollectionType
 
typedef l1t::VertexWord L1VertexType
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 L1TrackerEtMissEmulatorProducer (const edm::ParameterSet &)
 
 ~L1TrackerEtMissEmulatorProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

TTTrack_TrackWord::bendChi2_t bendChi2Max_
 
TTTrack_TrackWord::chi2rphi_t chi2rphiMax_
 
TTTrack_TrackWord::chi2rz_t chi2rzMax_
 
bool cordicDebug_ = false
 
int cordicSteps_
 
std::vector< l1tmetemu::global_phi_tcosLUT_
 
int debug_
 
l1tmetemu::z_t deltaZ0_ = 0
 
std::vector< l1tmetemu::z_tDeltaZLUT_
 
vector< double > etaRegions_
 
std::vector< l1tmetemu::eta_tEtaRegionsLUT_
 
bool GTTinput_ = false
 
std::string L1MetCollectionName_
 
l1tmetemu::eta_t maxEta_
 
l1tmetemu::z_t maxZ0_
 
l1tmetemu::pt_t minPt_
 
l1tmetemu::z_t minZ0_
 
l1tmetemu::nstub_t nStubsmin_
 
std::vector< l1tmetemu::global_phi_tphiQuadrants_
 
std::vector< l1tmetemu::global_phi_tphiShifts_
 
const edm::EDGetTokenT< L1VertexCollectionTypepvToken_
 
const edm::EDGetTokenT< L1TTTrackCollectionTypetrackToken_
 
L1TkEtMissEmuTrackTransform TrackTransform
 
vector< double > z0Thresholds_
 

Detailed Description

L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc

Description: Takes L1TTTracks and performs a integer emulation of Track-based missing Et, outputting a collection of EtSum

Definition at line 41 of file L1TrackerEtMissEmulatorProducer.cc.

Member Typedef Documentation

◆ L1TTTrackCollectionType

Definition at line 44 of file L1TrackerEtMissEmulatorProducer.cc.

◆ L1TTTrackType

Definition at line 43 of file L1TrackerEtMissEmulatorProducer.cc.

◆ L1VertexCollectionType

Definition at line 45 of file L1TrackerEtMissEmulatorProducer.cc.

◆ L1VertexType

Definition at line 46 of file L1TrackerEtMissEmulatorProducer.cc.

Constructor & Destructor Documentation

◆ L1TrackerEtMissEmulatorProducer()

L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 95 of file L1TrackerEtMissEmulatorProducer.cc.

References TTTrack_TrackWord::bendChi2Bins, bendChi2Max_, electrons_cff::bool, TTTrack_TrackWord::chi2RPhiBins, chi2rphiMax_, TTTrack_TrackWord::chi2RZBins, chi2rzMax_, cordicDebug_, cordicSteps_, cosLUT_, debug_, DeltaZLUT_, etaRegions_, EtaRegionsLUT_, l1tmetemu::generateCosLUT(), l1tmetemu::generateDeltaZLUT(), l1tmetemu::generateEtaRegionLUT(), L1TkEtMissEmuTrackTransform::generateLUTs(), l1tmetemu::getBin(), edm::ParameterSet::getParameter(), L1TkEtMissEmuTrackTransform::getPhiQuad(), L1TkEtMissEmuTrackTransform::getPhiShift(), GTTinput_, createfilelist::int, l1tmetemu::kInternalEtaWidth, l1tmetemu::kInternalPtWidth, l1tmetemu::kInternalVTXWidth, l1tmetemu::kMaxCosLUTPhi, l1tmetemu::kStepEta, l1tmetemu::kStepPhi, l1tmetemu::kStepPt, l1tmetemu::kStepZ0, L1MetCollectionName_, maxEta_, maxZ0_, minPt_, minZ0_, nStubsmin_, phiQuadrants_, phiShifts_, L1TkEtMissEmuTrackTransform::setGTTinput(), AlCaHLTBitMon_QueryRunRegistry::string, TrackTransform, and z0Thresholds_.

96  : pvToken_(consumes<L1VertexCollectionType>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))),
97  trackToken_(consumes<L1TTTrackCollectionType>(iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) {
98  // Setup LUTs
102 
103  // Get Emulator config parameters
104  cordicSteps_ = (int)iConfig.getParameter<int>("nCordicSteps");
105  debug_ = (int)iConfig.getParameter<int>("debug");
106 
107  GTTinput_ = (bool)iConfig.getParameter<bool>("useGTTinput");
108 
110 
111  // Name of output ED Product
112  L1MetCollectionName_ = (std::string)iConfig.getParameter<std::string>("L1MetCollectionName");
113 
114  // Input parameter cuts and convert to correct integer representations
115  maxZ0_ = l1tmetemu::digitizeSignedValue<l1tmetemu::z_t>(
116  (double)iConfig.getParameter<double>("maxZ0"), l1tmetemu::kInternalVTXWidth, l1tmetemu::kStepZ0);
117  minZ0_ = (1 << TTTrack_TrackWord::TrackBitWidths::kZ0Size) - maxZ0_;
118 
119  maxEta_ = l1tmetemu::digitizeSignedValue<l1tmetemu::eta_t>(
120  (double)iConfig.getParameter<double>("maxEta"), l1tmetemu::kInternalEtaWidth, l1tmetemu::kStepEta);
121 
122  chi2rphiMax_ =
123  l1tmetemu::getBin((double)iConfig.getParameter<double>("chi2rphidofMax"), TTTrack_TrackWord::chi2RPhiBins);
124  chi2rzMax_ = l1tmetemu::getBin((double)iConfig.getParameter<double>("chi2rzdofMax"), TTTrack_TrackWord::chi2RZBins);
125  bendChi2Max_ =
126  l1tmetemu::getBin((double)iConfig.getParameter<double>("bendChi2Max"), TTTrack_TrackWord::bendChi2Bins);
127 
128  minPt_ = l1tmetemu::digitizeSignedValue<l1tmetemu::pt_t>(
129  (double)iConfig.getParameter<double>("minPt"), l1tmetemu::kInternalPtWidth, l1tmetemu::kStepPt);
130 
131  nStubsmin_ = (l1tmetemu::nstub_t)iConfig.getParameter<int>("nStubsmin");
132 
133  z0Thresholds_ = iConfig.getParameter<std::vector<double>>("z0Thresholds");
134  etaRegions_ = iConfig.getParameter<std::vector<double>>("etaRegions");
135 
136  if (debug_ == 5) {
137  cordicDebug_ = true;
138  }
139 
140  // To have same bin spacing between 0 and pi/2 as between original phi
141  // granularity
142  int cosLUTbins = floor(l1tmetemu::kMaxCosLUTPhi / l1tmetemu::kStepPhi);
143 
144  // Compute LUTs
145  cosLUT_ = l1tmetemu::generateCosLUT(cosLUTbins);
148 
149  produces<std::vector<EtSum>>(L1MetCollectionName_);
150 }
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RPhiSize > chi2RPhiBins
std::vector< eta_t > generateEtaRegionLUT(std::vector< double > EtaRegions)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< l1tmetemu::global_phi_t > phiQuadrants_
std::vector< l1tmetemu::global_phi_t > getPhiShift() const
const double kStepEta
std::vector< z_t > generateDeltaZLUT(std::vector< double > DeltaZBins)
std::vector< l1tmetemu::eta_t > EtaRegionsLUT_
const double kStepPt
static constexpr std::array< double, 1<< TrackBitWidths::kBendChi2Size > bendChi2Bins
const edm::EDGetTokenT< L1VertexCollectionType > pvToken_
const unsigned int kInternalVTXWidth
const edm::EDGetTokenT< L1TTTrackCollectionType > trackToken_
const double kStepZ0
std::vector< l1tmetemu::global_phi_t > getPhiQuad() const
const unsigned int kInternalPtWidth
std::vector< l1tmetemu::global_phi_t > phiShifts_
unsigned int getBin(double value, const T &bins)
std::vector< global_phi_t > generateCosLUT(unsigned int size)
const float kMaxCosLUTPhi
std::vector< l1tmetemu::global_phi_t > cosLUT_
const unsigned int kInternalEtaWidth
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RZSize > chi2RZBins
ap_uint< 3 > nstub_t
const double kStepPhi

◆ ~L1TrackerEtMissEmulatorProducer()

L1TrackerEtMissEmulatorProducer::~L1TrackerEtMissEmulatorProducer ( )
override

Definition at line 152 of file L1TrackerEtMissEmulatorProducer.cc.

152 {}

Member Function Documentation

◆ beginJob()

void L1TrackerEtMissEmulatorProducer::beginJob ( void  )
privatevirtual

Definition at line 427 of file L1TrackerEtMissEmulatorProducer.cc.

427 {}

◆ endJob()

void L1TrackerEtMissEmulatorProducer::endJob ( void  )
privatevirtual

Definition at line 429 of file L1TrackerEtMissEmulatorProducer.cc.

429 {}

◆ fillDescriptions()

void L1TrackerEtMissEmulatorProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 432 of file L1TrackerEtMissEmulatorProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

432  {
433  //The following says we do not know what parameters are allowed so do no validation
434  // Please change this to state exactly what you do use, even if it is no parameters
436  desc.setUnknown();
437  descriptions.addDefault(desc);
438 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void L1TrackerEtMissEmulatorProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 154 of file L1TrackerEtMissEmulatorProducer.cc.

References funct::abs(), InternalEtWord::bendChi2, bendChi2Max_, InternalEtWord::chi2rphidof, chi2rphiMax_, InternalEtWord::chi2rzdof, chi2rzMax_, cordicDebug_, l1tmhtemu::cordicSqrt(), cordicSteps_, funct::cos(), cosLUT_, debug_, deltaZ0_, DeltaZLUT_, l1tmetemu::EtMiss::Et, InternalEtWord::eta, EtaRegionsLUT_, InternalEtWord::EtaSector, dqmMemoryStats::float, InternalEtWord::globalPhi, mps_fire::i, iEvent, edm::HandleBase::isValid(), l1tmetemu::kGlobalPhiBins, l1tmetemu::kInternalVTXWidth, l1tmetemu::kMETPhiBins, l1tmetemu::kMETSize, L1Analysis::kMissingEt, l1tmetemu::kNEtaRegion, l1tmetemu::kNSector, l1tmetemu::kStepMET, l1tmetemu::kStepMETPhi, l1tmetemu::kStepPt, L1MetCollectionName_, M_PI, maxEta_, maxZ0_, minPt_, minZ0_, eostools::move(), InternalEtWord::nstubs, nStubsmin_, InternalEtWord::phi, l1tmetemu::EtMiss::Phi, phiQuadrants_, InternalEtWord::pt, InternalEtWord::pV, pvToken_, InternalEtWord::Sector, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, cond::impl::to_string(), HLT_2022v11_cff::track, trackToken_, TrackTransform, L1TkEtMissEmuTrackTransform::transformTrack(), l1tmetemu::unpackSignedValue(), extraflags_cff::vtx, and InternalEtWord::z0.

154  {
155  using namespace edm;
156 
157  std::unique_ptr<std::vector<l1t::EtSum>> METCollection(new std::vector<l1t::EtSum>(0));
158 
160  iEvent.getByToken(pvToken_, L1VertexHandle);
161 
162  edm::Handle<L1TTTrackCollectionType> L1TTTrackHandle;
163  iEvent.getByToken(trackToken_, L1TTTrackHandle);
164 
165  // Initialize cordic class
167 
168  if (!L1VertexHandle.isValid()) {
169  LogError("L1TrackerEtMissEmulatorProducer") << "\nWarning: VertexCollection not found in the event. Exit\n";
170  return;
171  }
172 
173  if (!L1TTTrackHandle.isValid()) {
174  LogError("L1TrackerEtMissEmulatorProducer") << "\nWarning: L1TTTrackCollection not found in the event. Exit\n";
175  return;
176  }
177 
178  // Initialize sector sums, need 0 initialization in case a sector has no
179  // tracks
180  l1tmetemu::Et_t sumPx[l1tmetemu::kNSector * 2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
181  l1tmetemu::Et_t sumPy[l1tmetemu::kNSector * 2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
182  int sector_totals[l1tmetemu::kNSector] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
183 
184  // Track counters
185  int num_tracks{0};
186  int num_assoc_tracks{0};
187  int num_quality_tracks{0};
188 
189  // Get reference to first vertex in event vertex collection
190  L1VertexType& vtx = const_cast<L1VertexType&>(L1VertexHandle->at(0));
191 
192  for (const auto& track : *L1TTTrackHandle) {
193  num_tracks++;
194  L1TTTrackType& track_ref = const_cast<L1TTTrackType&>(track); // Get Reference to track to pass to TrackTransform
195 
196  // Convert to internal track representation
198 
199  // Parameter cuts
200  if (EtTrack.pt < minPt_)
201  continue;
202 
203  // Z signed so double bound
204  if (EtTrack.z0 & (1 << (l1tmetemu::kInternalVTXWidth - 1))) {
205  // if negative
206  if (EtTrack.z0 <= maxZ0_)
207  continue;
208  } else {
209  if (EtTrack.z0 > minZ0_)
210  continue;
211  }
212  if (EtTrack.eta > maxEta_)
213  continue;
214 
215  // Quality Cuts
216  if (EtTrack.chi2rphidof >= chi2rphiMax_)
217  continue;
218 
219  if (EtTrack.chi2rzdof >= chi2rzMax_)
220  continue;
221 
222  if (EtTrack.bendChi2 >= bendChi2Max_)
223  continue;
224 
225  if (EtTrack.nstubs < nStubsmin_)
226  continue;
227 
228  num_quality_tracks++;
229 
230  // Temporary int representation to get the difference
233 
234  l1tmetemu::z_t z_diff = abs(tempz - temppv);
235 
236  // Track to vertex association, adaptive z window based on eta region
237  for (unsigned int reg = 0; reg < l1tmetemu::kNEtaRegion; reg++) {
238  if (EtTrack.eta >= EtaRegionsLUT_[reg] && EtTrack.eta < EtaRegionsLUT_[reg + 1]) {
239  deltaZ0_ = DeltaZLUT_[reg];
240  break;
241  }
242  }
243 
244  if (z_diff <= deltaZ0_) {
245  num_assoc_tracks++;
246  if (debug_ == 7) {
247  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
248  << "Track to Vertex ID: " << num_tracks << "\n"
249  << "Phi Sector: " << EtTrack.Sector << " pT: " << EtTrack.pt << " Phi: " << EtTrack.globalPhi
250  << " TanL: " << EtTrack.eta << " Z0: " << EtTrack.z0 << " Nstub: " << EtTrack.nstubs
251  << " Chi2rphi: " << EtTrack.chi2rphidof << " Chi2rz: " << EtTrack.chi2rzdof
252  << " bendChi2: " << EtTrack.bendChi2 << " PV: " << EtTrack.pV << "\n"
253  << "--------------------------------------------------------------\n";
254  }
255 
256  if (debug_ == 2) {
257  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
258  << "========================Phi debug=================================\n"
259  << "Int pT: " << EtTrack.pt << "\n"
260  << "Int Phi: " << EtTrack.globalPhi << " Float Phi: " << EtTrack.phi
261  << " Actual Float Cos(Phi): " << cos(EtTrack.phi) << " Actual Float Sin(Phi): " << sin(EtTrack.phi) << "\n";
262  }
263  l1tmetemu::Et_t temppx = 0;
264  l1tmetemu::Et_t temppy = 0;
265 
266  // Split tracks in phi quadrants and access cosLUT_, backwards iteration
267  // through cosLUT_ gives sin Sum sector Et -ve when cos or sin phi are -ve
268  sector_totals[EtTrack.Sector] += 1;
269  if (EtTrack.globalPhi >= phiQuadrants_[0] && EtTrack.globalPhi < phiQuadrants_[1]) {
270  temppx = (EtTrack.pt * cosLUT_[EtTrack.globalPhi]);
271  temppy = (EtTrack.pt * cosLUT_[phiQuadrants_[1] - 1 - EtTrack.globalPhi]);
272 
273  if (debug_ == 2) {
274  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
275  << "Sector: " << EtTrack.Sector << " Quadrant: " << 1 << "\n"
276  << "Int Phi: " << EtTrack.globalPhi << " Int Cos(Phi): " << cosLUT_[EtTrack.globalPhi]
277  << " Int Sin(Phi): " << cosLUT_[phiQuadrants_[1] - 1 - EtTrack.globalPhi] << "\n"
278 
279  << "Float Phi: " << (float)EtTrack.globalPhi / l1tmetemu::kGlobalPhiBins
280  << " Float Cos(Phi): " << (float)cosLUT_[EtTrack.globalPhi] / l1tmetemu::kGlobalPhiBins
281  << " Float Sin(Phi): "
282  << (float)cosLUT_[phiQuadrants_[1] - 1 - EtTrack.globalPhi] / l1tmetemu::kGlobalPhiBins << "\n";
283  }
284  } else if (EtTrack.globalPhi >= phiQuadrants_[1] && EtTrack.globalPhi < phiQuadrants_[2]) {
285  temppx = -(EtTrack.pt * cosLUT_[phiQuadrants_[2] - 1 - EtTrack.globalPhi]);
286  temppy = (EtTrack.pt * cosLUT_[EtTrack.globalPhi - phiQuadrants_[1]]);
287 
288  if (debug_ == 2) {
289  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
290  << "Sector: " << EtTrack.Sector << " Quadrant: " << 2 << "\n"
291  << "Int Phi: " << EtTrack.globalPhi << " Int Cos(Phi): -"
292  << cosLUT_[phiQuadrants_[2] - 1 - EtTrack.globalPhi]
293  << " Int Sin(Phi): " << cosLUT_[EtTrack.globalPhi - phiQuadrants_[1]] << "\n"
294 
295  << "Float Phi: " << (float)EtTrack.globalPhi / l1tmetemu::kGlobalPhiBins << " Float Cos(Phi): -"
296  << (float)cosLUT_[phiQuadrants_[2] - 1 - EtTrack.globalPhi] / l1tmetemu::kGlobalPhiBins
297  << " Float Sin(Phi): " << (float)cosLUT_[EtTrack.globalPhi - phiQuadrants_[1]] / l1tmetemu::kGlobalPhiBins
298  << "\n";
299  }
300  } else if (EtTrack.globalPhi >= phiQuadrants_[2] && EtTrack.globalPhi < phiQuadrants_[3]) {
301  temppx = -(EtTrack.pt * cosLUT_[EtTrack.globalPhi - phiQuadrants_[2]]);
302  temppy = -(EtTrack.pt * cosLUT_[phiQuadrants_[3] - 1 - EtTrack.globalPhi]);
303 
304  if (debug_ == 2) {
305  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
306  << "Sector: " << EtTrack.Sector << " Quadrant: " << 3 << "\n"
307  << "Int Phi: " << EtTrack.globalPhi << " Int Cos(Phi): -" << cosLUT_[EtTrack.globalPhi - phiQuadrants_[2]]
308  << " Int Sin(Phi): -" << cosLUT_[phiQuadrants_[3] - 1 - EtTrack.globalPhi] << "\n"
309 
310  << "Float Phi: " << (float)EtTrack.globalPhi / l1tmetemu::kGlobalPhiBins << " Float Cos(Phi): -"
311  << (float)cosLUT_[EtTrack.globalPhi - phiQuadrants_[2]] / l1tmetemu::kGlobalPhiBins
312  << " Float Sin(Phi): -"
313  << (float)cosLUT_[phiQuadrants_[3] - 1 - EtTrack.globalPhi] / l1tmetemu::kGlobalPhiBins << "\n";
314  }
315 
316  } else if (EtTrack.globalPhi >= phiQuadrants_[3] && EtTrack.globalPhi < phiQuadrants_[4]) {
317  temppx = (EtTrack.pt * cosLUT_[phiQuadrants_[4] - 1 - EtTrack.globalPhi]);
318  temppy = -(EtTrack.pt * cosLUT_[EtTrack.globalPhi - phiQuadrants_[3]]);
319 
320  if (debug_ == 2) {
321  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
322  << "Sector: " << EtTrack.Sector << " Quadrant: " << 4 << "\n"
323  << "Int Phi: " << EtTrack.globalPhi
324  << " Int Cos(Phi): " << cosLUT_[phiQuadrants_[4] - 1 - EtTrack.globalPhi] << " Int Sin(Phi): -"
325  << cosLUT_[EtTrack.globalPhi - phiQuadrants_[3]] << "\n"
326 
327  << "Float Phi: " << (float)EtTrack.globalPhi / l1tmetemu::kGlobalPhiBins << " Float Cos(Phi): "
328  << (float)cosLUT_[phiQuadrants_[4] - 1 - EtTrack.globalPhi] / l1tmetemu::kGlobalPhiBins
329  << " Float Sin(Phi): -"
330  << (float)cosLUT_[EtTrack.globalPhi - phiQuadrants_[3]] / l1tmetemu::kGlobalPhiBins << "\n";
331  }
332  } else {
333  temppx = 0;
334  temppy = 0;
335  }
336  if (EtTrack.EtaSector) {
337  sumPx[EtTrack.Sector] = sumPx[EtTrack.Sector] + temppx;
338  sumPy[EtTrack.Sector] = sumPy[EtTrack.Sector] + temppy;
339  } else {
340  sumPx[l1tmetemu::kNSector + EtTrack.Sector] = sumPx[l1tmetemu::kNSector + EtTrack.Sector] + temppx;
341  sumPy[l1tmetemu::kNSector + EtTrack.Sector] = sumPy[l1tmetemu::kNSector + EtTrack.Sector] + temppy;
342  }
343  }
344 
345  } // end loop over tracks
346 
347  l1tmetemu::Et_t GlobalPx = 0;
348  l1tmetemu::Et_t GlobalPy = 0;
349 
350  float tempsumPx = 0;
351  float tempsumPy = 0;
352 
353  // Global Et sum as floats to emulate rounding in HW
354  for (unsigned int i = 0; i < l1tmetemu::kNSector * 2; i++) {
355  tempsumPx += floor((float)sumPx[i] / (float)l1tmetemu::kGlobalPhiBins);
356  tempsumPy += floor((float)sumPy[i] / (float)l1tmetemu::kGlobalPhiBins);
357  }
358 
359  // Recast rounded temporary sums into Et_t datatype
360  GlobalPx = tempsumPx;
361  GlobalPy = tempsumPy;
362 
363  // Perform cordic sqrt, take x,y and converts to polar coordinate r,phi where
364  // r=sqrt(x**2+y**2) and phi = atan(y/x)
365  l1tmetemu::EtMiss EtMiss = cordicSqrt.toPolar(GlobalPx, GlobalPy);
366 
367  // Recentre phi
368  l1tmetemu::METphi_t tempPhi = 0;
369 
370  if ((GlobalPx < 0) && (GlobalPy < 0))
371  tempPhi = EtMiss.Phi - l1tmetemu::kMETPhiBins / 2;
372  else if ((GlobalPx >= 0) && (GlobalPy >= 0))
373  tempPhi = (EtMiss.Phi) + l1tmetemu::kMETPhiBins / 2;
374  else if ((GlobalPx >= 0) && (GlobalPy < 0))
375  tempPhi = EtMiss.Phi - l1tmetemu::kMETPhiBins / 2;
376  else if ((GlobalPx < 0) && (GlobalPy >= 0))
377  tempPhi = EtMiss.Phi - 3 * l1tmetemu::kMETPhiBins / 2;
378 
379  if (debug_ == 6) {
380  std::string flpxarray[l1tmetemu::kNSector * 2];
381  std::string flpyarray[l1tmetemu::kNSector * 2];
382 
383  std::string intpxarray[l1tmetemu::kNSector * 2];
384  std::string intpyarray[l1tmetemu::kNSector * 2];
385 
386  std::string totalsarray[l1tmetemu::kNSector * 2];
387 
388  for (unsigned int i = 0; i < l1tmetemu::kNSector * 2; i++) {
389  flpxarray[i] = to_string(sumPx[i] * l1tmetemu::kStepPt) + "|";
390  flpyarray[i] = to_string(sumPy[i] * l1tmetemu::kStepPt) + "|";
391  intpxarray[i] = to_string(floor((float)sumPx[i] / (float)l1tmetemu::kGlobalPhiBins)) + "|";
392  intpyarray[i] = to_string(floor((float)sumPy[i] / (float)l1tmetemu::kGlobalPhiBins)) + "|";
393  totalsarray[i] = to_string(sector_totals[i]) + "|";
394  }
395 
396  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
397  << "====Sector Pt====\n"
398  << "Float Px: " << flpxarray << "Float Py: " << flpyarray << "Integer Px: " << intpyarray
399  << "Integer Px: " << intpyarray << "Sector Totals: " << totalsarray
400 
401  << "====Global Pt====\n"
402  << "Integer Global Px: " << GlobalPx << "| Integer Global Py: " << GlobalPy << "\n"
403  << "Float Global Px: " << GlobalPx * l1tmetemu::kStepPt
404  << "| Float Global Py: " << GlobalPy * l1tmetemu::kStepPt << "\n";
405  }
406 
407  if (debug_ == 6) {
408  edm::LogVerbatim("L1TrackerEtMissEmulatorProducer")
409  << "====MET===\n"
410  << "Integer MET: " << EtMiss.Et << "| Integer MET phi: " << EtMiss.Phi << "\n"
411  << "Float MET: " << (EtMiss.Et) * l1tmetemu::kStepMET
412  << "| Float MET phi: " << (float)tempPhi * l1tmetemu::kStepMETPhi - M_PI << "\n"
413  << "# Intial Tracks: " << num_tracks << "\n"
414  << "# Tracks after Quality Cuts: " << num_quality_tracks << "\n"
415  << "# Tracks Associated to Vertex: " << num_assoc_tracks << "\n"
416  << "========================================================\n";
417  }
418 
419  math::XYZTLorentzVector missingEt(-GlobalPx, -GlobalPy, 0, EtMiss.Et);
420  EtSum L1EtSum(missingEt, EtSum::EtSumType::kMissingEt, (int)EtMiss.Et, 0, (int)tempPhi, (int)num_assoc_tracks);
421 
422  METCollection->push_back(L1EtSum);
423 
425 } // end producer
const unsigned int kGlobalPhiBins
Log< level::Info, true > LogVerbatim
ap_uint< kMETPhiSize > METphi_t
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
TTTrack_TrackWord::chi2rphi_t chi2rphidof
std::vector< l1tmetemu::global_phi_t > phiQuadrants_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int unpackSignedValue(unsigned int bits, unsigned int nBits)
ap_uint< kInternalVTXWidth > z_t
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::vector< l1tmetemu::eta_t > EtaRegionsLUT_
EtMiss cordicSqrt(Et_t x, Et_t y, int cordicSteps, std::vector< l1tmhtemu::MHTphi_t > atanLUT, std::vector< Et_t > magNormalisationLUT)
const unsigned int kNEtaRegion
const double kStepPt
const double kStepMET
Log< level::Error, false > LogError
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
TTTrack_TrackWord::chi2rz_t chi2rzdof
const edm::EDGetTokenT< L1VertexCollectionType > pvToken_
const unsigned int kNSector
const unsigned int kInternalVTXWidth
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< L1TTTrackCollectionType > trackToken_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const unsigned int kMETPhiBins
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: Cordic.h:7
const unsigned int kMETSize
Collection of MET.
#define M_PI
l1tmetemu::nstub_t nstubs
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
l1tmetemu::global_phi_t globalPhi
bool isValid() const
Definition: HandleBase.h:70
std::vector< l1tmetemu::global_phi_t > cosLUT_
HLT enums.
TTTrack_TrackWord::bendChi2_t bendChi2
InternalEtWord transformTrack(track &track_ref, vertex &PV)
def move(src, dest)
Definition: eostools.py:511
ap_int< kInternalPtWidth+kEtExtra > Et_t
const double kStepMETPhi

Member Data Documentation

◆ bendChi2Max_

TTTrack_TrackWord::bendChi2_t L1TrackerEtMissEmulatorProducer::bendChi2Max_
private

Definition at line 71 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ chi2rphiMax_

TTTrack_TrackWord::chi2rphi_t L1TrackerEtMissEmulatorProducer::chi2rphiMax_
private

Definition at line 69 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ chi2rzMax_

TTTrack_TrackWord::chi2rz_t L1TrackerEtMissEmulatorProducer::chi2rzMax_
private

Definition at line 70 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ cordicDebug_

bool L1TrackerEtMissEmulatorProducer::cordicDebug_ = false
private

Definition at line 82 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ cordicSteps_

int L1TrackerEtMissEmulatorProducer::cordicSteps_
private

Definition at line 80 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ cosLUT_

std::vector<l1tmetemu::global_phi_t> L1TrackerEtMissEmulatorProducer::cosLUT_
private

Definition at line 60 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ debug_

int L1TrackerEtMissEmulatorProducer::debug_
private

Definition at line 81 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ deltaZ0_

l1tmetemu::z_t L1TrackerEtMissEmulatorProducer::deltaZ0_ = 0
private

Definition at line 78 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by produce().

◆ DeltaZLUT_

std::vector<l1tmetemu::z_t> L1TrackerEtMissEmulatorProducer::DeltaZLUT_
private

Definition at line 62 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ etaRegions_

vector<double> L1TrackerEtMissEmulatorProducer::etaRegions_
private

Definition at line 76 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer().

◆ EtaRegionsLUT_

std::vector<l1tmetemu::eta_t> L1TrackerEtMissEmulatorProducer::EtaRegionsLUT_
private

Definition at line 61 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ GTTinput_

bool L1TrackerEtMissEmulatorProducer::GTTinput_ = false
private

Definition at line 84 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer().

◆ L1MetCollectionName_

std::string L1TrackerEtMissEmulatorProducer::L1MetCollectionName_
private

Definition at line 88 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ maxEta_

l1tmetemu::eta_t L1TrackerEtMissEmulatorProducer::maxEta_
private

Definition at line 68 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ maxZ0_

l1tmetemu::z_t L1TrackerEtMissEmulatorProducer::maxZ0_
private

Definition at line 67 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ minPt_

l1tmetemu::pt_t L1TrackerEtMissEmulatorProducer::minPt_
private

Definition at line 72 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ minZ0_

l1tmetemu::z_t L1TrackerEtMissEmulatorProducer::minZ0_
private

Definition at line 66 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ nStubsmin_

l1tmetemu::nstub_t L1TrackerEtMissEmulatorProducer::nStubsmin_
private

Definition at line 73 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ phiQuadrants_

std::vector<l1tmetemu::global_phi_t> L1TrackerEtMissEmulatorProducer::phiQuadrants_
private

Definition at line 63 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ phiShifts_

std::vector<l1tmetemu::global_phi_t> L1TrackerEtMissEmulatorProducer::phiShifts_
private

Definition at line 64 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer().

◆ pvToken_

const edm::EDGetTokenT<L1VertexCollectionType> L1TrackerEtMissEmulatorProducer::pvToken_
private

Definition at line 90 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by produce().

◆ trackToken_

const edm::EDGetTokenT<L1TTTrackCollectionType> L1TrackerEtMissEmulatorProducer::trackToken_
private

Definition at line 91 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by produce().

◆ TrackTransform

L1TkEtMissEmuTrackTransform L1TrackerEtMissEmulatorProducer::TrackTransform
private

Definition at line 86 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer(), and produce().

◆ z0Thresholds_

vector<double> L1TrackerEtMissEmulatorProducer::z0Thresholds_
private

Definition at line 75 of file L1TrackerEtMissEmulatorProducer.cc.

Referenced by L1TrackerEtMissEmulatorProducer().