69 void endStream()
override;
113 trkZMax_((
float)iConfig.getParameter<double>(
"trk_zMax")),
114 trkPtMax_((
float)iConfig.getParameter<double>(
"trk_ptMax")),
115 trkPtMin_((
float)iConfig.getParameter<double>(
"trk_ptMin")),
116 trkEtaMax_((
float)iConfig.getParameter<double>(
"trk_etaMax")),
117 trkChi2dofMax_((
float)iConfig.getParameter<double>(
"trk_chi2dofMax")),
118 trkBendChi2Max_((
float)iConfig.getParameter<double>(
"trk_bendChi2Max")),
119 trkNPSStubMin_((
int)iConfig.getParameter<
int>(
"trk_nPSStubMin")),
120 minTrkJetpT_(iConfig.getParameter<double>(
"minTrkJetpT")),
121 etaBins_((
int)iConfig.getParameter<
int>(
"etaBins")),
122 phiBins_((
int)iConfig.getParameter<
int>(
"phiBins")),
123 zBins_((
int)iConfig.getParameter<
int>(
"zBins")),
124 d0CutNStubs4_((
float)iConfig.getParameter<double>(
"d0_cutNStubs4")),
125 d0CutNStubs5_((
float)iConfig.getParameter<double>(
"d0_cutNStubs5")),
126 lowpTJetMinTrackMultiplicity_((
int)iConfig.getParameter<
int>(
"lowpTJetMinTrackMultiplicity")),
127 lowpTJetMinpT_((
float)iConfig.getParameter<double>(
"lowpTJetMinpT")),
128 highpTJetMinTrackMultiplicity_((
int)iConfig.getParameter<
int>(
"highpTJetMinTrackMultiplicity")),
129 highpTJetMinpT_((
float)iConfig.getParameter<double>(
"highpTJetMinpT")),
130 displaced_(iConfig.getParameter<
bool>(
"displaced")),
131 nStubs4DisplacedChi2_((
float)iConfig.getParameter<double>(
"nStubs4DisplacedChi2")),
132 nStubs5DisplacedChi2_((
float)iConfig.getParameter<double>(
"nStubs5DisplacedChi2")),
133 nStubs4DisplacedBend_((
float)iConfig.getParameter<double>(
"nStubs4Displacedbend")),
134 nStubs5DisplacedBend_((
float)iConfig.getParameter<double>(
"nStubs5Displacedbend")),
135 nDisplacedTracks_((
int)iConfig.getParameter<
int>(
"nDisplacedTracks")),
144 produces<l1t::TkJetWordCollection>(
"L1TrackJetsExtended");
146 produces<l1t::TkJetWordCollection>(
"L1TrackJets");
159 vector<TTTrack<Ref_Phase2TrackerDigi_>>::const_iterator iterL1Track;
163 float PVz = (PVtx->at(0)).
z0();
168 unsigned int this_l1track = 0;
169 for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) {
174 float trk_chi2dof = trkPtr->
chi2Red();
175 float trk_d0 = trkPtr->
d0();
177 float trk_z0 = trkPtr->
z0();
180 for (
int istub = 0; istub < trk_nstubs; istub++) {
234 L1L1TrackJetProducer->push_back(trkJet);
236 }
else if (mzb.
clusters ==
nullptr) {
237 edm::LogWarning(
"L1TrackJetEmulationProducer") <<
"mzb.clusters Not Assigned!\n";
246 edm::LogWarning(
"L1TrackJetEmulationProducer") <<
"L1TrkPtrs Not Assigned!\n";
255 enum TrackBitWidths {
264 const int nz =
zBins_ + 1;
299 for (
int zbin = 0; zbin <
zBins_; ++zbin) {
303 epbins[
i][
j].
used =
false;
307 L1clusters[
i] = epbins[
i];
311 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize, AP_RND_CONV, AP_SAT> inputTrkPt = 0;
312 inputTrkPt.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1,
313 TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
316 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize, AP_RND_CONV, AP_SAT> trketainput = 0;
317 trketainput.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kTanlMSB,
318 TTTrack_TrackWord::TrackBitLocations::kTanlLSB);
319 ap_ufixed<64 + ETA_EXTRABITS, 32 + ETA_EXTRABITS> eta_conv =
332 ap_fixed<TrackBitWidths::kPhiSize, TrackBitWidths::kPhiMagSize, AP_RND_CONV, AP_SAT> trkphiinput = 0;
333 trkphiinput.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kPhiMSB,
334 TTTrack_TrackWord::TrackBitLocations::kPhiLSB);
335 ap_ufixed<64 + PHI_EXTRABITS, 32 + PHI_EXTRABITS> phi_conv =
337 (1 << (TrackBitWidths::kPhiSize - TrackBitWidths::kPhiMagSize));
342 ap_int<TTTrack_TrackWord::TrackBitWidths::kZ0Size> inputTrkZ0 =
L1TrkPtrs_[
k]->getTrackWord()(
343 TTTrack_TrackWord::TrackBitLocations::kZ0MSB, TTTrack_TrackWord::TrackBitLocations::kZ0LSB);
344 ap_ufixed<32 + Z0_EXTRABITS, 1 + Z0_EXTRABITS> z0_conv =
350 L2cluster[
k] = epbins[
i][
j];
351 if ((zmin <= trkZ && zmax >= trkZ) &&
368 for (
int phislice = 0; phislice <
phiBins_; ++phislice) {
369 L1clusters[phislice] =
L1_cluster(epbins[phislice]);
370 for (
int ind = 0; L1clusters[phislice][ind].
pTtot != 0; ++ind) {
371 L1clusters[phislice][ind].
used =
false;
387 int used1, used2, used3, used4;
389 for (phibin = 0; phibin <
phiBins_; ++phibin) {
392 for (index1 = 0; L1clusters[phibin][index1].
pTtot > 0; ++index1) {
393 if (!L1clusters[phibin][index1].used && L1clusters[phibin][index1].pTtot >= hipT) {
394 hipT = L1clusters[phibin][index1].
pTtot;
408 L2cluster[
nclust] = L1clusters[phibin][imax];
410 L1clusters[phibin][imax].
used =
true;
416 for (index1 = 0; L1clusters[phibin + 1][index1].
pTtot != 0; ++index1) {
417 if (L1clusters[phibin + 1][index1].used)
419 if (L1clusters[phibin + 1][index1].
eta - L1clusters[phibin][imax].
eta <= 3 *
etaStep_ / 2 &&
420 L1clusters[phibin][imax].
eta - L1clusters[phibin + 1][index1].
eta <= 3 *
etaStep_ / 2) {
421 E1 += L1clusters[phibin + 1][index1].
pTtot;
422 ntrk1 += L1clusters[phibin + 1][index1].
ntracks;
423 nxtrk1 += L1clusters[phibin + 1][index1].
nxtracks;
436 L1clusters[phibin + 1][used1].
used =
true;
438 L1clusters[phibin + 1][used2].
used =
true;
446 for (index1 = 0; L1clusters[phibin + 2][index1].
pTtot != 0; ++index1) {
447 if (L1clusters[phibin + 2][index1].used)
449 if (L1clusters[phibin + 2][index1].
eta - L1clusters[phibin][imax].
eta <= 3 *
etaStep_ / 2 &&
450 L1clusters[phibin][imax].
eta - L1clusters[phibin + 2][index1].
eta <= 3 *
etaStep_ / 2) {
451 E2 += L1clusters[phibin + 2][index1].
pTtot;
452 ntrk2 += L1clusters[phibin + 2][index1].
ntracks;
453 nxtrk2 += L1clusters[phibin + 2][index1].
nxtracks;
466 L2cluster[
nclust].
phi = L1clusters[phibin + 1][used1].
phi;
468 L1clusters[phibin + 1][used1].
used =
true;
470 L1clusters[phibin + 1][used2].
used =
true;
472 L1clusters[phibin + 2][used3].
used =
true;
474 L1clusters[phibin + 2][used4].
used =
true;
483 L2cluster[
nclust].
phi = L1clusters[phibin + 1][used1].
phi;
485 L1clusters[phibin + 1][used1].
used =
true;
487 L1clusters[phibin + 1][used2].
used =
true;
493 L1clusters[phibin][imax].
used =
true;
499 for (phibin = 0; phibin <
phiBins_; ++phibin)
500 delete[] L1clusters[phibin];
505 if (L2cluster[
n].
eta == L2cluster[
m].
eta &&
510 if (L2cluster[
n].pTtot > L2cluster[
m].pTtot) {
511 L2cluster[
m].
phi = L2cluster[
n].
phi;
516 for (
int m1 =
n; m1 <
nclust - 1; ++m1) {
517 L2cluster[m1] = L2cluster[m1 + 1];
539 all_zBins[zbin].
znum = zbin;
550 all_zBins[zbin].
ht = ht;
552 mzb = all_zBins[zbin];
560 for (
int zbin = 0; zbin <
zBins_; ++zbin) {
561 if (zbin == mzb.
znum) {
570 for (
int etabin = 0; etabin <
etaBins_ / 2; ++etabin) {
580 edm::LogWarning(
"L1TrackJetEmulationProducer") <<
"Clusters memory not assigned!\n";
583 pt_intern my_pt, left_pt, right_pt, right2pt;
586 for (
int etabin = 0; etabin <
etaBins_; ++etabin) {
588 if (phislice[etabin].used)
590 my_pt = phislice[etabin].
pTtot;
591 if (etabin > 0 && !phislice[etabin - 1].used) {
592 left_pt = phislice[etabin - 1].
pTtot;
595 if (etabin <
etaBins_ - 1 && !phislice[etabin + 1].used) {
596 right_pt = phislice[etabin + 1].
pTtot;
597 if (etabin <
etaBins_ - 2 && !phislice[etabin + 2].used) {
598 right2pt = phislice[etabin + 2].
pTtot;
605 if (my_pt < left_pt || my_pt <= right_pt) {
609 phislice[etabin - 1].
used =
true;
619 phislice[etabin].
used =
true;
625 if (my_pt >= right2pt && right_pt > 0) {
629 phislice[etabin + 1].
used =
true;
644 for (
int m1 =
m + 1; m1 <
nclust - 1; ++m1)
661 bool PassQuality =
false;
static const float ETA_LSB_POW
pt_intern makePtFromFloat(float pt)
unsigned int tobLayer(const DetId &id) const
std::vector< l1t::TkJetWord > TkJetWordCollection
static const float Z0_LSB_POW
ap_int< kGlbEtaSize > glbeta_t
ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
~L1TrackJetEmulationProducer() override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
glbeta_intern makeGlbEta(float eta)
l1t::TkJetWord::nt_t ntracks
ap_int< 14+PHI_EXTRABITS > glbphi_intern
static const float ETA_LSB
z0_intern makeZ0(float z0)
vector< L1TTTrackType > L1TTTrackCollectionType
ap_int< kGlbPhiSize > glbphi_t
void L2_cluster(vector< Ptr< L1TTTrackType >> L1TrkPtrs_, TrackJetEmulationMaxZBin &mzb)
bool trackQualityCuts(int trk_nstub, float trk_chi2, float trk_bendchi2)
ap_ufixed< kPtSize, kPtMagSize, AP_TRN, AP_SAT > pt_t
static const float PHI_LSB_POW
int highpTJetMinTrackMultiplicity_
ap_uint< TkJetBitWidths::kUnassignedSize > tkjetunassigned_t
static void fillDescriptions(ConfigurationDescriptions &descriptions)
GlobalVector momentum() const
Track momentum.
ap_ufixed< 16+PT_EXTRABITS, 11, AP_TRN, AP_SAT > pt_intern
float nStubs5DisplacedChi2_
ap_int< 10+Z0_EXTRABITS > z0_intern
float nStubs5DisplacedBend_
ap_int< 14+ETA_EXTRABITS > glbeta_intern
l1t::TkJetWord::nx_t nxtracks
float nStubs4DisplacedChi2_
glbphi_intern makeGlbPhi(float phi)
void addDefault(ParameterSetDescription const &psetDescription)
static const float PHI_LSB
const float trkBendChi2Max_
int lowpTJetMinTrackMultiplicity_
void produce(Event &, const EventSetup &) override
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
std::vector< VertexWord > VertexWordCollection
void beginStream(StreamID) override
static constexpr auto TOB
const EDGetTokenT< l1t::VertexWordCollection > PVtxToken_
void endStream() override
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > getStubRefs() const
Track components.
const double minTrkJetpT_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Class to store the L1 Track Trigger tracks.
double stubPtConsistency() const
StubPtConsistency.
static constexpr double stepPhi0
double d0() const
Track d0.
const unsigned int kPtMagSize
vector< Ptr< L1TTTrackType > > L1TrkPtrs_
double chi2Red() const
Chi2 reduced.
float nStubs4DisplacedBend_
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
double z0() const
Track z0.
TrackJetEmulationEtaPhiBin * clusters
unsigned int tidRing(const DetId &id) const
const EDGetTokenT< vector< TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_
const float trkChi2dofMax_
Log< level::Warning, false > LogWarning
static constexpr double stepZ0
static constexpr auto TID
static const float Z0_LSB
L1TrackJetEmulationProducer(const ParameterSet &)
virtual TrackJetEmulationEtaPhiBin * L1_cluster(TrackJetEmulationEtaPhiBin *phislice)