Skip to content

Commit

Permalink
Comments PR cms-sw#28385
Browse files Browse the repository at this point in the history
  • Loading branch information
jbsauvan committed Dec 10, 2019
1 parent de9e072 commit 2a41870
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 62 deletions.
8 changes: 4 additions & 4 deletions L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h
Expand Up @@ -59,9 +59,9 @@ class HGCalHistoSeedingImpl {

class Navigator {
public:
enum AxisType { Bounded, Circular };
enum class AxisType { Bounded, Circular };

Navigator() : axis_types_({{Bounded, Bounded}}), bins_({{0, 0}}), home_({{0, 0}}) {}
Navigator() : axis_types_({{AxisType::Bounded, AxisType::Bounded}}), bins_({{0, 0}}), home_({{0, 0}}) {}

Navigator(int bins1, AxisType type_axis1, int bins2, AxisType type_axis2)
: axis_types_({{type_axis1, type_axis2}}), bins_({{bins1, bins2}}), home_({{0, 0}}) {}
Expand All @@ -81,12 +81,12 @@ class HGCalHistoSeedingImpl {
int shifted = std::get<N>(home_);
int max = std::get<N>(bins_);
switch (std::get<N>(axis_types_)) {
case Bounded:
case AxisType::Bounded:
shifted += shift;
if (shifted < 0 || shifted >= max)
shifted = -1;
break;
case Circular:
case AxisType::Circular:
shifted += shift;
while (shifted < 0)
shifted += max;
Expand Down
Expand Up @@ -95,7 +95,7 @@ class HGCalConcentratorSuperTriggerCellImpl {
int size() const { return tc_pts_.size(); }
};
void createAllTriggerCells(std::unordered_map<unsigned, SuperTriggerCell>& STCs,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) const;
void assignSuperTriggerCellEnergyAndPosition(l1t::HGCalTriggerCell& c, const SuperTriggerCell& stc) const;
float getTriggerCellOneBitFraction(float tcPt, float sumPt) const;
uint32_t getCompressedSTCEnergy(const SuperTriggerCell& stc) const;
Expand Down
Expand Up @@ -30,7 +30,7 @@ class HGCalBackendLayer2Processor3DClustering : public HGCalBackendLayer2Process
throw cms::Exception("HGCTriggerParameterError") << "Unknown Multiclustering type '" << typeMulticluster << "'";
}

for (auto interpretationPset : conf.getParameter<std::vector<edm::ParameterSet>>("energy_interpretations")) {
for (const auto& interpretationPset : conf.getParameter<std::vector<edm::ParameterSet>>("energy_interpretations")) {
std::unique_ptr<HGCalTriggerClusterInterpreterBase> interpreter{
HGCalTriggerClusterInterpreterFactory::get()->create(interpretationPset.getParameter<std::string>("type"))};
interpreter->initialize(interpretationPset);
Expand Down
Expand Up @@ -29,10 +29,11 @@ void HGCalTriggerClusterInterpretationEM::initialize(const edm::ParameterSet& co
scale_corrections_coeff_ = conf.getParameter<std::vector<double>>("scale_correction_coeff");
dr_bylayer_ = conf.getParameter<std::vector<double>>("dr_bylayer");

if (scale_corrections_coeff_.size() != 2) {
const unsigned corrections_size = 2;
if (scale_corrections_coeff_.size() != corrections_size) {
throw cms::Exception("HGCTriggerParameterError")
<< "HGCalTriggerClusterInterpretationEM::scale_correction_coeff parameter has size: "
<< scale_corrections_coeff_.size() << " while expected is 2";
<< scale_corrections_coeff_.size() << " while expected is " << corrections_size;
}
if (layer_containment_corrs_.size() != dr_bylayer_.size()) {
throw cms::Exception("HGCTriggerParameterError")
Expand All @@ -59,7 +60,7 @@ void HGCalTriggerClusterInterpretationEM::interpret(l1t::HGCalMulticlusterBxColl
}
}
}
energy += scale_corrections_coeff_.at(1) * fabs(cluster3d.eta()) + scale_corrections_coeff_.at(0);
energy += scale_corrections_coeff_.at(1) * std::abs(cluster3d.eta()) + scale_corrections_coeff_.at(0);
cluster3d.saveEnergyInterpretation(l1t::HGCalMulticluster::EnergyInterpretation::EM, max(energy, 0.));
}
}
Expand Up @@ -68,13 +68,7 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge
std::vector<l1t::HGCalTriggerCell> trigCellVecOutput;
std::vector<l1t::HGCalTriggerCell> trigCellVecCoarsened;

int thickness = 0;

if (triggerTools_.isSilicon(module_trigcell.second.at(0).detId())) {
thickness = triggerTools_.thicknessIndex(module_trigcell.second.at(0).detId(), true);
} else if (triggerTools_.isScintillator(module_trigcell.second.at(0).detId())) {
thickness = HGCalTriggerTools::kScintillatorPseudoThicknessIndex_;
}
int thickness = triggerTools_.thicknessIndex(module_trigcell.second.at(0).detId(), true);

HGCalTriggerTools::SubDetectorType subdet = triggerTools_.getSubDetectorType(module_trigcell.second.at(0).detId());

Expand Down
Expand Up @@ -94,7 +94,7 @@ HGCalTriggerGeometryV9Imp2::HGCalTriggerGeometryV9Imp2(const edm::ParameterSet&
hSc_links_per_module_(conf.getParameter<unsigned>("ScintillatorLinksPerModule")),
l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
l1tLinksMapping_(conf.getParameter<edm::FileInPath>("L1TLinksMapping")) {
unsigned ntc_per_wafer = 48;
const unsigned ntc_per_wafer = 48;
hSc_wafers_per_module_ = std::round(hSc_module_size_ * hSc_module_size_ / float(ntc_per_wafer));
if (ntc_per_wafer * hSc_wafers_per_module_ < hSc_module_size_ * hSc_module_size_) {
hSc_wafers_per_module_++;
Expand Down
21 changes: 6 additions & 15 deletions L1Trigger/L1THGCal/src/HGCalCoarseTriggerCellMapping.cc
Expand Up @@ -58,13 +58,8 @@ uint32_t HGCalCoarseTriggerCellMapping::getRepresentativeDetId(uint32_t tcid) co
}

uint32_t HGCalCoarseTriggerCellMapping::getCoarseTriggerCellId(uint32_t detid) const {
int thickness = 0;
unsigned int layer = triggerTools_.layerWithOffset(detid);
if (triggerTools_.isSilicon(detid)) {
thickness = triggerTools_.thicknessIndex(detid, true);
} else if (triggerTools_.isScintillator(detid)) {
thickness = HGCalTriggerTools::kScintillatorPseudoThicknessIndex_;
}
int thickness = triggerTools_.thicknessIndex(detid, true);

int ctcSize = ctcSize_.at(thickness * kNHGCalLayersMax_ + layer);

Expand Down Expand Up @@ -125,13 +120,8 @@ uint32_t HGCalCoarseTriggerCellMapping::getCoarseTriggerCellId(uint32_t detid) c
}

std::vector<uint32_t> HGCalCoarseTriggerCellMapping::getConstituentTriggerCells(uint32_t ctcId) const {
int thickness = 0;
int thickness = triggerTools_.thicknessIndex(ctcId, true);
unsigned int layer = triggerTools_.layerWithOffset(ctcId);
if (triggerTools_.isSilicon(ctcId)) {
thickness = triggerTools_.thicknessIndex(ctcId, true);
} else if (triggerTools_.isScintillator(ctcId)) {
thickness = HGCalTriggerTools::kScintillatorPseudoThicknessIndex_;
}
int ctcSize = ctcSize_.at(thickness * kNHGCalLayersMax_ + layer);

std::vector<uint32_t> output_ids;
Expand Down Expand Up @@ -159,10 +149,11 @@ std::vector<uint32_t> HGCalCoarseTriggerCellMapping::getConstituentTriggerCells(
continue;

HGCScintillatorDetId prime = (ctcId | i);
int radiusphi = ((prime.iradiusAbs() + 1) << HGCScintillatorDetId::kHGCalRadiusOffset) | (prime.iphi() + 1);
unsigned outid = (ctcId & kHGCalScinCellMaskInv_) |
(((prime.iradiusAbs() + 1) << HGCScintillatorDetId::kHGCalRadiusOffset) | (prime.iphi() + 1));

if (triggerTools_.getTriggerGeometry()->validTriggerCell((ctcId & kHGCalScinCellMaskInv_) | radiusphi)) {
output_ids.emplace_back((ctcId & kHGCalScinCellMaskInv_) | radiusphi);
if (triggerTools_.getTriggerGeometry()->validTriggerCell(outid)) {
output_ids.emplace_back(outid);
}
}

Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/src/HGCalTriggerTools.cc
Expand Up @@ -234,7 +234,7 @@ int HGCalTriggerTools::zside(const DetId& id) const {

int HGCalTriggerTools::thicknessIndex(const DetId& id, bool tc) const {
if (isScintillator(id)) {
throw cms::Exception("IncompatibleDetId") << "Trying to get the sensor thickness of a scintillator detid";
return kScintillatorPseudoThicknessIndex_;
}
unsigned det = id.det();
int thickness = 0;
Expand Down
6 changes: 3 additions & 3 deletions L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc
Expand Up @@ -526,10 +526,10 @@ void HGCalHistoSeedingImpl::findHistoSeeds(const std::vector<edm::Ptr<l1t::HGCal
Histogram smoothPhiHistoCluster = fillSmoothPhiHistoClusters(histoCluster, binsSumsHisto_);

/* smoothen along the r/z direction */
smoothHistoCluster = std::move(fillSmoothRPhiHistoClusters(smoothPhiHistoCluster));
smoothHistoCluster = fillSmoothRPhiHistoClusters(smoothPhiHistoCluster);
} else if (seedingSpace_ == XY) {
smoothHistoCluster = std::move(fillSmoothHistoClusters(histoCluster, smoothing_ecal_, Bin::Content::Ecal));
smoothHistoCluster = std::move(fillSmoothHistoClusters(smoothHistoCluster, smoothing_hcal_, Bin::Content::Hcal));
smoothHistoCluster = fillSmoothHistoClusters(histoCluster, smoothing_ecal_, Bin::Content::Ecal);
smoothHistoCluster = fillSmoothHistoClusters(smoothHistoCluster, smoothing_hcal_, Bin::Content::Hcal);
// Update sum with smoothen ECAL + HCAL
for (int z_side : {-1, 1}) {
for (unsigned x1 = 0; x1 < nBins1_; x1++) {
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/src/backend/HGCalShowerShape.cc
Expand Up @@ -431,7 +431,7 @@ float HGCalShowerShape::meanZ(const l1t::HGCalMulticluster& c3d) const {
for (const auto& id_tc : triggerCells) {
if (!pass(*id_tc.second, c3d))
continue;
tc_energy_z.emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->position().z()));
tc_energy_z.emplace_back(id_tc.second->energy(), id_tc.second->position().z());
}
}

Expand Down
Expand Up @@ -36,12 +36,7 @@ void HGCalConcentratorCoarsenerImpl::coarsen(const std::vector<l1t::HGCalTrigger

// first pass, fill the coarse trigger cell information
for (const l1t::HGCalTriggerCell& tc : trigCellVecInput) {
int thickness = 0;
if (triggerTools_.isSilicon(tc.detId())) {
thickness = triggerTools_.thicknessIndex(tc.detId(), true);
} else if (triggerTools_.isScintillator(tc.detId())) {
thickness = HGCalTriggerTools::kScintillatorPseudoThicknessIndex_;
}
int thickness = triggerTools_.thicknessIndex(tc.detId(), true);

if (fixedDataSizePerHGCROC_ && thickness == kHighDensityThickness_) {
trigCellVecOutput.push_back(tc);
Expand Down
Expand Up @@ -34,17 +34,15 @@ uint32_t HGCalConcentratorSuperTriggerCellImpl::getCompressedSTCEnergy(const Sup
}

void HGCalConcentratorSuperTriggerCellImpl::createAllTriggerCells(
std::unordered_map<unsigned, SuperTriggerCell>& STCs, std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) {
std::unordered_map<unsigned, SuperTriggerCell>& STCs, std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) const {
for (auto& s : STCs) {
int thickness = 0;
std::vector<uint32_t> output_ids = superTCmapping_.getConstituentTriggerCells(s.second.getSTCId());
if(output_ids.empty())
continue;

HGCalTriggerTools::SubDetectorType subdet = triggerTools_.getSubDetectorType(output_ids.at(0));
if (triggerTools_.isSilicon(output_ids.at(0))) {
thickness = triggerTools_.thicknessIndex(output_ids.at(0), true);
} else if (triggerTools_.isScintillator(output_ids.at(0))) {
thickness = HGCalTriggerTools::kScintillatorPseudoThicknessIndex_;
}
int thickness = triggerTools_.thicknessIndex(output_ids.at(0), true);

for (const auto& id : output_ids) {
if (((fixedDataSizePerHGCROC_ && thickness > kHighDensityThickness_) || coarsenTriggerCells_[subdet]) &&
(id != coarseTCmapping_.getRepresentativeDetId(id))) {
Expand Down Expand Up @@ -96,13 +94,10 @@ void HGCalConcentratorSuperTriggerCellImpl::assignSuperTriggerCellEnergyAndPosit
const SuperTriggerCell& stc) const {
//Compress and recalibrate STC energy
uint32_t compressed_value = getCompressedSTCEnergy(stc);

HGCalTriggerTools::SubDetectorType subdet = triggerTools_.getSubDetectorType(c.detId());
int thickness = 0;
if (triggerTools_.isSilicon(c.detId())) {
thickness = triggerTools_.thicknessIndex(c.detId(), true);
} else if (triggerTools_.isScintillator(c.detId())) {
thickness = HGCalTriggerTools::kScintillatorPseudoThicknessIndex_;
}
int thickness = triggerTools_.thicknessIndex(c.detId(), true);

GlobalPoint point;
if ((fixedDataSizePerHGCROC_ && thickness > kHighDensityThickness_) || coarsenTriggerCells_[subdet]) {
point = coarseTCmapping_.getCoarseTriggerCellPosition(coarseTCmapping_.getCoarseTriggerCellId(c.detId()));
Expand Down
8 changes: 4 additions & 4 deletions L1Trigger/L1THGCalUtilities/python/hgcalTriggerChains.py
Expand Up @@ -142,10 +142,10 @@ def create_truth_sequences(self, process):
ntuple_sequence = cms.Sequence(tmpseq)
for vfe,truth_prod,backend1,backend2,selector,ntuple in self.truth_chain:
truth_prod_name = '{0}{1}'.format(vfe, truth_prod)
backend1_name = '{0}{1}{2}'.format(vfe, truth_prod, backend1)
backend2_name = '{0}{1}{2}{3}'.format(vfe, truth_prod, backend1, backend2)
selector_name = '{0}{1}{2}{3}{4}'.format(vfe, truth_prod, backend1, backend2, selector)
ntuple_name = '{0}{1}{2}{3}{4}{5}'.format(vfe, truth_prod, backend1, backend2, selector, ntuple)
backend1_name = truth_prod_name + '{0}'.format(backend1)
backend2_name = backend1_name + '{0}'.format(backend2)
selector_name = backend2_name + '{0}'.format(selector)
ntuple_name = selector_name + '{0}'.format(ntuple)
if selector=='':
if backend2=='':
if backend1=='':
Expand Down
Expand Up @@ -11,8 +11,8 @@
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2023D35Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2023D35_cff')
process.load('Configuration.Geometry.GeometryExtended2026D35Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D35_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.Generator_cff')
process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi')
Expand Down

0 comments on commit 2a41870

Please sign in to comment.