Skip to content

Commit

Permalink
Merge pull request #107 from gpetruc/regionizer_cleanup
Browse files Browse the repository at this point in the history
Multififo regionizer emulator improvements
  • Loading branch information
gpetruc authored Dec 9, 2022
2 parents 912d918 + 8078ab5 commit f974d21
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ namespace l1ct {
unsigned int outii,
unsigned int pauseii,
bool useAlsoVtxCoords);

// note: this one will work only in CMSSW
// note: these ones will work only in CMSSW
MultififoRegionizerEmulator(const edm::ParameterSet& iConfig);
MultififoRegionizerEmulator(const std::string& barrelSetup, const edm::ParameterSet& iConfig);

~MultififoRegionizerEmulator() override;

static BarrelSetup parseBarrelSetup(const std::string& setup);

void setEgInterceptMode(bool afterFifo, const l1ct::EGInputSelectorEmuConfig& interceptorConfig);
void initSectorsAndRegions(const RegionizerDecodedInputs& in, const std::vector<PFInputRegion>& out) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ L1TCorrelatorLayer1Producer::L1TCorrelatorLayer1Producer(const edm::ParameterSet
} else if (regalgo == "Multififo") {
regionizer_ = std::make_unique<l1ct::MultififoRegionizerEmulator>(
iConfig.getParameter<edm::ParameterSet>("regionizerAlgoParameters"));
} else if (regalgo == "MultififoBarrel") {
const auto &pset = iConfig.getParameter<edm::ParameterSet>("regionizerAlgoParameters");
regionizer_ =
std::make_unique<l1ct::MultififoRegionizerEmulator>(pset.getParameter<std::string>("barrelSetup"), pset);
} else if (regalgo == "TDR") {
regionizer_ = std::make_unique<l1ct::TDRRegionizerEmulator>(
iConfig.getParameter<edm::ParameterSet>("regionizerAlgoParameters"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ l1ct::FoldedMultififoRegionizerEmulator::FoldedMultififoRegionizerEmulator(unsig
// now we initialize the routes: track finder
for (unsigned int ie = 0; ie < 2; ++ie) {
fold_.emplace_back(ie,
#ifdef CMSSW_GIT_HASH
std::make_unique<l1ct::MultififoRegionizerEmulator>(
/*nendcaps=*/1,
nclocks / 2,
Expand All @@ -49,21 +48,6 @@ l1ct::FoldedMultififoRegionizerEmulator::FoldedMultififoRegionizerEmulator(unsig
outii,
pauseii,
useAlsoVtxCoords));
#else
std::unique_ptr<l1ct::MultififoRegionizerEmulator>(new l1ct::MultififoRegionizerEmulator(
/*nendcaps=*/1,
nclocks / 2,
NTK_LINKS,
NCALO_LINKS,
ntk,
ncalo,
nem,
nmu,
streaming,
outii,
pauseii,
useAlsoVtxCoords)));
#endif
}
clocksPerFold_ = nclocks / 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <iostream>
#include <memory>
#include <stdexcept>

#ifdef CMSSW_GIT_HASH
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand All @@ -27,6 +28,23 @@ l1ct::MultififoRegionizerEmulator::MultififoRegionizerEmulator(const edm::Parame
setEgInterceptMode(emSelCfg.getParameter<bool>("afterFifo"), emSelCfg);
}
}

l1ct::MultififoRegionizerEmulator::MultififoRegionizerEmulator(const std::string& barrelSetup,
const edm::ParameterSet& iConfig)
: MultififoRegionizerEmulator(parseBarrelSetup(barrelSetup),
iConfig.getParameter<uint32_t>("nHCalLinks"),
iConfig.getParameter<uint32_t>("nECalLinks"),
iConfig.getParameter<uint32_t>("nClocks"),
iConfig.getParameter<uint32_t>("nTrack"),
iConfig.getParameter<uint32_t>("nCalo"),
iConfig.getParameter<uint32_t>("nEmCalo"),
iConfig.getParameter<uint32_t>("nMu"),
/*streaming=*/false,
/*outii=*/1,
/*pauseii=*/0,
iConfig.getParameter<bool>("useAlsoVtxCoords")) {
debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
}
#endif

l1ct::MultififoRegionizerEmulator::MultififoRegionizerEmulator(unsigned int nendcaps,
Expand Down Expand Up @@ -240,14 +258,20 @@ l1ct::MultififoRegionizerEmulator::MultififoRegionizerEmulator(BarrelSetup barre

l1ct::MultififoRegionizerEmulator::~MultififoRegionizerEmulator() {}

l1ct::MultififoRegionizerEmulator::BarrelSetup l1ct::MultififoRegionizerEmulator::parseBarrelSetup(
const std::string& setup) {
if (setup == "Full54")
return BarrelSetup::Full54;
if (setup == "Full27")
return BarrelSetup::Full27;
throw std::invalid_argument("barrelSetup for CMSSW can only be Full54 or Full27");
return BarrelSetup::Full54;
}

void l1ct::MultififoRegionizerEmulator::setEgInterceptMode(bool afterFifo,
const l1ct::EGInputSelectorEmuConfig& interceptorConfig) {
emInterceptMode_ = afterFifo ? interceptPostFifo : interceptPreFifo;
#ifdef CMSSW_GIT_HASH
interceptor_ = std::make_unique<EGInputSelectorEmulator>(interceptorConfig);
#else
interceptor_.reset(new EGInputSelectorEmulator(interceptorConfig));
#endif
}

void l1ct::MultififoRegionizerEmulator::initSectorsAndRegions(const RegionizerDecodedInputs& in,
Expand Down

0 comments on commit f974d21

Please sign in to comment.