Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tower eta & phi when running standalone configuration #479

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/interface/backend/HGCalTowerMap_SA.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace l1thgcfirmware {
class HGCalTowerMap {
public:
HGCalTowerMap(){};
HGCalTowerMap(const std::vector<unsigned short>& tower_ids);
HGCalTowerMap(const std::vector<l1thgcfirmware::HGCalTowerCoord>& tower_ids);

~HGCalTowerMap(){};

Expand Down
25 changes: 22 additions & 3 deletions L1Trigger/L1THGCal/interface/backend/HGCalTower_SA.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#ifndef L1Trigger_L1THGCal_HGCalTower_SA_h
#define L1Trigger_L1THGCal_HGCalTower_SA_h

#include <cstdint>

namespace l1thgcfirmware {

class HGCalTower {
public:
HGCalTower() {}
HGCalTower(double etEm, double etHad) : etEm_(etEm), etHad_(etHad) {}
HGCalTower(double etEm, double etHad, float eta, float phi, uint32_t rawId)
: etEm_(etEm), etHad_(etHad), eta_(eta), phi_(phi), id_(rawId) {}

~HGCalTower(){};

double etEm() const { return etEm_; };
double etHad() const { return etHad_; };
double etEm() const { return etEm_; }
double etHad() const { return etHad_; }

float eta() const { return eta_; }
float phi() const { return phi_; }
uint32_t id() const { return id_; }

void addEtEm(double et);
void addEtHad(double et);
Expand All @@ -21,6 +28,18 @@ namespace l1thgcfirmware {
private:
double etEm_;
double etHad_;

float eta_;
float phi_;
uint32_t id_;
};

struct HGCalTowerCoord {
HGCalTowerCoord(uint32_t rawId, float eta, float phi) : rawId(rawId), eta(eta), phi(phi) {}

const uint32_t rawId;
const float eta;
const float phi;
};
} // namespace l1thgcfirmware

Expand Down
8 changes: 4 additions & 4 deletions L1Trigger/L1THGCal/plugins/backend/HGCalTowerMapsWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ HGCalTowerMapsWrapper::HGCalTowerMapsWrapper(const edm::ParameterSet& conf) : HG
void HGCalTowerMapsWrapper::convertCMSSWInputs(const std::vector<edm::Ptr<l1t::HGCalTowerMap>>& inputTowerMaps,
std::vector<l1thgcfirmware::HGCalTowerMap>& towerMaps_SA) const {
for (const auto& map : inputTowerMaps) {
std::vector<unsigned short> tower_ids;
std::vector<l1thgcfirmware::HGCalTowerCoord> tower_ids;
for (const auto& tower : map->towers()) {
tower_ids.push_back(tower.first);
tower_ids.emplace_back(tower.first, tower.second.eta(), tower.second.phi());
}

l1thgcfirmware::HGCalTowerMap towerMapSA(tower_ids);
Expand All @@ -60,8 +60,8 @@ void HGCalTowerMapsWrapper::convertCMSSWInputs(const std::vector<edm::Ptr<l1t::H
void HGCalTowerMapsWrapper::convertAlgorithmOutputs(const std::vector<l1thgcfirmware::HGCalTower>& towers_SA,
l1t::HGCalTowerBxCollection& outputTowerMaps) const {
for (const auto& towerSA : towers_SA) {
// Need to carry eta, phi, ID through the SA emulation
outputTowerMaps.push_back(0, l1t::HGCalTower(towerSA.etEm(), towerSA.etHad(), 0, 0, 0));
outputTowerMaps.push_back(
0, l1t::HGCalTower(towerSA.etEm(), towerSA.etHad(), towerSA.eta(), towerSA.phi(), towerSA.id()));
}
}

Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1THGCal/src/backend/HGCalTowerMapImpl_SA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ void HGCalTowerMapImplSA::runAlgorithm(const std::vector<HGCalTowerMap>& inputTo
// Need better way to initialise the output tower map
if (inputTowerMaps_SA.empty())
return;
std::vector<unsigned short> tower_ids;
std::vector<HGCalTowerCoord> tower_ids;
for (const auto& tower : inputTowerMaps_SA.front().towers()) {
tower_ids.push_back(tower.first);
tower_ids.emplace_back(tower.first, tower.second.eta(), tower.second.phi());
}
HGCalTowerMap towerMap(tower_ids);

Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1THGCal/src/backend/HGCalTowerMap_SA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

using namespace l1thgcfirmware;

HGCalTowerMap::HGCalTowerMap(const std::vector<unsigned short>& tower_ids) {
HGCalTowerMap::HGCalTowerMap(const std::vector<l1thgcfirmware::HGCalTowerCoord>& tower_ids) {
for (const auto tower_id : tower_ids) {
towerMap_[tower_id] = l1thgcfirmware::HGCalTower(0., 0.);
towerMap_[tower_id.rawId] = l1thgcfirmware::HGCalTower(0., 0., tower_id.eta, tower_id.phi, tower_id.rawId);
}
}

Expand Down