1 #ifndef PHASE_2_L1_GCT_H_INCL 2 #define PHASE_2_L1_GCT_H_INCL 25 ap_uint<5> towerPhi1 = inputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].towPhi;
27 ap_uint<15> crystalEta1 = inputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].towEta * 5 +
28 inputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].crEta;
29 ap_uint<15> crystalPhi1 = inputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].crPhi;
34 ap_uint<5> towerPhi2 = inputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].towPhi;
35 ap_uint<15> crystalEta2 = inputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].towEta * 5 +
36 inputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].crEta;
37 ap_uint<15> crystalPhi2 = inputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].crPhi;
41 dPhi = (isPositiveEta) ? ((5 - crystalPhi1) + crystalPhi2) : ((5 - crystalPhi2) + crystalPhi1);
43 dEta = (crystalEta1 > crystalEta2) ? (crystalEta1 - crystalEta2) : (crystalEta2 - crystalEta1);
45 ap_uint<12>
one = inputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].et;
46 ap_uint<12>
two = inputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].et;
48 int topTowerPhi = (isPositiveEta) ? 3 : 0;
49 int botTowerPhi = (isPositiveEta) ? 0 : 3;
51 int topCrystalPhi = (isPositiveEta) ? 4 : 0;
52 int botCrystalPhi = (isPositiveEta) ? 0 : 4;
56 if (towerPhi1 == topTowerPhi && crystalPhi1 == topCrystalPhi) {
57 if (towerPhi2 == botTowerPhi && crystalPhi2 == botCrystalPhi) {
60 outputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].et =
one +
two;
61 outputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].et = 0;
63 outputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].et = 0;
64 outputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].et =
one +
two;
72 if (towerPhi1 == topTowerPhi) {
73 if (towerPhi2 == botTowerPhi) {
78 outputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].et =
one +
two;
79 outputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].et = 0;
84 outputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].et = 0;
85 outputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].et =
one +
two;
118 isPositiveEta =
true;
124 isPositiveEta =
true;
130 isPositiveEta =
false;
136 isPositiveEta =
false;
170 dPhi = (phi1 > phi2) ? (phi1 - phi2) : (phi2 - phi1);
219 isPositiveEta =
true;
223 isPositiveEta =
false;
245 for (
int i1 = 0;
i1 < 4;
i1++) {
253 for (
int ic1 = 0; ic1 < 4; ic1++) {
269 for (
int i1 = 0;
i1 < 4;
i1++) {
277 for (
int ic1 = 0; ic1 < 4; ic1++) {
300 std::unique_ptr<l1tp2::CaloCrystalClusterCollection>
const& gctClustersOutput,
301 std::unique_ptr<l1tp2::CaloTowerCollection>
const& gctTowersOutput,
302 std::unique_ptr<l1t::EGammaBxCollection>
const& gctEGammas,
303 std::unique_ptr<l1tp2::DigitizedClusterCorrelatorCollection>
const& gctDigitizedClustersCorrelator,
304 std::unique_ptr<l1tp2::DigitizedTowerCorrelatorCollection>
const& gctDigitizedTowersCorrelator,
305 std::unique_ptr<l1tp2::DigitizedClusterGTCollection>
const& gctDigitizedClustersGT,
309 int corrFiberIndexOffset,
310 int corrTowPhiOffset = 4) {
311 for (
int i = fiberStart;
i < fiberEnd;
i++) {
316 if (thisCluster.
etFloat() > 0.0) {
323 gctEGammas->push_back(
bx, thisEGamma);
330 (thisCluster.
towPhi - corrTowPhiOffset);
334 if (thisCluster.
etFloat() > 0.0) {
339 if (thisCluster.
etFloat() > 0.0) {
350 gctTowersOutput->push_back(thisL1CaloTower);
358 gctDigitizedTowersCorrelator->push_back(thisDigitizedTowerCorrelator);
373 unsigned int nGCTCard,
374 std::unique_ptr<l1tp2::CaloCrystalClusterCollection>
const& gctClusters,
375 std::unique_ptr<l1tp2::CaloTowerCollection>
const& gctTowers,
376 std::unique_ptr<l1tp2::CaloTowerCollection>
const&
gctFullTowers,
377 std::unique_ptr<l1t::EGammaBxCollection>
const& gctEGammas,
378 std::unique_ptr<l1tp2::DigitizedClusterCorrelatorCollection>
const& gctDigitizedClustersCorrelator,
379 std::unique_ptr<l1tp2::DigitizedTowerCorrelatorCollection>
const& gctDigitizedTowersCorrelator,
380 std::unique_ptr<l1tp2::DigitizedClusterGTCollection>
const& gctDigitizedClustersGT,
412 int posEtaCorrelatorFiberIndexOffset = 4;
413 int negEtaCorrelatorFiberIndexOffset = 12;
416 int correlatorTowPhiOffset = 4;
424 gctDigitizedClustersCorrelator,
425 gctDigitizedTowersCorrelator,
426 gctDigitizedClustersGT,
430 posEtaCorrelatorFiberIndexOffset,
431 correlatorTowPhiOffset);
438 gctDigitizedClustersCorrelator,
439 gctDigitizedTowersCorrelator,
440 gctDigitizedClustersGT,
444 negEtaCorrelatorFiberIndexOffset,
445 correlatorTowPhiOffset);
GCTCorrfiber_t GCTCorrfiber[N_GCTCORR_FIBERS]
static constexpr int N_GCTCLUSTERS_FIBER
GCTtower_t GCTtower[N_GCTETA][N_GCTPHI]
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
RCTcluster_t RCTclusters[N_RCTCLUSTERS_FIBER]
l1tp2::CaloCrystalCluster createCaloCrystalCluster(void) const
GCTCorrfiber_t GCTCorrfiber[N_GCTINTERNAL_FIBERS]
static constexpr int N_GCTPOSITIVE_FIBERS
static constexpr int N_GCTTOWERS_FIBER
void setIsolationInfo(void)
RCTtower_t RCTtowers[N_RCTTOWERS_FIBER]
GCTcluster_t GCTclusters[N_GCTCLUSTERS_FIBER]
l1t::EGamma createL1TEGamma(void) const
void computeClusterIsolationInPlace(int nGCTCard)
RCTcard_t RCTcardEtaNeg[N_RCTCARDS_PHI]
static constexpr int N_RCTCARDS_PHI
l1tp2::DigitizedClusterGT createDigitizedClusterGT(bool isValid) const
static constexpr int N_RCTTOWERS_FIBER
GCTcard_t getClustersCombined(const GCTcard_t &GCTcard, unsigned int nGCTCard)
static constexpr int N_RCTGCT_FIBERS
static constexpr int N_RCTCLUSTERS_FIBER
l1tp2::DigitizedClusterCorrelator createDigitizedClusterCorrelator(const int corrTowPhiOffset) const
l1tp2::CaloTower createCaloTowerFromFiberIdx(int nGCTCard, int iFiber, int iTowerInFiber)
static constexpr int N_GCTINTERNAL_FIBERS
GCTintTowers_t getFullTowers(const GCTinternal_t &GCTinternal)
void writeToCorrelatorAndGTOutputs(const GCTinternal_t &GCTinternal, GCTtoCorr_t &GCTtoCorrOutput, std::unique_ptr< l1tp2::CaloCrystalClusterCollection > const &gctClustersOutput, std::unique_ptr< l1tp2::CaloTowerCollection > const &gctTowersOutput, std::unique_ptr< l1t::EGammaBxCollection > const &gctEGammas, std::unique_ptr< l1tp2::DigitizedClusterCorrelatorCollection > const &gctDigitizedClustersCorrelator, std::unique_ptr< l1tp2::DigitizedTowerCorrelatorCollection > const &gctDigitizedTowersCorrelator, std::unique_ptr< l1tp2::DigitizedClusterGTCollection > const &gctDigitizedClustersGT, int nGCTCard, int fiberStart, int fiberEnd, int corrFiberIndexOffset, int corrTowPhiOffset)
void doProximityAndBremsStitching(const RCTcard_t(&inputCards)[N_RCTCARDS_PHI], RCTcard_t(&outputCards)[N_RCTCARDS_PHI], int iStartingCard, bool isPositiveEta)
static constexpr int N_GCTETA
void initFromRCTCluster(int iRCTcardIndex, bool isPosEta, const RCTcluster_t &rctCluster)
RCTtoGCTfiber_t RCTtoGCTfiber[N_RCTGCT_FIBERS]
RCTcard_t RCTcardEtaPos[N_RCTCARDS_PHI]
l1tp2::DigitizedTowerCorrelator createDigitizedTowerCorrelator(unsigned int indexCard, unsigned int indexFiber, unsigned int indexTower)
GCTtower_t GCTtowers[N_GCTTOWERS_FIBER]
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
GCTinternal_t getClustersTowers(const GCTcard_t &GCTcard, unsigned int nGCTCard)
void writeToPFOutput(int nGCTCard, std::unique_ptr< l1tp2::CaloTowerCollection > const &gctFullTowers)
void algo_top(const GCTcard_t &GCTcard, GCTtoCorr_t &GCTtoCorr, unsigned int nGCTCard, std::unique_ptr< l1tp2::CaloCrystalClusterCollection > const &gctClusters, std::unique_ptr< l1tp2::CaloTowerCollection > const &gctTowers, std::unique_ptr< l1tp2::CaloTowerCollection > const &gctFullTowers, std::unique_ptr< l1t::EGammaBxCollection > const &gctEGammas, std::unique_ptr< l1tp2::DigitizedClusterCorrelatorCollection > const &gctDigitizedClustersCorrelator, std::unique_ptr< l1tp2::DigitizedTowerCorrelatorCollection > const &gctDigitizedTowersCorrelator, std::unique_ptr< l1tp2::DigitizedClusterGTCollection > const &gctDigitizedClustersGT, l1tp2::ParametricCalibration calib_)
void initFromRCTTower(const RCTtower_t &rctTower)