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

[HGCAL trigger] Motherboard description and BestChoice updates. Sim clustering. #26820

Merged
merged 6 commits into from May 31, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions DataFormats/L1THGCal/interface/HGCalClusterT.h
Expand Up @@ -91,6 +91,7 @@ namespace l1t {
double mipPt() const { return mipPt_; }
double seedMipPt() const { return seedMipPt_; }
uint32_t detId() const { return detId_.rawId(); }
void setDetId(uint32_t id) { detId_ = id; }
void setPt(double pt) { setP4(math::PtEtaPhiMLorentzVector(pt, eta(), phi(), mass())); }
double sumPt() const { return sumPt_; }
/* distance in 'cm' */
Expand Down
4 changes: 4 additions & 0 deletions L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h
Expand Up @@ -80,11 +80,15 @@ class HGCalTriggerGeometryBase {

virtual geom_set getNeighborsFromTriggerCell(const unsigned trigger_cell_det_id) const = 0;

virtual unsigned getLinksInModule(const unsigned module_id) const = 0;
virtual unsigned getModuleSize(const unsigned module_id) const = 0;

virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const = 0;
virtual GlobalPoint getModulePosition(const unsigned module_det_id) const = 0;

virtual bool validTriggerCell(const unsigned trigger_cell_id) const = 0;
virtual bool disconnectedModule(const unsigned module_id) const = 0;
virtual unsigned lastTriggerLayer() const = 0;
virtual unsigned triggerLayer(const unsigned id) const = 0;

protected:
Expand Down
Expand Up @@ -123,11 +123,15 @@ class HGCalTriggerGeometryGenericMapping : public HGCalTriggerGeometryBase {

geom_set getNeighborsFromTriggerCell(const unsigned trigger_cell_det_id) const final;

unsigned getLinksInModule(const unsigned module_id) const final;
unsigned getModuleSize(const unsigned module_id) const final;

GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const final;
GlobalPoint getModulePosition(const unsigned module_det_id) const final;

bool validTriggerCell(const unsigned trigger_cell_det_id) const final;
bool disconnectedModule(const unsigned module_id) const final;
unsigned lastTriggerLayer() const final;
unsigned triggerLayer(const unsigned id) const final;

protected:
Expand Down
@@ -0,0 +1,30 @@
#ifndef __L1Trigger_L1THGCal_HGCalConcentratorBestChoiceImpl_h__
#define __L1Trigger_L1THGCal_HGCalConcentratorBestChoiceImpl_h__

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
#include <vector>

class HGCalConcentratorBestChoiceImpl {
public:
HGCalConcentratorBestChoiceImpl(const edm::ParameterSet& conf);

void select(unsigned nLinks,
unsigned nWafers,
const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }

private:
std::vector<unsigned> nData_;
static const unsigned kNDataSize_ = 64;
static const uint32_t kWaferOffset_ = 3;
static const uint32_t kWaferMask_ = 0x7;
static const uint32_t kLinkMask_ = 0x7;

HGCalTriggerTools triggerTools_;
};

#endif
Expand Up @@ -2,7 +2,8 @@
#define __L1Trigger_L1THGCal_HGCalConcentratorProcessorSelection_h__

#include "L1Trigger/L1THGCal/interface/HGCalProcessorBase.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorSelectionImpl.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorThresholdImpl.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorBestChoiceImpl.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorSuperTriggerCellImpl.h"

#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
Expand All @@ -23,8 +24,9 @@ class HGCalConcentratorProcessorSelection : public HGCalConcentratorProcessorBas
private:
SelectionType selectionType_;

std::unique_ptr<HGCalConcentratorSelectionImpl> concentratorProcImpl_;
std::unique_ptr<HGCalConcentratorSuperTriggerCellImpl> concentratorSTCImpl_;
std::unique_ptr<HGCalConcentratorThresholdImpl> thresholdImpl_;
std::unique_ptr<HGCalConcentratorBestChoiceImpl> bestChoiceImpl_;
std::unique_ptr<HGCalConcentratorSuperTriggerCellImpl> superTriggerCellImpl_;

HGCalTriggerTools triggerTools_;
};
Expand Down

This file was deleted.

Expand Up @@ -2,15 +2,9 @@
#define __L1Trigger_L1THGCal_HGCalConcentratorSuperTriggerCellImpl_h__

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"

#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"
#include "DataFormats/ForwardDetId/interface/HGCSiliconDetIdToROC.h"

#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"

#include <array>
#include <vector>

class HGCalConcentratorSuperTriggerCellImpl {
Expand Down
@@ -0,0 +1,25 @@
#ifndef __L1Trigger_L1THGCal_HGCalConcentratorThresholdImpl_h__
#define __L1Trigger_L1THGCal_HGCalConcentratorThresholdImpl_h__

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
#include <vector>

class HGCalConcentratorThresholdImpl {
public:
HGCalConcentratorThresholdImpl(const edm::ParameterSet& conf);

void select(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }

private:
double threshold_silicon_;
double threshold_scintillator_;

HGCalTriggerTools triggerTools_;
};

#endif
Expand Up @@ -10,13 +10,13 @@ HGCalConcentratorProcessorSelection::HGCalConcentratorProcessorSelection(const e
std::string selectionType(conf.getParameter<std::string>("Method"));
if (selectionType == "thresholdSelect") {
selectionType_ = thresholdSelect;
concentratorProcImpl_ = std::make_unique<HGCalConcentratorSelectionImpl>(conf);
thresholdImpl_ = std::make_unique<HGCalConcentratorThresholdImpl>(conf);
} else if (selectionType == "bestChoiceSelect") {
selectionType_ = bestChoiceSelect;
concentratorProcImpl_ = std::make_unique<HGCalConcentratorSelectionImpl>(conf);
bestChoiceImpl_ = std::make_unique<HGCalConcentratorBestChoiceImpl>(conf);
} else if (selectionType == "superTriggerCellSelect") {
selectionType_ = superTriggerCellSelect;
concentratorSTCImpl_ = std::make_unique<HGCalConcentratorSuperTriggerCellImpl>(conf);
superTriggerCellImpl_ = std::make_unique<HGCalConcentratorSuperTriggerCellImpl>(conf);
} else {
throw cms::Exception("HGCTriggerParameterError")
<< "Unknown type of concentrator selection '" << selectionType << "'";
Expand All @@ -26,29 +26,34 @@ HGCalConcentratorProcessorSelection::HGCalConcentratorProcessorSelection(const e
void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTriggerCellBxCollection>& triggerCellCollInput,
l1t::HGCalTriggerCellBxCollection& triggerCellCollOutput,
const edm::EventSetup& es) {
if (concentratorProcImpl_)
concentratorProcImpl_->eventSetup(es);
if (thresholdImpl_)
thresholdImpl_->eventSetup(es);
if (bestChoiceImpl_)
bestChoiceImpl_->eventSetup(es);
if (superTriggerCellImpl_)
superTriggerCellImpl_->eventSetup(es);
const l1t::HGCalTriggerCellBxCollection& collInput = *triggerCellCollInput;

std::unordered_map<uint32_t, std::vector<l1t::HGCalTriggerCell>> tc_modules;
for (const auto& trigCell : collInput) {
uint32_t module = geometry_->getModuleFromTriggerCell(trigCell.detId());
tc_modules[module].push_back(trigCell);
}
if (concentratorSTCImpl_)
concentratorSTCImpl_->eventSetup(es);

for (const auto& module_trigcell : tc_modules) {
std::vector<l1t::HGCalTriggerCell> trigCellVecOutput;
switch (selectionType_) {
case thresholdSelect:
concentratorProcImpl_->thresholdSelectImpl(module_trigcell.second, trigCellVecOutput);
thresholdImpl_->select(module_trigcell.second, trigCellVecOutput);
break;
case bestChoiceSelect:
concentratorProcImpl_->bestChoiceSelectImpl(module_trigcell.second, trigCellVecOutput);
bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
geometry_->getModuleSize(module_trigcell.first),
module_trigcell.second,
trigCellVecOutput);
break;
case superTriggerCellSelect:
concentratorSTCImpl_->superTriggerCellSelectImpl(module_trigcell.second, trigCellVecOutput);
superTriggerCellImpl_->superTriggerCellSelectImpl(module_trigcell.second, trigCellVecOutput);
break;
default:
// Should not happen, selection type checked in constructor
Expand Down
Expand Up @@ -32,11 +32,15 @@ class HGCalTriggerGeometryHexImp2 : public HGCalTriggerGeometryBase {

geom_set getNeighborsFromTriggerCell(const unsigned) const final;

unsigned getLinksInModule(const unsigned module_id) const final;
unsigned getModuleSize(const unsigned module_id) const final;

GlobalPoint getTriggerCellPosition(const unsigned) const final;
GlobalPoint getModulePosition(const unsigned) const final;

bool validTriggerCell(const unsigned) const final;
bool disconnectedModule(const unsigned) const final;
unsigned lastTriggerLayer() const final;
unsigned triggerLayer(const unsigned) const final;

private:
Expand Down Expand Up @@ -486,6 +490,10 @@ HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexImp2::getNeighborsFrom
return neighbor_detids;
}

unsigned HGCalTriggerGeometryHexImp2::getLinksInModule(const unsigned module_id) const { return 1; }

unsigned HGCalTriggerGeometryHexImp2::getModuleSize(const unsigned module_id) const { return 1; }

GlobalPoint HGCalTriggerGeometryHexImp2::getTriggerCellPosition(const unsigned trigger_cell_det_id) const {
// Position: barycenter of the trigger cell.
Basic3DVector<float> triggerCellVector(0., 0., 0.);
Expand Down Expand Up @@ -743,6 +751,8 @@ bool HGCalTriggerGeometryHexImp2::validTriggerCell(const unsigned trigger_cell_i

bool HGCalTriggerGeometryHexImp2::disconnectedModule(const unsigned module_id) const { return false; }

unsigned HGCalTriggerGeometryHexImp2::lastTriggerLayer() const { return eeTopology().dddConstants().layers(true); }

unsigned HGCalTriggerGeometryHexImp2::triggerLayer(const unsigned id) const { return HGCalDetId(id).layer(); }

bool HGCalTriggerGeometryHexImp2::validTriggerCellFromCells(const unsigned trigger_cell_id) const {
Expand Down
Expand Up @@ -33,11 +33,15 @@ class HGCalTriggerGeometryHexLayerBasedImp1 : public HGCalTriggerGeometryBase {

geom_set getNeighborsFromTriggerCell(const unsigned) const final;

unsigned getLinksInModule(const unsigned module_id) const final;
unsigned getModuleSize(const unsigned module_id) const final;

GlobalPoint getTriggerCellPosition(const unsigned) const final;
GlobalPoint getModulePosition(const unsigned) const final;

bool validTriggerCell(const unsigned) const final;
bool disconnectedModule(const unsigned) const final;
unsigned lastTriggerLayer() const final { return last_trigger_layer_; }
unsigned triggerLayer(const unsigned) const final;

private:
Expand Down Expand Up @@ -71,11 +75,12 @@ class HGCalTriggerGeometryHexLayerBasedImp1 : public HGCalTriggerGeometryBase {
std::unordered_set<unsigned> disconnected_modules_;
std::unordered_set<unsigned> disconnected_layers_;
std::vector<unsigned> trigger_layers_;
unsigned last_trigger_layer_ = 0;

// layer offsets
unsigned fhOffset_;
unsigned bhOffset_;
unsigned totalLayers_;
unsigned fhOffset_ = 0;
unsigned bhOffset_ = 0;
unsigned totalLayers_ = 0;

void fillMaps();
void fillNeighborMaps(const edm::FileInPath&, std::unordered_map<int, std::set<std::pair<short, short>>>&);
Expand Down Expand Up @@ -137,6 +142,7 @@ void HGCalTriggerGeometryHexLayerBasedImp1::initialize(const edm::ESHandle<CaloG
trigger_layers_[layer] = 0;
}
}
last_trigger_layer_ = trigger_layer - 1;
fillMaps();
fillNeighborMaps(l1tCellNeighborsMapping_, trigger_cell_neighbors_);
fillNeighborMaps(l1tCellNeighborsBHMapping_, trigger_cell_neighbors_bh_);
Expand Down Expand Up @@ -416,6 +422,10 @@ HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getNei
return neighbor_detids;
}

unsigned HGCalTriggerGeometryHexLayerBasedImp1::getLinksInModule(const unsigned module_id) const { return 1; }

unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleSize(const unsigned module_id) const { return 1; }

GlobalPoint HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellPosition(const unsigned trigger_cell_det_id) const {
unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
// Position: barycenter of the trigger cell.
Expand Down