CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
Phase2L1GMT::TrackConverter Class Reference

#include <TrackConverter.h>

Public Member Functions

std::vector< ConvertedTTTrackconvertTracks (const std::vector< edm::Ptr< l1t::TrackerMuon::L1TTTrackType > > &tracks)
 
 TrackConverter (const edm::ParameterSet &iConfig)
 
 ~TrackConverter ()
 

Private Types

typedef ap_uint< 96 > wordtype
 

Private Member Functions

ConvertedTTTrack convert (const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > &track)
 
uint etaLookup (uint absTanL)
 
uint generateQuality (const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > &track)
 
uint ptLookup (uint absCurv)
 

Private Attributes

int verbose_
 

Detailed Description

Definition at line 10 of file TrackConverter.h.

Member Typedef Documentation

◆ wordtype

typedef ap_uint<96> Phase2L1GMT::TrackConverter::wordtype
private

Definition at line 25 of file TrackConverter.h.

Constructor & Destructor Documentation

◆ TrackConverter()

Phase2L1GMT::TrackConverter::TrackConverter ( const edm::ParameterSet iConfig)
inline

Definition at line 12 of file TrackConverter.h.

12 : verbose_(iConfig.getParameter<int>("verbose")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ ~TrackConverter()

Phase2L1GMT::TrackConverter::~TrackConverter ( )
inline

Definition at line 13 of file TrackConverter.h.

13 {}

Member Function Documentation

◆ convert()

ConvertedTTTrack Phase2L1GMT::TrackConverter::convert ( const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > &  track)
inlineprivate

Definition at line 53 of file TrackConverter.h.

References Phase2L1GMT::BITSD0, Phase2L1GMT::BITSPHI, Phase2L1GMT::BITSTTCURV, Phase2L1GMT::BITSTTPHI, Phase2L1GMT::BITSTTTANL, Phase2L1GMT::BITSZ0, ALCARECOTkAlJpsiMuMu_cff::charge, PixelRecoUtilities::curvature(), d0, PVValHelper::eta, etaLookup(), Phase2L1GMT::etaLUT, generateQuality(), M_PI, Phase2L1GMT::maxCurv_, Phase2L1GMT::maxD0_, Phase2L1GMT::maxTanl_, Phase2L1GMT::maxZ0_, DiDispStaMuonMonitor_cfi::pt, ptLookup(), Phase2L1GMT::ptLUT, quality, Phase2L1GMT::ConvertedTTTrack::setOfflineQuantities(), HLT_2022v12_cff::track, parallelization::uint, verbose_, and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by convertTracks().

53  {
54  uint charge = (track->rInv() < 0) ? 1 : 0;
55  int curvature = track->rInv() * (1 << (BITSTTCURV - 1)) / maxCurv_;
56  int phi = track->phi() * (1 << (BITSPHI - 1)) / (M_PI);
57  int tanLambda = track->tanL() * (1 << (BITSTTTANL - 1)) / maxTanl_;
58  int z0 = track->z0() * (1 << (BITSZ0 - 1)) / maxZ0_;
59  int d0 = track->d0() * (1 << (BITSD0 - 1)) / maxD0_;
60  //calculate pt
61  uint absCurv = curvature > 0 ? (curvature) : (-curvature);
62  uint pt = ptLUT[ptLookup(absCurv)];
64  uint absTanL = tanLambda > 0 ? (tanLambda) : (-tanLambda);
65  uint absEta = etaLUT[etaLookup(absTanL)];
66  int eta = tanLambda > 0 ? (absEta) : (-absEta);
67 
68  ap_int<BITSPHI> phiSec = ap_int<BITSPHI>(phi) -
69  ap_int<BITSPHI>((track->phiSector() * 40 * M_PI / 180.) * (1 << (BITSPHI - 1)) / (M_PI));
70  ap_int<BITSPHI> phiCorrected = ap_int<BITSPHI>(phiSec + track->phiSector() * 910);
71 
72  wordtype word = 0;
73  int bstart = 0;
74  bstart = wordconcat<wordtype>(word, bstart, curvature, BITSTTCURV);
75  bstart = wordconcat<wordtype>(word, bstart, phiSec, BITSTTPHI);
76  bstart = wordconcat<wordtype>(word, bstart, tanLambda, BITSTTTANL);
77  bstart = wordconcat<wordtype>(word, bstart, z0, BITSZ0);
78  bstart = wordconcat<wordtype>(word, bstart, d0, BITSD0);
79  bstart = wordconcat<wordtype>(word, bstart, uint(track->chi2()), 4);
80 
81  ConvertedTTTrack convertedTrack(charge, curvature, absEta, pt, eta, phiCorrected.to_int(), z0, d0, quality, word);
82  convertedTrack.setOfflineQuantities(track->momentum().transverse(), track->eta(), track->phi());
83  if (verbose_)
84  convertedTrack.print();
85  convertedTrack.setTrkPtr(track);
86  return convertedTrack;
87  }
const float maxZ0_
Definition: Constants.h:71
const int BITSZ0
Definition: Constants.h:27
const float maxD0_
Definition: Constants.h:72
T curvature(T InversePt, const MagneticField &field)
const int BITSTTPHI
Definition: Constants.h:12
uint64_t word
const float maxCurv_
Definition: Constants.h:68
uint etaLookup(uint absTanL)
const int BITSPHI
Definition: Constants.h:25
const int BITSD0
Definition: Constants.h:28
const int BITSTTCURV
Definition: Constants.h:10
uint ptLookup(uint absCurv)
#define M_PI
const float maxTanl_
Definition: Constants.h:70
static constexpr float d0
const ap_uint< BITSPT > ptLUT[1858]
Definition: Constants.h:115
const int BITSTTTANL
Definition: Constants.h:13
uint generateQuality(const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > &track)
string quality
const uint etaLUT[4082]
Definition: Constants.h:218

◆ convertTracks()

std::vector<ConvertedTTTrack> Phase2L1GMT::TrackConverter::convertTracks ( const std::vector< edm::Ptr< l1t::TrackerMuon::L1TTTrackType > > &  tracks)
inline

Definition at line 15 of file TrackConverter.h.

References convert(), MillePedeFileConverter_cfg::out, submitPVValidationJobs::t, and tracks.

15  {
16  std::vector<ConvertedTTTrack> out;
17  out.reserve(tracks.size());
18  for (const auto& t : tracks)
19  out.push_back(convert(t));
20  return out;
21  }
ConvertedTTTrack convert(const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > &track)
auto const & tracks
cannot be loose

◆ etaLookup()

uint Phase2L1GMT::TrackConverter::etaLookup ( uint  absTanL)
inlineprivate

Definition at line 41 of file TrackConverter.h.

References Phase2L1GMT::etaShifts, mps_fire::i, and parallelization::uint.

Referenced by convert().

41  {
42  for (auto i : etaShifts) {
43  if (absTanL >= uint(i[0]) && absTanL < uint(i[1])) {
44  if (i[2] < 0)
45  return i[4];
46  else
47  return (absTanL >> i[2]) + i[3];
48  }
49  }
50  return 0;
51  }
const int etaShifts[4][5]
Definition: Constants.h:215

◆ generateQuality()

uint Phase2L1GMT::TrackConverter::generateQuality ( const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > &  track)
inlineprivate

Definition at line 27 of file TrackConverter.h.

Referenced by convert().

27 { return 1; }

◆ ptLookup()

uint Phase2L1GMT::TrackConverter::ptLookup ( uint  absCurv)
inlineprivate

Definition at line 29 of file TrackConverter.h.

References mps_fire::i, Phase2L1GMT::ptShifts, and parallelization::uint.

Referenced by convert().

29  {
30  for (auto i : ptShifts) {
31  if (absCurv >= uint(i[0]) && absCurv < uint(i[1])) {
32  if (i[2] < 0)
33  return i[4];
34  else
35  return (absCurv >> i[2]) + i[3];
36  }
37  }
38  return 0;
39  }
const int ptShifts[9][5]
Definition: Constants.h:105

Member Data Documentation

◆ verbose_

int Phase2L1GMT::TrackConverter::verbose_
private

Definition at line 24 of file TrackConverter.h.

Referenced by convert().