-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[HGC trigger] FE customization, OOT subtraction, separate HFNose sequence #29762
Changes from 4 commits
44feef1
3798292
50d45df
8074ea1
f63610f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" | ||
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h" | ||
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h" | ||
|
||
#include "Geometry/Records/interface/CaloGeometryRecord.h" | ||
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" | ||
|
||
#include "L1Trigger/L1THGCal/interface/HGCalProcessorBase.h" | ||
|
||
#include <memory> | ||
|
||
class HFNoseVFEProducer : public edm::stream::EDProducer<> { | ||
public: | ||
HFNoseVFEProducer(const edm::ParameterSet&); | ||
~HFNoseVFEProducer() override {} | ||
|
||
void beginRun(const edm::Run&, const edm::EventSetup&) override; | ||
void produce(edm::Event&, const edm::EventSetup&) override; | ||
|
||
private: | ||
// inputs | ||
edm::EDGetToken inputnose_; | ||
edm::ESHandle<HGCalTriggerGeometryBase> triggerGeometry_; | ||
|
||
std::unique_ptr<HGCalVFEProcessorBase> vfeProcess_; | ||
}; | ||
|
||
DEFINE_FWK_MODULE(HFNoseVFEProducer); | ||
|
||
HFNoseVFEProducer::HFNoseVFEProducer(const edm::ParameterSet& conf) | ||
: inputnose_(consumes<HGCalDigiCollection>(conf.getParameter<edm::InputTag>("noseDigis"))) { | ||
// setup VFE parameters | ||
const edm::ParameterSet& vfeParamConfig = conf.getParameterSet("ProcessorParameters"); | ||
const std::string& vfeProcessorName = vfeParamConfig.getParameter<std::string>("ProcessorName"); | ||
vfeProcess_ = std::unique_ptr<HGCalVFEProcessorBase>{ | ||
HGCalVFEProcessorBaseFactory::get()->create(vfeProcessorName, vfeParamConfig)}; | ||
|
||
produces<l1t::HGCalTriggerCellBxCollection>(vfeProcess_->name()); | ||
produces<l1t::HGCalTriggerSumsBxCollection>(vfeProcess_->name()); | ||
} | ||
|
||
void HFNoseVFEProducer::beginRun(const edm::Run& /*run*/, const edm::EventSetup& es) { | ||
es.get<CaloGeometryRecord>().get(triggerGeometry_); | ||
vfeProcess_->setGeometry(triggerGeometry_.product()); | ||
} | ||
|
||
void HFNoseVFEProducer::produce(edm::Event& e, const edm::EventSetup& es) { | ||
// Output collections | ||
auto vfe_trigcell_output = std::make_unique<l1t::HGCalTriggerCellBxCollection>(); | ||
auto vfe_trigsums_output = std::make_unique<l1t::HGCalTriggerSumsBxCollection>(); | ||
|
||
edm::Handle<HGCalDigiCollection> nose_digis_h; | ||
e.getByToken(inputnose_, nose_digis_h); | ||
|
||
if (nose_digis_h.isValid()) { | ||
const HGCalDigiCollection& nose_digis = *nose_digis_h; | ||
vfeProcess_->run(nose_digis, *vfe_trigcell_output, es); | ||
} | ||
|
||
// Put in the event | ||
e.put(std::move(vfe_trigcell_output), vfeProcess_->name()); | ||
// At the moment the HGCalTriggerSumsBxCollection is empty | ||
e.put(std::move(vfe_trigsums_output), vfeProcess_->name()); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,27 +8,37 @@ DEFINE_EDM_PLUGIN(HGCalConcentratorFactory, HGCalConcentratorProcessorSelection, | |
HGCalConcentratorProcessorSelection::HGCalConcentratorProcessorSelection(const edm::ParameterSet& conf) | ||
: HGCalConcentratorProcessorBase(conf), | ||
fixedDataSizePerHGCROC_(conf.getParameter<bool>("fixedDataSizePerHGCROC")), | ||
coarsenTriggerCells_(conf.getParameter<bool>("coarsenTriggerCells")) { | ||
std::string selectionType(conf.getParameter<std::string>("Method")); | ||
if (selectionType == "thresholdSelect") { | ||
selectionType_ = thresholdSelect; | ||
thresholdImpl_ = std::make_unique<HGCalConcentratorThresholdImpl>(conf); | ||
} else if (selectionType == "bestChoiceSelect") { | ||
selectionType_ = bestChoiceSelect; | ||
bestChoiceImpl_ = std::make_unique<HGCalConcentratorBestChoiceImpl>(conf); | ||
} else if (selectionType == "superTriggerCellSelect") { | ||
selectionType_ = superTriggerCellSelect; | ||
superTriggerCellImpl_ = std::make_unique<HGCalConcentratorSuperTriggerCellImpl>(conf); | ||
} else if (selectionType == "mixedBestChoiceSuperTriggerCell") { | ||
selectionType_ = mixedBestChoiceSuperTriggerCell; | ||
bestChoiceImpl_ = std::make_unique<HGCalConcentratorBestChoiceImpl>(conf); | ||
superTriggerCellImpl_ = std::make_unique<HGCalConcentratorSuperTriggerCellImpl>(conf); | ||
} else { | ||
coarsenTriggerCells_(conf.getParameter<std::vector<unsigned>>("coarsenTriggerCells")), | ||
selectionType_(kNSubDetectors_) { | ||
std::vector<std::string> selectionType(conf.getParameter<std::vector<std::string>>("Method")); | ||
if (selectionType.size() != kNSubDetectors_ || coarsenTriggerCells_.size() != kNSubDetectors_) { | ||
throw cms::Exception("HGCTriggerParameterError") | ||
<< "Unknown type of concentrator selection '" << selectionType << "'"; | ||
<< "Inconsistent number of sub-detectors (should be " << kNSubDetectors_ << ")"; | ||
} | ||
|
||
if (coarsenTriggerCells_ || fixedDataSizePerHGCROC_) { | ||
for (int subdet = 0; subdet < kNSubDetectors_; subdet++) { | ||
if (selectionType[subdet] == "thresholdSelect") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should these cases become a factory (as some other trigger algorithms are already)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am planning to make a global refactoring of the code in the near future. And definitely something should be done to better manage all the different types of algorithms we have in various places. |
||
selectionType_[subdet] = thresholdSelect; | ||
if (!thresholdImpl_) | ||
thresholdImpl_ = std::make_unique<HGCalConcentratorThresholdImpl>(conf); | ||
} else if (selectionType[subdet] == "bestChoiceSelect") { | ||
selectionType_[subdet] = bestChoiceSelect; | ||
if (!bestChoiceImpl_) | ||
bestChoiceImpl_ = std::make_unique<HGCalConcentratorBestChoiceImpl>(conf); | ||
} else if (selectionType[subdet] == "superTriggerCellSelect") { | ||
selectionType_[subdet] = superTriggerCellSelect; | ||
if (!superTriggerCellImpl_) | ||
superTriggerCellImpl_ = std::make_unique<HGCalConcentratorSuperTriggerCellImpl>(conf); | ||
} else if (selectionType[subdet] == "noSelection") { | ||
selectionType_[subdet] = noSelection; | ||
} else { | ||
throw cms::Exception("HGCTriggerParameterError") | ||
<< "Unknown type of concentrator selection '" << selectionType[subdet] << "'"; | ||
} | ||
} | ||
|
||
if (std::find(coarsenTriggerCells_.begin(), coarsenTriggerCells_.end(), true) != coarsenTriggerCells_.end() || | ||
fixedDataSizePerHGCROC_) { | ||
coarsenerImpl_ = std::make_unique<HGCalConcentratorCoarsenerImpl>(conf); | ||
} | ||
} | ||
|
@@ -60,10 +70,12 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge | |
|
||
int thickness = triggerTools_.thicknessIndex(module_trigcell.second.at(0).detId(), true); | ||
|
||
if (coarsenTriggerCells_ || (fixedDataSizePerHGCROC_ && thickness > kHighDensityThickness_)) { | ||
HGCalTriggerTools::SubDetectorType subdet = triggerTools_.getSubDetectorType(module_trigcell.second.at(0).detId()); | ||
|
||
if (coarsenTriggerCells_[subdet] || (fixedDataSizePerHGCROC_ && thickness > kHighDensityThickness_)) { | ||
coarsenerImpl_->coarsen(module_trigcell.second, trigCellVecCoarsened); | ||
|
||
switch (selectionType_) { | ||
switch (selectionType_[subdet]) { | ||
case thresholdSelect: | ||
thresholdImpl_->select(trigCellVecCoarsened, trigCellVecOutput); | ||
break; | ||
|
@@ -83,23 +95,16 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge | |
case superTriggerCellSelect: | ||
superTriggerCellImpl_->select(trigCellVecCoarsened, trigCellVecOutput); | ||
break; | ||
case mixedBestChoiceSuperTriggerCell: | ||
if (triggerTools_.isEm(module_trigcell.first)) { | ||
bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first), | ||
geometry_->getModuleSize(module_trigcell.first), | ||
trigCellVecCoarsened, | ||
trigCellVecOutput); | ||
} else { | ||
superTriggerCellImpl_->select(trigCellVecCoarsened, trigCellVecOutput); | ||
} | ||
case noSelection: | ||
trigCellVecOutput = trigCellVecCoarsened; | ||
break; | ||
default: | ||
// Should not happen, selection type checked in constructor | ||
break; | ||
} | ||
|
||
} else { | ||
switch (selectionType_) { | ||
switch (selectionType_[subdet]) { | ||
case thresholdSelect: | ||
thresholdImpl_->select(module_trigcell.second, trigCellVecOutput); | ||
break; | ||
|
@@ -112,15 +117,8 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge | |
case superTriggerCellSelect: | ||
superTriggerCellImpl_->select(module_trigcell.second, trigCellVecOutput); | ||
break; | ||
case mixedBestChoiceSuperTriggerCell: | ||
if (triggerTools_.isEm(module_trigcell.first)) { | ||
bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first), | ||
geometry_->getModuleSize(module_trigcell.first), | ||
module_trigcell.second, | ||
trigCellVecOutput); | ||
} else { | ||
superTriggerCellImpl_->select(module_trigcell.second, trigCellVecOutput); | ||
} | ||
case noSelection: | ||
trigCellVecOutput = module_trigcell.second; | ||
break; | ||
default: | ||
// Should not happen, selection type checked in constructor | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
import SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi as digiparam | ||
from L1Trigger.L1THGCal.hgcalVFEProducer_cfi import vfe_proc | ||
|
||
def custom_hgcroc_oot(process, | ||
oot_coefficients=vfe_proc.oot_coefficients | ||
): | ||
parameters = vfe_proc.clone(oot_coefficients = oot_coefficients) | ||
process.hgcalVFEProducer.ProcessorParameters = parameters | ||
return process |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,6 @@ | |
InputTriggerCells = cms.InputTag('hgcalConcentratorProducer:HGCalConcentratorProcessorSelection'), | ||
ProcessorParameters = be_proc.clone() | ||
) | ||
|
||
hgcalBackEndLayer1ProducerHFNose = hgcalBackEndLayer1Producer.clone() | ||
hgcalBackEndLayer1ProducerHFNose.InputTriggerCells = cms.InputTag('hgcalConcentratorProducerHFNose:HGCalConcentratorProcessorSelection') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make parameter changes inside clone() statement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems redundant with the enums already defined in https://github.com/cms-sw/cmssw/blob/master/DataFormats/ForwardDetId/interface/ForwardSubdetector.h. Is there a reason for it to be separate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case the enum values are used to index vectors. So we need values
0,1,2
. The information encoded here is indeed redundant with enums inForwardSubdetector.h
, but we would need to manipulate them further ifForwardSubdetector
orHGCalTriggerSubdetector
were used.