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;
246 for (
int i1 = 0;
i1 < 4;
i1++) {
252 for (
int ic1 = 0; ic1 < 4; ic1++) {
268 for (
int i1 = 0;
i1 < 4;
i1++) {
274 for (
int ic1 = 0; ic1 < 4; ic1++) {
297 std::unique_ptr<l1tp2::CaloCrystalClusterCollection>
const& gctClustersOutput,
298 std::unique_ptr<l1tp2::CaloTowerCollection>
const& gctTowersOutput,
299 std::unique_ptr<l1t::EGammaBxCollection>
const& gctEGammas,
300 std::unique_ptr<l1tp2::DigitizedClusterCorrelatorCollection>
const& gctDigitizedClustersCorrelator,
301 std::unique_ptr<l1tp2::DigitizedTowerCorrelatorCollection>
const& gctDigitizedTowersCorrelator,
302 std::unique_ptr<l1tp2::DigitizedClusterGTCollection>
const& gctDigitizedClustersGT,
306 int corrFiberIndexOffset,
307 int corrTowPhiOffset = 4) {
308 for (
int i = fiberStart;
i < fiberEnd;
i++) {
313 if (thisCluster.
etFloat() > 0.0) {
320 gctEGammas->push_back(
bx, thisEGamma);
327 (thisCluster.
towPhi - corrTowPhiOffset);
331 if (thisCluster.
etFloat() > 0.0) {
336 if (thisCluster.
etFloat() > 0.0) {
347 gctTowersOutput->push_back(thisL1CaloTower);
355 gctDigitizedTowersCorrelator->push_back(thisDigitizedTowerCorrelator);
370 unsigned int nGCTCard,
371 std::unique_ptr<l1tp2::CaloCrystalClusterCollection>
const& gctClusters,
372 std::unique_ptr<l1tp2::CaloTowerCollection>
const& gctTowers,
373 std::unique_ptr<l1tp2::CaloTowerCollection>
const& gctFullTowers,
374 std::unique_ptr<l1t::EGammaBxCollection>
const& gctEGammas,
375 std::unique_ptr<l1tp2::DigitizedClusterCorrelatorCollection>
const& gctDigitizedClustersCorrelator,
376 std::unique_ptr<l1tp2::DigitizedTowerCorrelatorCollection>
const& gctDigitizedTowersCorrelator,
377 std::unique_ptr<l1tp2::DigitizedClusterGTCollection>
const& gctDigitizedClustersGT,
409 int posEtaCorrelatorFiberIndexOffset = 4;
410 int negEtaCorrelatorFiberIndexOffset = 12;
413 int correlatorTowPhiOffset = 4;
421 gctDigitizedClustersCorrelator,
422 gctDigitizedTowersCorrelator,
423 gctDigitizedClustersGT,
427 posEtaCorrelatorFiberIndexOffset,
428 correlatorTowPhiOffset);
435 gctDigitizedClustersCorrelator,
436 gctDigitizedTowersCorrelator,
437 gctDigitizedClustersGT,
441 negEtaCorrelatorFiberIndexOffset,
442 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]
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)