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";
254 enum TrackBitWidths {
263 const int nz =
zBins_ + 1;
266 for (
int z = 0;
z < nz; ++
z)
267 all_zBins[
z] = mzbtemp;
300 for (
int zbin = 0; zbin <
zBins_; ++zbin) {
304 epbins[
i][
j].
used =
false;
308 L1clusters[
i] = epbins[
i];
312 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize, AP_RND_CONV, AP_SAT> inputTrkPt = 0;
313 inputTrkPt.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1,
314 TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
317 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize, AP_RND_CONV, AP_SAT> trketainput = 0;
318 trketainput.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kTanlMSB,
319 TTTrack_TrackWord::TrackBitLocations::kTanlLSB);
320 ap_ufixed<64 + ETA_EXTRABITS, 32 + ETA_EXTRABITS> eta_conv =
333 ap_fixed<TrackBitWidths::kPhiSize, TrackBitWidths::kPhiMagSize, AP_RND_CONV, AP_SAT> trkphiinput = 0;
334 trkphiinput.V =
L1TrkPtrs_[
k]->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kPhiMSB,
335 TTTrack_TrackWord::TrackBitLocations::kPhiLSB);
336 ap_ufixed<64 + PHI_EXTRABITS, 32 + PHI_EXTRABITS> phi_conv =
338 (1 << (TrackBitWidths::kPhiSize - TrackBitWidths::kPhiMagSize));
343 ap_int<TTTrack_TrackWord::TrackBitWidths::kZ0Size> inputTrkZ0 =
L1TrkPtrs_[
k]->getTrackWord()(
344 TTTrack_TrackWord::TrackBitLocations::kZ0MSB, TTTrack_TrackWord::TrackBitLocations::kZ0LSB);
345 ap_ufixed<32 + Z0_EXTRABITS, 1 + Z0_EXTRABITS> z0_conv =
351 L2cluster[
k] = epbins[
i][
j];
352 if ((zmin <= trkZ && zmax >= trkZ) &&
369 for (
int phislice = 0; phislice <
phiBins_; ++phislice) {
370 L1clusters[phislice] =
L1_cluster(epbins[phislice]);
371 for (
int ind = 0; L1clusters[phislice][ind].
pTtot != 0; ++ind) {
372 L1clusters[phislice][ind].
used =
false;
388 int used1, used2, used3, used4;
390 for (phibin = 0; phibin <
phiBins_; ++phibin) {
393 for (index1 = 0; L1clusters[phibin][index1].
pTtot > 0; ++index1) {
394 if (!L1clusters[phibin][index1].used && L1clusters[phibin][index1].pTtot >= hipT) {
395 hipT = L1clusters[phibin][index1].
pTtot;
409 L2cluster[
nclust] = L1clusters[phibin][imax];
411 L1clusters[phibin][imax].
used =
true;
417 for (index1 = 0; L1clusters[phibin + 1][index1].
pTtot != 0; ++index1) {
418 if (L1clusters[phibin + 1][index1].used)
420 if (L1clusters[phibin + 1][index1].
eta - L1clusters[phibin][imax].
eta <= 3 *
etaStep_ / 2 &&
421 L1clusters[phibin][imax].
eta - L1clusters[phibin + 1][index1].
eta <= 3 *
etaStep_ / 2) {
422 E1 += L1clusters[phibin + 1][index1].
pTtot;
423 ntrk1 += L1clusters[phibin + 1][index1].
ntracks;
424 nxtrk1 += L1clusters[phibin + 1][index1].
nxtracks;
437 L1clusters[phibin + 1][used1].
used =
true;
439 L1clusters[phibin + 1][used2].
used =
true;
447 for (index1 = 0; L1clusters[phibin + 2][index1].
pTtot != 0; ++index1) {
448 if (L1clusters[phibin + 2][index1].used)
450 if (L1clusters[phibin + 2][index1].
eta - L1clusters[phibin][imax].
eta <= 3 *
etaStep_ / 2 &&
451 L1clusters[phibin][imax].
eta - L1clusters[phibin + 2][index1].
eta <= 3 *
etaStep_ / 2) {
452 E2 += L1clusters[phibin + 2][index1].
pTtot;
453 ntrk2 += L1clusters[phibin + 2][index1].
ntracks;
454 nxtrk2 += L1clusters[phibin + 2][index1].
nxtracks;
467 L2cluster[
nclust].
phi = L1clusters[phibin + 1][used1].
phi;
469 L1clusters[phibin + 1][used1].
used =
true;
471 L1clusters[phibin + 1][used2].
used =
true;
473 L1clusters[phibin + 2][used3].
used =
true;
475 L1clusters[phibin + 2][used4].
used =
true;
484 L2cluster[
nclust].
phi = L1clusters[phibin + 1][used1].
phi;
486 L1clusters[phibin + 1][used1].
used =
true;
488 L1clusters[phibin + 1][used2].
used =
true;
494 L1clusters[phibin][imax].
used =
true;
500 for (phibin = 0; phibin <
phiBins_; ++phibin)
501 delete[] L1clusters[phibin];
506 if (L2cluster[
n].
eta == L2cluster[
m].
eta &&
511 if (L2cluster[
n].pTtot > L2cluster[
m].pTtot) {
512 L2cluster[
m].
phi = L2cluster[
n].
phi;
517 for (
int m1 =
n; m1 <
nclust - 1; ++m1) {
518 L2cluster[m1] = L2cluster[m1 + 1];
540 all_zBins[zbin].
znum = zbin;
551 all_zBins[zbin].
ht = ht;
553 mzb = all_zBins[zbin];
561 for (
int zbin = 0; zbin <
zBins_; ++zbin) {
562 if (zbin == mzb.
znum) {
571 for (
int etabin = 0; etabin <
etaBins_ / 2; ++etabin) {
581 edm::LogWarning(
"L1TrackJetEmulationProducer") <<
"Clusters memory not assigned!\n";
584 pt_intern my_pt, left_pt, right_pt, right2pt;
587 for (
int etabin = 0; etabin <
etaBins_; ++etabin) {
589 if (phislice[etabin].used)
591 my_pt = phislice[etabin].
pTtot;
592 if (etabin > 0 && !phislice[etabin - 1].used) {
593 left_pt = phislice[etabin - 1].
pTtot;
596 if (etabin <
etaBins_ - 1 && !phislice[etabin + 1].used) {
597 right_pt = phislice[etabin + 1].
pTtot;
598 if (etabin <
etaBins_ - 2 && !phislice[etabin + 2].used) {
599 right2pt = phislice[etabin + 2].
pTtot;
606 if (my_pt < left_pt || my_pt <= right_pt) {
610 phislice[etabin - 1].
used =
true;
620 phislice[etabin].
used =
true;
626 if (my_pt >= right2pt && right_pt > 0) {
630 phislice[etabin + 1].
used =
true;
645 for (
int m1 =
m + 1; m1 <
nclust - 1; ++m1)
662 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
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
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)