CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes | Static Private Attributes
HGCalConcentratorProcessorSelection Class Reference

#include <HGCalConcentratorProcessorSelection.h>

Inheritance diagram for HGCalConcentratorProcessorSelection:
HGCalProcessorBaseT< InputCollection, OutputCollection >

Public Member Functions

 HGCalConcentratorProcessorSelection (const edm::ParameterSet &conf)
 
void run (const edm::Handle< l1t::HGCalTriggerCellBxCollection > &triggerCellCollInput, std::tuple< l1t::HGCalTriggerCellBxCollection, l1t::HGCalTriggerSumsBxCollection, l1t::HGCalConcentratorDataBxCollection > &triggerCollOutput, const edm::EventSetup &es) override
 
- Public Member Functions inherited from HGCalProcessorBaseT< InputCollection, OutputCollection >
virtual void eventSetup (const edm::EventSetup &es)
 
 HGCalProcessorBaseT (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual void run (const InputCollection &inputColl, OutputCollection &outColl, const edm::EventSetup &es)=0
 
void setGeometry (const HGCalTriggerGeometryBase *const geom)
 
virtual ~HGCalProcessorBaseT ()
 

Private Types

enum  SelectionType {
  thresholdSelect, bestChoiceSelect, superTriggerCellSelect, autoEncoderSelect,
  noSelection
}
 

Private Attributes

bool allTrigCellsInTrigSums_
 
std::unique_ptr< HGCalConcentratorAutoEncoderImplautoEncoderImpl_
 
std::unique_ptr< HGCalConcentratorBestChoiceImplbestChoiceImpl_
 
std::unique_ptr< HGCalConcentratorCoarsenerImplcoarsenerImpl_
 
std::vector< unsigned > coarsenTriggerCells_
 
bool fixedDataSizePerHGCROC_
 
std::vector< SelectionTypeselectionType_
 
std::unique_ptr< HGCalConcentratorSuperTriggerCellImplsuperTriggerCellImpl_
 
std::unique_ptr< HGCalConcentratorThresholdImplthresholdImpl_
 
HGCalTriggerTools triggerTools_
 
std::unique_ptr< HGCalConcentratorTrigSumImpltrigSumImpl_
 

Static Private Attributes

static constexpr int kHighDensityThickness_ = 0
 
static constexpr int kNSubDetectors_ = 3
 

Additional Inherited Members

- Protected Attributes inherited from HGCalProcessorBaseT< InputCollection, OutputCollection >
const HGCalTriggerGeometryBasegeometry_
 

Detailed Description

Definition at line 20 of file HGCalConcentratorProcessorSelection.h.

Member Enumeration Documentation

◆ SelectionType

Enumerator
thresholdSelect 
bestChoiceSelect 
superTriggerCellSelect 
autoEncoderSelect 
noSelection 

Definition at line 22 of file HGCalConcentratorProcessorSelection.h.

Constructor & Destructor Documentation

◆ HGCalConcentratorProcessorSelection()

HGCalConcentratorProcessorSelection::HGCalConcentratorProcessorSelection ( const edm::ParameterSet conf)

Definition at line 8 of file HGCalConcentratorProcessorSelection.cc.

10  fixedDataSizePerHGCROC_(conf.getParameter<bool>("fixedDataSizePerHGCROC")),
11  allTrigCellsInTrigSums_(conf.getParameter<bool>("allTrigCellsInTrigSums")),
12  coarsenTriggerCells_(conf.getParameter<std::vector<unsigned>>("coarsenTriggerCells")),
14  std::vector<std::string> selectionType(conf.getParameter<std::vector<std::string>>("Method"));
16  throw cms::Exception("HGCTriggerParameterError")
17  << "Inconsistent number of sub-detectors (should be " << kNSubDetectors_ << ")";
18  }
19 
20  for (int subdet = 0; subdet < kNSubDetectors_; subdet++) {
21  if (selectionType[subdet] == "thresholdSelect") {
23  if (!thresholdImpl_)
24  thresholdImpl_ = std::make_unique<HGCalConcentratorThresholdImpl>(conf);
25  if (!trigSumImpl_)
26  trigSumImpl_ = std::make_unique<HGCalConcentratorTrigSumImpl>(conf);
27  } else if (selectionType[subdet] == "bestChoiceSelect") {
29  if (!bestChoiceImpl_)
30  bestChoiceImpl_ = std::make_unique<HGCalConcentratorBestChoiceImpl>(conf);
31  if (!trigSumImpl_)
32  trigSumImpl_ = std::make_unique<HGCalConcentratorTrigSumImpl>(conf);
33  } else if (selectionType[subdet] == "superTriggerCellSelect") {
36  superTriggerCellImpl_ = std::make_unique<HGCalConcentratorSuperTriggerCellImpl>(conf);
37  } else if (selectionType[subdet] == "autoEncoder") {
39  if (!autoEncoderImpl_)
40  autoEncoderImpl_ = std::make_unique<HGCalConcentratorAutoEncoderImpl>(conf);
41  } else if (selectionType[subdet] == "noSelection") {
42  selectionType_[subdet] = noSelection;
43  } else {
44  throw cms::Exception("HGCTriggerParameterError")
45  << "Unknown type of concentrator selection '" << selectionType[subdet] << "'";
46  }
47  }
48 
49  if (std::find(coarsenTriggerCells_.begin(), coarsenTriggerCells_.end(), true) != coarsenTriggerCells_.end() ||
51  coarsenerImpl_ = std::make_unique<HGCalConcentratorCoarsenerImpl>(conf);
52  }
53 }

References autoEncoderImpl_, autoEncoderSelect, bestChoiceImpl_, bestChoiceSelect, coarsenerImpl_, coarsenTriggerCells_, Exception, spr::find(), fixedDataSizePerHGCROC_, edm::ParameterSet::getParameter(), kNSubDetectors_, noSelection, muonSelectionTypeValueMapProducer_cff::selectionType, selectionType_, superTriggerCellImpl_, superTriggerCellSelect, thresholdImpl_, thresholdSelect, and trigSumImpl_.

Member Function Documentation

◆ run()

void HGCalConcentratorProcessorSelection::run ( const edm::Handle< l1t::HGCalTriggerCellBxCollection > &  triggerCellCollInput,
std::tuple< l1t::HGCalTriggerCellBxCollection, l1t::HGCalTriggerSumsBxCollection, l1t::HGCalConcentratorDataBxCollection > &  triggerCollOutput,
const edm::EventSetup es 
)
override

Definition at line 55 of file HGCalConcentratorProcessorSelection.cc.

59  {
60  if (thresholdImpl_)
61  thresholdImpl_->eventSetup(es);
62  if (bestChoiceImpl_)
63  bestChoiceImpl_->eventSetup(es);
65  superTriggerCellImpl_->eventSetup(es);
66  if (autoEncoderImpl_)
67  autoEncoderImpl_->eventSetup(es);
68  if (coarsenerImpl_)
69  coarsenerImpl_->eventSetup(es);
70  if (trigSumImpl_)
71  trigSumImpl_->eventSetup(es);
73 
74  auto& triggerCellCollOutput = std::get<0>(triggerCollOutput);
75  auto& triggerSumCollOutput = std::get<1>(triggerCollOutput);
76  auto& autoEncoderCollOutput = std::get<2>(triggerCollOutput);
77 
78  const l1t::HGCalTriggerCellBxCollection& collInput = *triggerCellCollInput;
79 
80  std::unordered_map<uint32_t, std::vector<l1t::HGCalTriggerCell>> tc_modules;
81  for (const auto& trigCell : collInput) {
82  uint32_t module = geometry_->getModuleFromTriggerCell(trigCell.detId());
83  tc_modules[module].push_back(trigCell);
84  }
85 
86  for (const auto& module_trigcell : tc_modules) {
87  std::vector<l1t::HGCalTriggerCell> trigCellVecOutput;
88  std::vector<l1t::HGCalTriggerCell> trigCellVecCoarsened;
89  std::vector<l1t::HGCalTriggerCell> trigCellVecNotSelected;
90  std::vector<l1t::HGCalTriggerSums> trigSumsVecOutput;
91  std::vector<l1t::HGCalConcentratorData> ae_EncodedLayerOutput;
92 
93  int thickness = triggerTools_.thicknessIndex(module_trigcell.second.at(0).detId(), true);
94 
95  HGCalTriggerTools::SubDetectorType subdet = triggerTools_.getSubDetectorType(module_trigcell.second.at(0).detId());
96 
98  coarsenerImpl_->coarsen(module_trigcell.second, trigCellVecCoarsened);
99 
100  switch (selectionType_[subdet]) {
101  case thresholdSelect:
102  thresholdImpl_->select(trigCellVecCoarsened, trigCellVecOutput, trigCellVecNotSelected);
103  break;
104  case bestChoiceSelect:
105  if (triggerTools_.isEm(module_trigcell.first)) {
106  bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
107  geometry_->getModuleSize(module_trigcell.first),
108  module_trigcell.second,
109  trigCellVecOutput,
110  trigCellVecNotSelected);
111  } else {
112  bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
113  geometry_->getModuleSize(module_trigcell.first),
114  trigCellVecCoarsened,
115  trigCellVecOutput,
116  trigCellVecNotSelected);
117  }
118  break;
120  superTriggerCellImpl_->select(trigCellVecCoarsened, trigCellVecOutput);
121  break;
122  case autoEncoderSelect:
123  autoEncoderImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
124  trigCellVecCoarsened,
125  trigCellVecOutput,
126  ae_EncodedLayerOutput);
127  break;
128  case noSelection:
129  trigCellVecOutput = trigCellVecCoarsened;
130  break;
131  default:
132  // Should not happen, selection type checked in constructor
133  break;
134  }
135 
136  } else {
137  switch (selectionType_[subdet]) {
138  case thresholdSelect:
139  thresholdImpl_->select(module_trigcell.second, trigCellVecOutput, trigCellVecNotSelected);
140  break;
141  case bestChoiceSelect:
142  bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
143  geometry_->getModuleSize(module_trigcell.first),
144  module_trigcell.second,
145  trigCellVecOutput,
146  trigCellVecNotSelected);
147  break;
149  superTriggerCellImpl_->select(module_trigcell.second, trigCellVecOutput);
150  break;
151  case autoEncoderSelect:
152  autoEncoderImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
153  module_trigcell.second,
154  trigCellVecOutput,
155  ae_EncodedLayerOutput);
156  break;
157  case noSelection:
158  trigCellVecOutput = module_trigcell.second;
159  break;
160  default:
161  // Should not happen, selection type checked in constructor
162  break;
163  }
164  }
165 
166  // trigger sum
167  if (trigSumImpl_) {
168  if (allTrigCellsInTrigSums_) { // using all TCs
169  trigSumImpl_->doSum(module_trigcell.first, module_trigcell.second, trigSumsVecOutput);
170  } else { // using only unselected TCs
171  trigSumImpl_->doSum(module_trigcell.first, trigCellVecNotSelected, trigSumsVecOutput);
172  }
173  }
174 
175  for (const auto& trigCell : trigCellVecOutput) {
176  triggerCellCollOutput.push_back(0, trigCell);
177  }
178  for (const auto& trigSums : trigSumsVecOutput) {
179  triggerSumCollOutput.push_back(0, trigSums);
180  }
181  for (const auto& aeVal : ae_EncodedLayerOutput) {
182  autoEncoderCollOutput.push_back(0, aeVal);
183  }
184  }
185 }

References allTrigCellsInTrigSums_, autoEncoderImpl_, autoEncoderSelect, bestChoiceImpl_, bestChoiceSelect, coarsenerImpl_, coarsenTriggerCells_, HGCalTriggerTools::eventSetup(), fixedDataSizePerHGCROC_, HGCalProcessorBaseT< InputCollection, OutputCollection >::geometry_, HGCalTriggerGeometryBase::getLinksInModule(), HGCalTriggerGeometryBase::getModuleFromTriggerCell(), HGCalTriggerGeometryBase::getModuleSize(), HGCalTriggerTools::getSubDetectorType(), HGCalTriggerTools::isEm(), kHighDensityThickness_, callgraph::module, noSelection, selectionType_, superTriggerCellImpl_, superTriggerCellSelect, Calorimetry_cff::thickness, HGCalTriggerTools::thicknessIndex(), thresholdImpl_, thresholdSelect, triggerTools_, and trigSumImpl_.

Member Data Documentation

◆ allTrigCellsInTrigSums_

bool HGCalConcentratorProcessorSelection::allTrigCellsInTrigSums_
private

Definition at line 35 of file HGCalConcentratorProcessorSelection.h.

Referenced by run().

◆ autoEncoderImpl_

std::unique_ptr<HGCalConcentratorAutoEncoderImpl> HGCalConcentratorProcessorSelection::autoEncoderImpl_
private

◆ bestChoiceImpl_

std::unique_ptr<HGCalConcentratorBestChoiceImpl> HGCalConcentratorProcessorSelection::bestChoiceImpl_
private

◆ coarsenerImpl_

std::unique_ptr<HGCalConcentratorCoarsenerImpl> HGCalConcentratorProcessorSelection::coarsenerImpl_
private

◆ coarsenTriggerCells_

std::vector<unsigned> HGCalConcentratorProcessorSelection::coarsenTriggerCells_
private

◆ fixedDataSizePerHGCROC_

bool HGCalConcentratorProcessorSelection::fixedDataSizePerHGCROC_
private

◆ kHighDensityThickness_

constexpr int HGCalConcentratorProcessorSelection::kHighDensityThickness_ = 0
staticconstexprprivate

Definition at line 37 of file HGCalConcentratorProcessorSelection.h.

Referenced by run().

◆ kNSubDetectors_

constexpr int HGCalConcentratorProcessorSelection::kNSubDetectors_ = 3
staticconstexprprivate

◆ selectionType_

std::vector<SelectionType> HGCalConcentratorProcessorSelection::selectionType_
private

◆ superTriggerCellImpl_

std::unique_ptr<HGCalConcentratorSuperTriggerCellImpl> HGCalConcentratorProcessorSelection::superTriggerCellImpl_
private

◆ thresholdImpl_

std::unique_ptr<HGCalConcentratorThresholdImpl> HGCalConcentratorProcessorSelection::thresholdImpl_
private

◆ triggerTools_

HGCalTriggerTools HGCalConcentratorProcessorSelection::triggerTools_
private

Definition at line 49 of file HGCalConcentratorProcessorSelection.h.

Referenced by run().

◆ trigSumImpl_

std::unique_ptr<HGCalConcentratorTrigSumImpl> HGCalConcentratorProcessorSelection::trigSumImpl_
private
HGCalTriggerTools::eventSetup
void eventSetup(const edm::EventSetup &)
Definition: HGCalTriggerTools.cc:35
HGCalConcentratorProcessorSelection::coarsenTriggerCells_
std::vector< unsigned > coarsenTriggerCells_
Definition: HGCalConcentratorProcessorSelection.h:36
HGCalConcentratorProcessorSelection::kHighDensityThickness_
static constexpr int kHighDensityThickness_
Definition: HGCalConcentratorProcessorSelection.h:37
HGCalConcentratorProcessorSelection::thresholdImpl_
std::unique_ptr< HGCalConcentratorThresholdImpl > thresholdImpl_
Definition: HGCalConcentratorProcessorSelection.h:42
HGCalConcentratorProcessorSelection::kNSubDetectors_
static constexpr int kNSubDetectors_
Definition: HGCalConcentratorProcessorSelection.h:38
HGCalTriggerTools::thicknessIndex
int thicknessIndex(const DetId &, bool tc=false) const
Definition: HGCalTriggerTools.cc:233
HGCalConcentratorProcessorSelection::fixedDataSizePerHGCROC_
bool fixedDataSizePerHGCROC_
Definition: HGCalConcentratorProcessorSelection.h:34
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HGCalConcentratorProcessorSelection::superTriggerCellImpl_
std::unique_ptr< HGCalConcentratorSuperTriggerCellImpl > superTriggerCellImpl_
Definition: HGCalConcentratorProcessorSelection.h:44
HGCalTriggerGeometryBase::getLinksInModule
virtual unsigned getLinksInModule(const unsigned module_id) const =0
BXVector
Definition: BXVector.h:15
HGCalConcentratorProcessorSelection::bestChoiceSelect
Definition: HGCalConcentratorProcessorSelection.h:22
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:115
HGCalTriggerTools::getSubDetectorType
SubDetectorType getSubDetectorType(const DetId &id) const
Definition: HGCalTriggerTools.cc:198
HGCalTriggerTools::isEm
bool isEm(const DetId &) const
Definition: HGCalTriggerTools.cc:151
HGCalConcentratorProcessorSelection::allTrigCellsInTrigSums_
bool allTrigCellsInTrigSums_
Definition: HGCalConcentratorProcessorSelection.h:35
HGCalConcentratorProcessorSelection::superTriggerCellSelect
Definition: HGCalConcentratorProcessorSelection.h:22
HGCalConcentratorProcessorSelection::coarsenerImpl_
std::unique_ptr< HGCalConcentratorCoarsenerImpl > coarsenerImpl_
Definition: HGCalConcentratorProcessorSelection.h:45
HGCalProcessorBaseT::geometry_
const HGCalTriggerGeometryBase * geometry_
Definition: HGCalProcessorBaseT.h:26
HGCalConcentratorProcessorSelection::autoEncoderSelect
Definition: HGCalConcentratorProcessorSelection.h:22
callgraph.module
module
Definition: callgraph.py:61
HGCalConcentratorProcessorSelection::trigSumImpl_
std::unique_ptr< HGCalConcentratorTrigSumImpl > trigSumImpl_
Definition: HGCalConcentratorProcessorSelection.h:46
HGCalTriggerGeometryBase::getModuleFromTriggerCell
virtual unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const =0
HGCalTriggerTools::SubDetectorType
SubDetectorType
Definition: HGCalTriggerTools.h:89
Exception
Definition: hltDiff.cc:245
HGCalConcentratorProcessorSelection::autoEncoderImpl_
std::unique_ptr< HGCalConcentratorAutoEncoderImpl > autoEncoderImpl_
Definition: HGCalConcentratorProcessorSelection.h:47
HGCalConcentratorProcessorSelection::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalConcentratorProcessorSelection.h:49
HGCalConcentratorProcessorBase
HGCalProcessorBaseT< edm::Handle< l1t::HGCalTriggerCellBxCollection >, std::tuple< l1t::HGCalTriggerCellBxCollection, l1t::HGCalTriggerSumsBxCollection, l1t::HGCalConcentratorDataBxCollection > > HGCalConcentratorProcessorBase
Definition: HGCalProcessorBase.h:23
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalConcentratorProcessorSelection::noSelection
Definition: HGCalConcentratorProcessorSelection.h:22
HGCalConcentratorProcessorSelection::thresholdSelect
Definition: HGCalConcentratorProcessorSelection.h:22
HGCalConcentratorProcessorSelection::selectionType_
std::vector< SelectionType > selectionType_
Definition: HGCalConcentratorProcessorSelection.h:40
HGCalTriggerGeometryBase::getModuleSize
virtual unsigned getModuleSize(const unsigned module_id) const =0
muonSelectionTypeValueMapProducer_cff.selectionType
selectionType
Definition: muonSelectionTypeValueMapProducer_cff.py:6
HGCalConcentratorProcessorSelection::bestChoiceImpl_
std::unique_ptr< HGCalConcentratorBestChoiceImpl > bestChoiceImpl_
Definition: HGCalConcentratorProcessorSelection.h:43