123 auto L1EGXtalClusters = std::make_unique<l1tp2::CaloCrystalClusterCollection>();
124 auto L1CaloTowers = std::make_unique<l1tp2::CaloTowerCollection>();
132 std::vector<p2eg::SimpleCaloHit> ecalhits;
134 for (
const auto&
hit : *pcalohits.product()) {
135 if (
hit.encodedEt() > 0)
152 ecalhits.push_back(ehit);
159 std::vector<p2eg::SimpleCaloHit> hcalhits;
164 float et = decoder.hcaletValue(
hit.
id(),
hit.t0());
165 ap_uint<10> encodedEt =
hit.t0().compressedEt();
171 LogError(
"Phase2L1CaloEGammaEmulator")
172 <<
" -- Hcal hit DetID not present in HCAL Geom: " <<
hit.
id() << std::endl;
176 const std::vector<HcalDetId>& hcId = theTrigTowerGeometry.detIds(
hit.
id());
178 LogError(
"Phase2L1CaloEGammaEmulator") <<
"Cannot find any HCalDetId corresponding to " <<
hit.
id() << std::endl;
182 if (hcId[0].subdetId() > 1) {
186 for (
const auto& hcId_i : hcId) {
187 if (hcId_i.subdetId() > 1) {
192 if (cell ==
nullptr) {
196 hcal_tp_position = tmpVector;
207 hcalhits.push_back(hhit);
232 for (
const auto&
hit : ecalhits) {
234 if (
hit.isInCard(
cc)) {
237 int local_iEta =
hit.crystalLocaliEta(
cc);
238 int local_iPhi =
hit.crystalLocaliPhi(
cc);
253 int inRegion_crystal_iPhi = local_iPhi;
262 myLink.
addCrystalE(inLink_crystal_iEta, inLink_crystal_iPhi,
hit.et_uint());
269 for (
const auto&
hit : hcalhits) {
270 if (
hit.isInCard(
cc) &&
hit.pt() > 0) {
273 int local_iEta =
hit.crystalLocaliEta(
cc);
274 int local_iPhi =
hit.crystalLocaliPhi(
cc);
339 cluster_list[
cc].push_back(newCluster);
344 ap_uint<12> towerEtECAL[12];
348 for (
int i = 0;
i < 12;
i++) {
358 towerHCALCard[
iEta][iPhi][
cc] =
369 int towerEtaBoundaries[nRegionBoundariesEta][2] = {{15, 14}, {12, 11}, {9, 8}, {6, 5}, {3, 2}};
371 for (
int iBound = 0; iBound < nRegionBoundariesEta; iBound++) {
373 cluster_list[
cc], towerEtaBoundaries[iBound][0], towerEtaBoundaries[iBound][1],
cc);
379 if (!cluster_list[
cc].
empty()) {
389 int whichTowerPhiInCard = cExtra.
towerPhi();
390 ap_uint<12> oldTowerEt = towerECALCard[whichTowerEtaInCard][whichTowerPhiInCard][
cc].
et();
391 ap_uint<12> newTowerEt = (oldTowerEt + cExtra.
clusterEnergy());
392 ap_uint<4>
hoe = towerECALCard[whichTowerEtaInCard][whichTowerPhiInCard][
cc].
hoe();
393 towerECALCard[whichTowerEtaInCard][whichTowerPhiInCard][
cc] =
p2eg::tower_t(newTowerEt,
hoe);
398 for (
unsigned int kk = 0;
kk < cluster_list[
cc].size(); ++
kk) {
401 if (cluster_list[
cc][
kk].clusterEnergy() > 0) {
402 cluster_list_merged[
cc].push_back(cluster_list[
cc][
kk]);
410 for (
auto&
c : cluster_list_merged[
cc]) {
411 float realEta =
c.realEta(
cc);
413 c.applyCalibration(
c.calib);
419 for (
auto&
c : cluster_list_merged[
cc]) {
441 ap_uint<12> ecalEt = towerECALCard[
ii][
jj][
cc].
et();
442 ap_uint<12> hcalEt = towerHCALCard[
ii][
jj][
cc].
et();
450 for (
auto&
c : cluster_list_merged[
cc]) {
473 std::map<std::string, float>
params;
474 params[
"standaloneWP_showerShape"] =
c.getIsSS();
475 params[
"trkMatchWP_showerShape"] =
c.getIsLooseTkss();
476 cluster.setExperimentalParams(
params);
478 L1EGXtalClusters->push_back(cluster);
496 L1CaloTowers->push_back(l1CaloTower);
529 t.hoe = t0_ecal.
hoe();
531 t.ecalEt = t0_ecal.
et();
532 t.hcalEt = t0_hcal.
et();
543 for (
size_t iCluster = 0; (iCluster < cluster_list_merged[rcc].size()) &&
548 c.et =
c0.clusterEnergy();
552 c.towPhi =
c0.towerPhi();
553 c.crEta =
c0.clusterEta();
554 c.crPhi =
c0.clusterPhi();
555 c.et5x5 =
c0.uint_et5x5();
556 c.et2x5 =
c0.uint_et2x5();
557 c.is_ss =
c0.getIsSS();
558 c.is_looseTkss =
c0.getIsLooseTkss();
559 c.is_iso =
c0.getIsIso();
560 c.is_looseTkiso =
c0.getIsLooseTkIso();
561 c.brems =
c0.getBrems();
574 for (
size_t iZeroCluster = cluster_list_merged[rcc].
size();
606 auto L1GCTClusters = std::make_unique<l1tp2::CaloCrystalClusterCollection>();
607 auto L1GCTTowers = std::make_unique<l1tp2::CaloTowerCollection>();
608 auto L1GCTFullTowers = std::make_unique<l1tp2::CaloTowerCollection>();
609 auto L1GCTEGammas = std::make_unique<l1t::EGammaBxCollection>();
610 auto L1DigitizedClusterCorrelator = std::make_unique<l1tp2::DigitizedClusterCorrelatorCollection>();
611 auto L1DigitizedTowerCorrelator = std::make_unique<l1tp2::DigitizedTowerCorrelatorCollection>();
612 auto L1DigitizedClusterGT = std::make_unique<l1tp2::DigitizedClusterGTCollection>();
626 L1DigitizedClusterCorrelator,
627 L1DigitizedTowerCorrelator,
628 L1DigitizedClusterGT,
636 iEvent.put(
std::move(L1DigitizedClusterCorrelator),
"GCTDigitizedClusterToCorrelator");
637 iEvent.put(
std::move(L1DigitizedTowerCorrelator),
"GCTDigitizedTowerToCorrelator");
638 iEvent.put(
std::move(L1DigitizedClusterGT),
"GCTDigitizedClusterToGT");
void applyCalibration(float factor)
bool validHT(const HcalTrigTowerDetId &id) const
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > decoderTag_
void getECALTowersEt(crystal tempX[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI], ap_uint< 12 > towerEt[12])
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
RCTcluster_t RCTclusters[N_RCTCLUSTERS_FIBER]
void setEcalTowerEt(float et)
uint32_t cc[maxCellsPerHit]
linkECAL & getLinkECAL(int iEta, int iPhi)
void setTowerIPhi(int iPhi)
T const * product() const
void setIdHcal(const HcalDetId &idhcal)
static constexpr int n_clusters_4link
void setPosition(const GlobalVector &pos)
void addCrystalE(int iEta, int iPhi, ap_uint< 10 > energy)
void setRegionIdx(int regIdx)
static constexpr int N_GCTTOWERS_FIBER
int getAbsID_iPhi_fromFirmwareCardTowerLink(int nCard, int nTower, int nLink)
const CaloSubdetectorGeometry * hbGeometry
Log< level::Error, false > LogError
l1tp2::ParametricCalibration calib_
static constexpr int N_REGIONS_PER_CARD
static constexpr int N_CLUSTERS_PER_REGION
RCTtower_t RCTtowers[N_RCTTOWERS_FIBER]
edm::EDGetTokenT< edm::SortedCollection< HcalTriggerPrimitiveDigi > > hcalTPToken_
void setHcalTowerEt(float et)
static constexpr int CRYSTAL_IN_ETA
void setTowerIEta(int iEta)
float getTowerPhi_fromAbsID(int id)
bool passes_ss(float pt, float ss)
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hbTopologyTag_
Cluster getClusterFromRegion3x4(crystal temp[CRYSTAL_IN_ETA][CRYSTAL_IN_PHI])
void setTowerPhi(float phi)
edm::EDGetTokenT< EcalEBTrigPrimDigiCollection > ecalTPEBToken_
ap_uint< 5 > towerEta() const
static constexpr float HCAL_LSB
RCTcard_t RCTcardEtaNeg[N_RCTCARDS_PHI]
float getTowerEta_fromAbsID(int id)
static constexpr int N_RCTCARDS_PHI
towerHCAL & getTowerHCAL(int iEta, int iPhi)
static constexpr float ECAL_LSB
const CaloSubdetectorGeometry * ebGeometry
Abs< T >::type abs(const T &t)
static constexpr int n_towers_cardPhi
static constexpr int N_RCTGCT_FIBERS
static constexpr int N_RCTCLUSTERS_FIBER
void stitchClusterOverRegionBoundary(std::vector< Cluster > &cluster_list, int towerEtaUpper, int towerEtaLower, int cc)
int getRegionNumber(const int local_iEta)
static constexpr float cut_500_MeV
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
void setTowerEta(float eta)
void addEt(ap_uint< 10 > newEt)
static constexpr int TOWER_IN_PHI
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryTag_
ap_uint< 10 > getCrystalE(int iEta, int iPhi)
static constexpr int TOWER_IN_ETA
static constexpr int N_GCTCARDS
ap_uint< 2 > towerPhi() const
region3x4 & getRegion3x4(int idx)
void getHoverE(ap_uint< 12 > ECAL, ap_uint< 12 > HCAL_inHcalConvention)
void setEt_uint(ap_uint< 10 > et_uint)
RCTtoGCTfiber_t RCTtoGCTfiber[N_RCTGCT_FIBERS]
void setId(const EBDetId &id)
bool passes_looseTkss(float pt, float ss)
RCTcard_t RCTcardEtaPos[N_RCTCARDS_PHI]
ap_uint< 12 > clusterEnergy() const
towers3x4 & getTowers3x4(int idx)
static constexpr int CRYSTALS_IN_TOWER_ETA
static constexpr int n_towers_halfPhi
static constexpr int n_towers_cardEta
static constexpr int n_links_card
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_)
const HcalTopology * hcTopology_
ap_uint< 12 > convertHcalETtoEcalET(ap_uint< 12 > HCAL)
static constexpr int CRYSTAL_IN_PHI
static constexpr int CRYSTALS_IN_TOWER_PHI
Global3DVector GlobalVector
int getAbsID_iEta_fromFirmwareCardTowerLink(int nCard, int nTower, int nLink)
bool compareClusterET(const Cluster &lhs, const Cluster &rhs)
static const unsigned int GCTcardtoRCTcardnumber[N_GCTCARDS][N_RCTCARDS_PHI *2]
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.