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

L1T Phase-2 Correlator Layer 1 updates for Multiboard tests #42643

Merged
merged 8 commits into from
Sep 11, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define L1Trigger_Phase2L1ParticleFlow_L1TCorrelatorLayer1PatternFileWriter_h

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "L1Trigger/DemonstratorTools/interface/BoardDataWriter.h"
#include "L1Trigger/DemonstratorTools/interface/utilities.h"

Expand All @@ -12,24 +13,27 @@ class L1TCorrelatorLayer1PatternFileWriter {
L1TCorrelatorLayer1PatternFileWriter(const edm::ParameterSet& iConfig, const l1ct::Event& eventTemplate);
~L1TCorrelatorLayer1PatternFileWriter();

static edm::ParameterSetDescription getParameterSetDescription();

void write(const l1ct::Event& event);
void flush();

private:
enum class Partition { Barrel, HGCal, HGCalNoTk, HF };

Partition partition_;
const unsigned int tmuxFactor_ = 6; // not really configurable in current architecture
const unsigned int tmuxFactor_;
bool writeInputs_, writeOutputs_;
std::map<l1t::demo::LinkId, std::vector<size_t>> channelIdsInput_, channelIdsOutput_;
std::map<std::string, l1t::demo::ChannelSpec> channelSpecsInput_, channelSpecsOutput_;

const unsigned int tfTimeslices_ = 3, tfLinksFactor_ = 1; // not really configurable in current architecture
const unsigned int hgcTimeslices_ = 3, hgcLinksFactor_ = 4; // not really configurable in current architecture
const unsigned int gctTimeslices_ = 1, gctSectors_ = 3; // not really configurable in current architecture
const unsigned int gctLinksEcal_ = 1, gctLinksHad_ = 2; // could be made configurable later
const unsigned int gmtTimeslices_ = 3, gmtLinksFactor_ = 1; // not really configurable in current architecture
const unsigned int gttTimeslices_ = 1, gttLinksFactor_ = 1; // not really configurable in current architecture
const unsigned int tfTmuxFactor_ = 18, tfLinksFactor_ = 1; // numbers not really configurable in current architecture
const unsigned int hgcTmuxFactor_ = 18, hgcLinksFactor_ = 4; // not really configurable in current architecture
const unsigned int gctTmuxFactor_ = 1, gctSectors_ = 3; // not really configurable in current architecture
const unsigned int gctLinksEcal_ = 1, gctLinksHad_ = 2; // could be made configurable later
const unsigned int gmtTmuxFactor_ = 18, gmtLinksFactor_ = 1; // not really configurable in current architecture
const unsigned int gttTmuxFactor_ = 6, gttLinksFactor_ = 1; // not really configurable in current architecture
const unsigned int tfTimeslices_, hgcTimeslices_, gctTimeslices_, gmtTimeslices_, gttTimeslices_;
uint32_t gmtNumberOfMuons_;
uint32_t gttNumberOfPVs_;
uint32_t gttLatency_;
Expand All @@ -50,26 +54,38 @@ class L1TCorrelatorLayer1PatternFileWriter {

static Partition parsePartition(const std::string& partition);

static std::unique_ptr<edm::ParameterDescriptionNode> describeTF();
static std::unique_ptr<edm::ParameterDescriptionNode> describeGCT();
static std::unique_ptr<edm::ParameterDescriptionNode> describeHGC();
static std::unique_ptr<edm::ParameterDescriptionNode> describeGMT();
static std::unique_ptr<edm::ParameterDescriptionNode> describeGTT();
static std::unique_ptr<edm::ParameterDescriptionNode> describePuppi();
static std::unique_ptr<edm::ParameterDescriptionNode> describeEG();

void configTimeSlices(const edm::ParameterSet& iConfig,
const std::string& prefix,
unsigned int nSectors,
unsigned int nTimeSlices,
unsigned int linksFactor);
static std::unique_ptr<edm::ParameterDescriptionNode> describeTimeSlices(const std::string& prefix);
void configSectors(const edm::ParameterSet& iConfig,
const std::string& prefix,
unsigned int nSectors,
unsigned int linksFactor);
static std::unique_ptr<edm::ParameterDescriptionNode> describeSectors(const std::string& prefix);
void configLinks(const edm::ParameterSet& iConfig,
const std::string& prefix,
unsigned int linksFactor,
unsigned int offset);
static std::unique_ptr<edm::ParameterDescriptionNode> describeLinks(const std::string& prefix);

void writeTF(const l1ct::Event& event, l1t::demo::EventData& out);
void writeBarrelGCT(const l1ct::Event& event, l1t::demo::EventData& out);
void writeHGC(const l1ct::Event& event, l1t::demo::EventData& out);
void writeGMT(const l1ct::Event& event, l1t::demo::EventData& out);
void writeGTT(const l1ct::Event& event, l1t::demo::EventData& out);
void writePuppi(const l1ct::Event& event, l1t::demo::EventData& out);
void writeEgamma(const l1ct::OutputBoard& egboard, std::vector<ap_uint<64>>& out);
void writeEgamma(const l1ct::Event& event, l1t::demo::EventData& out);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand All @@ -16,6 +17,8 @@ namespace l1ct {
EGInputSelectorEmuConfig(unsigned int emIdMask, unsigned int nHADCALO_IN, unsigned int nEMCALO_OUT, int debug)
: idMask(emIdMask), nHADCALO_IN(nHADCALO_IN), nEMCALO_OUT(nEMCALO_OUT), debug(debug) {}

static edm::ParameterSetDescription getParameterSetDescription();

emid_t idMask;
unsigned int nHADCALO_IN;
unsigned int nEMCALO_OUT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand Down Expand Up @@ -47,6 +48,7 @@ namespace l1ct {
ap_int<z0_t::width + 1> dZ;
int dRMin2;
int dRMax2;
static edm::ParameterSetDescription getParameterSetDescription();
};

IsoParameters tkIsoParams_tkEle;
Expand All @@ -65,6 +67,7 @@ namespace l1ct {
const double bdtScore_loose_wp; // XGBOOST score
const double bdtScore_tight_wp; // XGBOOST score
const std::string conifer_model;
static edm::ParameterSetDescription getParameterSetDescription();
};

CompIDParameters compIDparams;
Expand Down Expand Up @@ -131,6 +134,8 @@ namespace l1ct {
hwIsoTypeTkEm(hwIsoTypeTkEm),
compIDparams(compIDparams),
debug(debug) {}

static edm::ParameterSetDescription getParameterSetDescription();
};

class PFTkEGAlgoEmulator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ namespace l1ct {
PFTkEGSorterBarrelEmulator(const edm::ParameterSet& iConfig)
: PFTkEGSorterEmulator(iConfig.getParameter<uint32_t>("nObjToSort"),
iConfig.getParameter<uint32_t>("nObjSorted")) {}

static edm::ParameterSetDescription getParameterSetDescription() {
return PFTkEGSorterEmulator::getParameterSetDescription();
}
#endif

~PFTkEGSorterBarrelEmulator() override {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#ifdef CMSSW_GIT_HASH
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#endif

namespace l1ct {
Expand All @@ -22,6 +23,12 @@ namespace l1ct {
: PFTkEGSorterEmulator(iConfig.getParameter<uint32_t>("nObjToSort"),
iConfig.getParameter<uint32_t>("nObjSorted")) {}

static edm::ParameterSetDescription getParameterSetDescription() {
edm::ParameterSetDescription description;
description.add<uint32_t>("nObjToSort");
description.add<uint32_t>("nObjSorted");
return description;
}
#endif

virtual ~PFTkEGSorterEmulator() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@

#include "DataFormats/L1TParticleFlow/interface/layer1_emulator.h"

namespace edm {
class ParameterSet;
class ParameterSetDescription;
} // namespace edm

namespace l1ct {
class HgcalClusterDecoderEmulator {
bool slim_;

public:
HgcalClusterDecoderEmulator(){};
HgcalClusterDecoderEmulator(bool slim = false) : slim_{slim} {};
HgcalClusterDecoderEmulator(const edm::ParameterSet &pset);

~HgcalClusterDecoderEmulator();

static edm::ParameterSetDescription getParameterSetDescription();

l1ct::HadCaloObjEmu decode(const ap_uint<256> &in) const;
};
} // namespace l1ct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {
class GMTMuonDecoderEmulator {
public:
GMTMuonDecoderEmulator(float z0Scale, float dxyScale);
GMTMuonDecoderEmulator(const edm::ParameterSet &iConfig);

~GMTMuonDecoderEmulator();

static edm::ParameterSetDescription getParameterSetDescription();

l1ct::MuObjEmu decode(const ap_uint<64> &in) const;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {
class TrackInputEmulator {
Expand All @@ -27,6 +28,8 @@ namespace l1ct {
bool bitwise = true,
bool slim = true);

static edm::ParameterSetDescription getParameterSetDescription();

std::pair<l1ct::TkObjEmu, bool> decodeTrack(ap_uint<96> tkword, const l1ct::PFRegionEmu &sector) const {
return decodeTrack(tkword, sector, bitwise_, slim_);
}
Expand Down
5 changes: 4 additions & 1 deletion L1Trigger/Phase2L1ParticleFlow/interface/pf/pfalgo2hgc_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand All @@ -27,6 +28,8 @@ namespace l1ct {

~PFAlgo2HGCEmulator() override {}

static edm::ParameterSetDescription getParameterSetDescription();

void run(const PFInputRegion& in, OutputRegion& out) const override;

/// moves all objects from out.pfphoton to the beginning of out.pfneutral: nothing to do for this algo
Expand Down
5 changes: 4 additions & 1 deletion L1Trigger/Phase2L1ParticleFlow/interface/pf/pfalgo3_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand Down Expand Up @@ -37,6 +38,8 @@ namespace l1ct {

~PFAlgo3Emulator() override {}

static edm::ParameterSetDescription getParameterSetDescription();

void run(const PFInputRegion& in, OutputRegion& out) const override;

void toFirmware(const PFInputRegion& in,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand Down Expand Up @@ -38,6 +39,7 @@ namespace l1ct {
void loadPtErrBins(
unsigned int nbins, const float absetas[], const float scales[], const float offs[], bool verbose = false);
void loadPtErrBins(const edm::ParameterSet& iConfig);
static void addCaloResolutionParameterSetDescription(edm::ParameterSetDescription& to);

void setDebug(bool debug = true) { debug_ = debug; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand All @@ -18,6 +19,8 @@ namespace l1ct {

~PFAlgoDummyEmulator() override {}

static edm::ParameterSetDescription getParameterSetDescription();

void run(const PFInputRegion& in, OutputRegion& out) const override;

/// moves all objects from out.pfphoton to the beginning of out.pfneutral: nothing to do for this algo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand Down Expand Up @@ -138,6 +139,8 @@ namespace l1ct {

LinPuppiEmulator(const edm::ParameterSet &iConfig);

static edm::ParameterSetDescription getParameterSetDescription();

// charged
void linpuppi_chs_ref(const PFRegionEmu &region,
const PVObjEmu &pv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ namespace l1ct {
unsigned int outii,
unsigned int pauseii,
bool useAlsoVtxCoords);
// note: this one will work only in CMSSW
BufferedFoldedMultififoRegionizerEmulator(const edm::ParameterSet& iConfig);

~BufferedFoldedMultififoRegionizerEmulator() override;

static edm::ParameterSetDescription getParameterSetDescription();

void initSectorsAndRegions(const RegionizerDecodedInputs& in, const std::vector<PFInputRegion>& out) override;

void run(const RegionizerDecodedInputs& in, std::vector<PFInputRegion>& out) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
#define multififo_regionizer_ref_h

#include "L1Trigger/Phase2L1ParticleFlow/interface/regionizer/regionizer_base_ref.h"
#include "L1Trigger/Phase2L1ParticleFlow/interface/egamma/pfeginput_ref.h"
#include "L1Trigger/Phase2L1ParticleFlow/interface/regionizer/multififo_regionizer_elements_ref.h"
#include <memory>

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {
class EGInputSelectorEmulator;
Expand Down Expand Up @@ -49,6 +51,9 @@ namespace l1ct {

~MultififoRegionizerEmulator() override;

static edm::ParameterSetDescription getParameterSetDescription();
static edm::ParameterSetDescription getParameterSetDescriptionBarrel();

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

void setEgInterceptMode(bool afterFifo, const l1ct::EGInputSelectorEmuConfig& interceptorConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

namespace edm {
class ParameterSet;
}
class ParameterSetDescription;
} // namespace edm

namespace l1ct {

Expand All @@ -16,6 +17,8 @@ namespace l1ct {

virtual ~RegionizerEmulator();

static edm::ParameterSetDescription getParameterSetDescription();

void setDebug(bool debug = true) { debug_ = debug; }

virtual void initSectorsAndRegions(const RegionizerDecodedInputs& in, const std::vector<PFInputRegion>& out) {}
Expand Down
Loading