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;
71 if (towerPhi1 == topTowerPhi) {
72 if (towerPhi2 == botTowerPhi) {
75 outputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].et =
one +
two;
76 outputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].et = 0;
78 outputCards[
i].RCTtoGCTfiber[
j].RCTclusters[
k].et = 0;
79 outputCards[
i + 1].RCTtoGCTfiber[j1].RCTclusters[k1].et =
one +
two;
111 isPositiveEta =
true;
117 isPositiveEta =
true;
123 isPositiveEta =
false;
129 isPositiveEta =
false;
163 dPhi = (phi1 > phi2) ? (phi1 - phi2) : (phi2 - phi1);
212 isPositiveEta =
true;
216 isPositiveEta =
false;
238 for (
int i1 = 0;
i1 < 4;
i1++) {
246 for (
int ic1 = 0; ic1 < 4; ic1++) {
262 for (
int i1 = 0;
i1 < 4;
i1++) {
270 for (
int ic1 = 0; ic1 < 4; ic1++) {
293 std::unique_ptr<l1tp2::CaloCrystalClusterCollection>
const& gctClustersOutput,
294 std::unique_ptr<l1tp2::CaloTowerCollection>
const& gctTowersOutput,
295 std::unique_ptr<l1t::EGammaBxCollection>
const& gctEGammas,
296 std::unique_ptr<l1tp2::DigitizedClusterCorrelatorCollection>
const& gctDigitizedClustersCorrelator,
297 std::unique_ptr<l1tp2::DigitizedTowerCorrelatorCollection>
const& gctDigitizedTowersCorrelator,
298 std::unique_ptr<l1tp2::DigitizedClusterGTCollection>
const& gctDigitizedClustersGT,
302 int corrFiberIndexOffset,
303 int corrTowPhiOffset = 4) {
304 for (
int i = fiberStart;
i < fiberEnd;
i++) {
309 if (thisCluster.
etFloat() > 0.0) {
316 gctEGammas->push_back(
bx, thisEGamma);
323 (thisCluster.
towPhi - corrTowPhiOffset);
327 if (thisCluster.
etFloat() > 0.0) {
332 if (thisCluster.
etFloat() > 0.0) {
343 gctTowersOutput->push_back(thisL1CaloTower);
351 gctDigitizedTowersCorrelator->push_back(thisDigitizedTowerCorrelator);
366 unsigned int nGCTCard,
367 std::unique_ptr<l1tp2::CaloCrystalClusterCollection>
const& gctClusters,
368 std::unique_ptr<l1tp2::CaloTowerCollection>
const& gctTowers,
369 std::unique_ptr<l1tp2::CaloTowerCollection>
const&
gctFullTowers,
370 std::unique_ptr<l1t::EGammaBxCollection>
const& gctEGammas,
371 std::unique_ptr<l1tp2::DigitizedClusterCorrelatorCollection>
const& gctDigitizedClustersCorrelator,
372 std::unique_ptr<l1tp2::DigitizedTowerCorrelatorCollection>
const& gctDigitizedTowersCorrelator,
373 std::unique_ptr<l1tp2::DigitizedClusterGTCollection>
const& gctDigitizedClustersGT,
405 int posEtaCorrelatorFiberIndexOffset = 4;
406 int negEtaCorrelatorFiberIndexOffset = 12;
409 int correlatorTowPhiOffset = 4;
417 gctDigitizedClustersCorrelator,
418 gctDigitizedTowersCorrelator,
419 gctDigitizedClustersGT,
423 posEtaCorrelatorFiberIndexOffset,
424 correlatorTowPhiOffset);
431 gctDigitizedClustersCorrelator,
432 gctDigitizedTowersCorrelator,
433 gctDigitizedClustersGT,
437 negEtaCorrelatorFiberIndexOffset,
438 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)