68 void endStream()
override;
112 trkZMax_((
float)iConfig.getParameter<double>(
"trk_zMax")),
113 trkPtMax_((
float)iConfig.getParameter<double>(
"trk_ptMax")),
114 trkPtMin_((
float)iConfig.getParameter<double>(
"trk_ptMin")),
115 trkEtaMax_((
float)iConfig.getParameter<double>(
"trk_etaMax")),
116 trkChi2dofMax_((
float)iConfig.getParameter<double>(
"trk_chi2dofMax")),
117 trkBendChi2Max_((
float)iConfig.getParameter<double>(
"trk_bendChi2Max")),
118 trkNPSStubMin_((
int)iConfig.getParameter<
int>(
"trk_nPSStubMin")),
119 minTrkJetpT_(iConfig.getParameter<double>(
"minTrkJetpT")),
120 etaBins_((
int)iConfig.getParameter<
int>(
"etaBins")),
121 phiBins_((
int)iConfig.getParameter<
int>(
"phiBins")),
122 zBins_((
int)iConfig.getParameter<
int>(
"zBins")),
123 d0CutNStubs4_((
float)iConfig.getParameter<double>(
"d0_cutNStubs4")),
124 d0CutNStubs5_((
float)iConfig.getParameter<double>(
"d0_cutNStubs5")),
125 lowpTJetMinTrackMultiplicity_((
int)iConfig.getParameter<
int>(
"lowpTJetMinTrackMultiplicity")),
126 lowpTJetMinpT_((
float)iConfig.getParameter<double>(
"lowpTJetMinpT")),
127 highpTJetMinTrackMultiplicity_((
int)iConfig.getParameter<
int>(
"highpTJetMinTrackMultiplicity")),
128 highpTJetMinpT_((
float)iConfig.getParameter<double>(
"highpTJetMinpT")),
129 displaced_(iConfig.getParameter<
bool>(
"displaced")),
130 nStubs4DisplacedChi2_((
float)iConfig.getParameter<double>(
"nStubs4DisplacedChi2")),
131 nStubs5DisplacedChi2_((
float)iConfig.getParameter<double>(
"nStubs5DisplacedChi2")),
132 nStubs4DisplacedBend_((
float)iConfig.getParameter<double>(
"nStubs4Displacedbend")),
133 nStubs5DisplacedBend_((
float)iConfig.getParameter<double>(
"nStubs5Displacedbend")),
134 nDisplacedTracks_((
int)iConfig.getParameter<
int>(
"nDisplacedTracks")),
143 produces<l1t::TkJetWordCollection>(
"L1TrackJetsExtended");
145 produces<l1t::TkJetWordCollection>(
"L1TrackJets");
158 vector<TTTrack<Ref_Phase2TrackerDigi_>>::const_iterator iterL1Track;
162 float PVz = (PVtx->at(0)).
z0();
167 unsigned int this_l1track = 0;
168 for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) {
173 float trk_chi2dof = trkPtr->
chi2Red();
174 float trk_d0 = trkPtr->
d0();
176 float trk_z0 = trkPtr->
z0();
179 for (
int istub = 0; istub < trk_nstubs; istub++) {
233 L1L1TrackJetProducer->push_back(trkJet);
235 }
else if (mzb.
clusters ==
nullptr) {
236 edm::LogWarning(
"L1TrackJetEmulationProducer") <<
"mzb.clusters Not Assigned!\n";
245 edm::LogWarning(
"L1TrackJetEmulationProducer") <<
"L1TrkPtrs Not Assigned!\n";
250 enum TrackBitWidths {
259 const int nz =
zBins_ + 1;
262 for (
int z = 0;
z < nz; ++
z)
263 all_zBins[
z] = mzbtemp;
296 for (
int zbin = 0; zbin <
zBins_; ++zbin) {
300 epbins[
i][
j].
used =
false;
304 L1clusters[
i] = epbins[
i];
308 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize, AP_RND_CONV, AP_SAT> inputTrkPt = 0;
309 inputTrkPt.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1,
310 TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
313 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize, AP_RND_CONV, AP_SAT> trketainput = 0;
314 trketainput.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kTanlMSB,
315 TTTrack_TrackWord::TrackBitLocations::kTanlLSB);
316 ap_ufixed<64 + ETA_EXTRABITS, 32 + ETA_EXTRABITS> eta_conv =
329 ap_fixed<TrackBitWidths::kPhiSize, TrackBitWidths::kPhiMagSize, AP_RND_CONV, AP_SAT> trkphiinput = 0;
330 trkphiinput.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kPhiMSB,
331 TTTrack_TrackWord::TrackBitLocations::kPhiLSB);
332 ap_ufixed<64 + PHI_EXTRABITS, 32 + PHI_EXTRABITS> phi_conv =
334 (1 << (TrackBitWidths::kPhiSize - TrackBitWidths::kPhiMagSize));
339 ap_int<TTTrack_TrackWord::TrackBitWidths::kZ0Size> inputTrkZ0 =
L1TrkPtrs_[
k]->getTrackWord()(
340 TTTrack_TrackWord::TrackBitLocations::kZ0MSB, TTTrack_TrackWord::TrackBitLocations::kZ0LSB);
341 ap_ufixed<32 + Z0_EXTRABITS, 1 + Z0_EXTRABITS> z0_conv =
347 L2cluster[
k] = epbins[
i][
j];
348 if ((zmin <= trkZ && zmax >= trkZ) &&
365 for (
int phislice = 0; phislice <
phiBins_; ++phislice) {
366 L1clusters[phislice] =
L1_cluster(epbins[phislice]);
367 for (
int ind = 0; L1clusters[phislice][ind].
pTtot != 0; ++ind) {
368 L1clusters[phislice][ind].
used =
false;
384 int used1, used2, used3, used4;
386 for (phibin = 0; phibin <
phiBins_; ++phibin) {
389 for (index1 = 0; L1clusters[phibin][index1].
pTtot > 0; ++index1) {
390 if (!L1clusters[phibin][index1].used && L1clusters[phibin][index1].pTtot >= hipT) {
391 hipT = L1clusters[phibin][index1].
pTtot;
405 L2cluster[
nclust] = L1clusters[phibin][imax];
407 L1clusters[phibin][imax].
used =
true;
413 for (index1 = 0; L1clusters[phibin + 1][index1].
pTtot != 0; ++index1) {
414 if (L1clusters[phibin + 1][index1].used)
416 if (L1clusters[phibin + 1][index1].
eta - L1clusters[phibin][imax].
eta <= 3 *
etaStep_ / 2 &&
417 L1clusters[phibin][imax].
eta - L1clusters[phibin + 1][index1].
eta <= 3 *
etaStep_ / 2) {
418 E1 += L1clusters[phibin + 1][index1].
pTtot;
419 ntrk1 += L1clusters[phibin + 1][index1].
ntracks;
420 nxtrk1 += L1clusters[phibin + 1][index1].
nxtracks;
433 L1clusters[phibin + 1][used1].
used =
true;
435 L1clusters[phibin + 1][used2].
used =
true;
443 for (index1 = 0; L1clusters[phibin + 2][index1].
pTtot != 0; ++index1) {
444 if (L1clusters[phibin + 2][index1].used)
446 if (L1clusters[phibin + 2][index1].
eta - L1clusters[phibin][imax].
eta <= 3 *
etaStep_ / 2 &&
447 L1clusters[phibin][imax].
eta - L1clusters[phibin + 2][index1].
eta <= 3 *
etaStep_ / 2) {
448 E2 += L1clusters[phibin + 2][index1].
pTtot;
449 ntrk2 += L1clusters[phibin + 2][index1].
ntracks;
450 nxtrk2 += L1clusters[phibin + 2][index1].
nxtracks;
463 L2cluster[
nclust].
phi = L1clusters[phibin + 1][used1].
phi;
465 L1clusters[phibin + 1][used1].
used =
true;
467 L1clusters[phibin + 1][used2].
used =
true;
469 L1clusters[phibin + 2][used3].
used =
true;
471 L1clusters[phibin + 2][used4].
used =
true;
480 L2cluster[
nclust].
phi = L1clusters[phibin + 1][used1].
phi;
482 L1clusters[phibin + 1][used1].
used =
true;
484 L1clusters[phibin + 1][used2].
used =
true;
490 L1clusters[phibin][imax].
used =
true;
496 for (phibin = 0; phibin <
phiBins_; ++phibin)
497 delete[] L1clusters[phibin];
502 if (L2cluster[
n].
eta == L2cluster[
m].
eta &&
507 if (L2cluster[
n].pTtot > L2cluster[
m].pTtot) {
508 L2cluster[
m].
phi = L2cluster[
n].
phi;
513 for (
int m1 =
n; m1 <
nclust - 1; ++m1) {
514 L2cluster[m1] = L2cluster[m1 + 1];
536 all_zBins[zbin].
znum = zbin;
547 all_zBins[zbin].
ht = ht;
549 mzb = all_zBins[zbin];
557 for (
int zbin = 0; zbin <
zBins_; ++zbin) {
558 if (zbin == mzb.
znum) {
567 for (
int etabin = 0; etabin <
etaBins_ / 2; ++etabin) {
577 edm::LogWarning(
"L1TrackJetEmulationProducer") <<
"Clusters memory not assigned!\n";
580 pt_intern my_pt, left_pt, right_pt, right2pt;
583 for (
int etabin = 0; etabin <
etaBins_; ++etabin) {
585 if (phislice[etabin].used)
587 my_pt = phislice[etabin].
pTtot;
588 if (etabin > 0 && !phislice[etabin - 1].used) {
589 left_pt = phislice[etabin - 1].
pTtot;
592 if (etabin <
etaBins_ - 1 && !phislice[etabin + 1].used) {
593 right_pt = phislice[etabin + 1].
pTtot;
594 if (etabin <
etaBins_ - 2 && !phislice[etabin + 2].used) {
595 right2pt = phislice[etabin + 2].
pTtot;
602 if (my_pt < left_pt || my_pt <= right_pt) {
606 phislice[etabin - 1].
used =
true;
616 phislice[etabin].
used =
true;
622 if (my_pt >= right2pt && right_pt > 0) {
626 phislice[etabin + 1].
used =
true;
641 for (
int m1 =
m + 1; m1 <
nclust - 1; ++m1)
658 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
glbeta_intern makeGlbEta(float eta)
l1t::TkJetWord::nt_t ntracks
ap_int< 14+PHI_EXTRABITS > glbphi_intern
#define DEFINE_FWK_MODULE(type)
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)
std::vector< VertexWord > VertexWordCollection
bool getData(T &iHolder) const
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.
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)