Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions L1Trigger/L1TCaloLayer1/plugins/L1TCaloLayer1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class L1TCaloLayer1 : public edm::stream::EDProducer<> {
std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> > ecalLUT;
std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> > hcalLUT;
std::vector<std::array<std::array<uint32_t, nEtBins>, nHfEtaBins> > hfLUT;
std::vector<unsigned long long int> hcalFBLUT;

std::vector<unsigned int> ePhiMap;
std::vector<unsigned int> hPhiMap;
Expand All @@ -93,6 +94,7 @@ class L1TCaloLayer1 : public edm::stream::EDProducer<> {
bool useECALLUT;
bool useHCALLUT;
bool useHFLUT;
bool useHCALFBLUT;
bool verbose;
bool unpackHcalMask;
bool unpackEcalMask;
Expand Down Expand Up @@ -128,7 +130,8 @@ L1TCaloLayer1::L1TCaloLayer1(const edm::ParameterSet& iConfig)
useECALLUT(iConfig.getParameter<bool>("useECALLUT")),
useHCALLUT(iConfig.getParameter<bool>("useHCALLUT")),
useHFLUT(iConfig.getParameter<bool>("useHFLUT")),
verbose(iConfig.getParameter<bool>("verbose")),
useHCALFBLUT(iConfig.getParameter<bool>("useHCALFBLUT")),
verbose(iConfig.getUntrackedParameter<bool>("verbose")),
unpackHcalMask(iConfig.getParameter<bool>("unpackHcalMask")),
unpackEcalMask(iConfig.getParameter<bool>("unpackEcalMask")),
fwVersion(iConfig.getParameter<int>("firmwareVersion")) {
Expand Down Expand Up @@ -294,6 +297,7 @@ void L1TCaloLayer1::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup
ecalLUT,
hcalLUT,
hfLUT,
hcalFBLUT,
ePhiMap,
hPhiMap,
hfPhiMap,
Expand All @@ -302,6 +306,7 @@ void L1TCaloLayer1::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup
useECALLUT,
useHCALLUT,
useHFLUT,
useHCALFBLUT,
fwVersion)) {
LOG_ERROR << "L1TCaloLayer1::beginRun: failed to fetch LUTS - using unity" << std::endl;
std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> eCalLayer1EtaSideEtArray;
Expand Down Expand Up @@ -363,7 +368,8 @@ void L1TCaloLayer1::fillDescriptions(edm::ConfigurationDescriptions& description
desc.add<bool>("useECALLUT", true);
desc.add<bool>("useHCALLUT", true);
desc.add<bool>("useHFLUT", true);
desc.add<bool>("verbose", false);
desc.add<bool>("useHCALFBLUT", false);
desc.addUntracked<bool>("verbose", false);
desc.add<bool>("unpackEcalMask", false);
desc.add<bool>("unpackHcalMask", false);
desc.add<int>("firmwareVersion", 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
useECALLUT = cms.bool(True),
useHCALLUT = cms.bool(True),
useHFLUT = cms.bool(True),
verbose = cms.bool(False),
useHCALFBLUT = cms.bool(False),
verbose = cms.untracked.bool(False),
unpackEcalMask = cms.bool(False),
unpackHcalMask = cms.bool(False),
# See UCTLayer1.hh for firmware version
Expand Down
31 changes: 31 additions & 0 deletions L1Trigger/L1TCaloLayer1/src/L1TCaloLayer1FetchLUTs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ bool L1TCaloLayer1FetchLUTs(
std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> > &eLUT,
std::vector<std::array<std::array<std::array<uint32_t, nEtBins>, nCalSideBins>, nCalEtaBins> > &hLUT,
std::vector<std::array<std::array<uint32_t, nEtBins>, nHfEtaBins> > &hfLUT,
std::vector<unsigned long long int> &hcalFBLUT,
std::vector<unsigned int> &ePhiMap,
std::vector<unsigned int> &hPhiMap,
std::vector<unsigned int> &hfPhiMap,
Expand All @@ -40,6 +41,7 @@ bool L1TCaloLayer1FetchLUTs(
bool useECALLUT,
bool useHCALLUT,
bool useHFLUT,
bool useHCALFBLUT,
int fwVersion) {
int hfValid = 1;
const HcalTrigTowerGeometry &pG = iSetup.getData(iTokens.geom_);
Expand Down Expand Up @@ -128,6 +130,26 @@ bool L1TCaloLayer1FetchLUTs(
"scale factors in CaloParams! Please check conditions setup.";
return false;
}

// HCAL FB LUT will be a 1*28 array:
// ieta = 28 eta scale factors (1 .. 28)
// So, index = ieta
auto fbLUTUpper = caloParams.layer1HCalFBLUTUpper();
auto fbLUTLower = caloParams.layer1HCalFBLUTLower();
// Only check for HCAL FB LUT if useHCALFBLUT = true
if (useHCALFBLUT) {
if (fbLUTUpper.size() != nCalEtaBins) {
edm::LogError("L1TCaloLayer1FetchLUTs")
<< "caloParams.layer1HCalFBLUTUpper().size() " << fbLUTUpper.size() << " != " << nCalEtaBins << " !!";
return false;
}
if (fbLUTLower.size() != nCalEtaBins) {
edm::LogError("L1TCaloLayer1FetchLUTs")
<< "caloParams.layer1HCalFBLUTLower().size() " << fbLUTLower.size() << " != " << nCalEtaBins << " !!";
return false;
}
}

// get energy scale to convert input from ECAL - this should be linear with LSB = 0.5 GeV
const double ecalLSB = 0.5;

Expand Down Expand Up @@ -331,6 +353,15 @@ bool L1TCaloLayer1FetchLUTs(
}
}

// Make HCal FB LUT
for (uint32_t etaBin = 0; etaBin < nCalEtaBins; etaBin++) {
uint64_t value = 0xFFFFFFFFFFFFFFFF;
if (useHCALFBLUT) {
value = (((uint64_t)fbLUTUpper.at(etaBin)) << 32) | fbLUTLower.at(etaBin);
}
hcalFBLUT.push_back(value);
}

// plus/minus, 18 CTP7, 4 iPhi each
for (uint32_t isPos = 0; isPos < 2; isPos++) {
for (uint32_t iPhi = 1; iPhi <= 72; iPhi++) {
Expand Down
2 changes: 2 additions & 0 deletions L1Trigger/L1TCaloLayer1/src/L1TCaloLayer1FetchLUTs.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ bool L1TCaloLayer1FetchLUTs(
std::vector<std::array<std::array<std::array<uint32_t, l1tcalo::nEtBins>, l1tcalo::nCalSideBins>,
l1tcalo::nCalEtaBins> > &hLUT,
std::vector<std::array<std::array<uint32_t, l1tcalo::nEtBins>, l1tcalo::nHfEtaBins> > &hfLUT,
std::vector<unsigned long long int> &hcalFBLUT,
std::vector<unsigned int> &ePhiMap,
std::vector<unsigned int> &hPhiMap,
std::vector<unsigned int> &hfPhiMap,
Expand All @@ -42,6 +43,7 @@ bool L1TCaloLayer1FetchLUTs(
bool useECALLUT = true,
bool useHCALLUT = true,
bool useHFLUT = true,
bool useHCALFBLUT = true,
int fwVersion = 0);

#endif
1 change: 1 addition & 0 deletions L1Trigger/L1TCaloLayer1/test/testL1TCaloLayer1.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def formatLumis(lumistring, run) :
process.simCaloStage2Layer1Digis.useECALLUT = cms.bool(True)
process.simCaloStage2Layer1Digis.useHCALLUT = cms.bool(True)
process.simCaloStage2Layer1Digis.useHFLUT = cms.bool(True)
process.simCaloStage2Layer1Digis.useHCALFBLUT = cms.bool(False),
process.simCaloStage2Layer1Digis.useLSB = cms.bool(True)
process.simCaloStage2Layer1Digis.verbose = cms.bool(True)
process.simCaloStage2Layer1Digis.ecalToken = cms.InputTag("simEcalTriggerPrimitiveDigis"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
process.simCaloStage2Layer1Digis.useECALLUT = cms.bool(False)
process.simCaloStage2Layer1Digis.useHCALLUT = cms.bool(False)
process.simCaloStage2Layer1Digis.useHFLUT = cms.bool(False)
process.simCaloStage2Layer1Digis.useHCALFBLUT = cms.bool(False),
process.simCaloStage2Layer1Digis.useLSB = cms.bool(False)
process.simCaloStage2Layer1Digis.verbose = cms.bool(True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
process.simCaloStage2Layer1Digis.useECALLUT = cms.bool(True)
process.simCaloStage2Layer1Digis.useHCALLUT = cms.bool(True)
process.simCaloStage2Layer1Digis.useHFLUT = cms.bool(False)
process.simCaloStage2Layer1Digis.useHCALFBLUT = cms.bool(False),
process.simCaloStage2Layer1Digis.useLSB = cms.bool(True)
process.simCaloStage2Layer1Digis.verbose = cms.bool(False)

Expand Down
12 changes: 11 additions & 1 deletion L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ namespace l1t {
jetPUSUsePhiRingFlag = 47,
metPhiCalibration = 48,
metHFPhiCalibration = 49,
NUM_CALOPARAMNODES = 50
layer1HCalFBUpper = 50,
layer1HCalFBLower = 51,
NUM_CALOPARAMNODES = 52
};

CaloParamsHelper() { pnode_.resize(NUM_CALOPARAMNODES); }
Expand Down Expand Up @@ -551,6 +553,8 @@ namespace l1t {
std::vector<double> const& layer1ECalScaleFactors() const { return pnode_[layer1ECal].dparams_; }
std::vector<double> const& layer1HCalScaleFactors() const { return pnode_[layer1HCal].dparams_; }
std::vector<double> const& layer1HFScaleFactors() const { return pnode_[layer1HF].dparams_; }
std::vector<unsigned> const& layer1HCalFBLUTUpper() const { return pnode_[layer1HCalFBUpper].uparams_; }
std::vector<unsigned> const& layer1HCalFBLUTLower() const { return pnode_[layer1HCalFBLower].uparams_; }
std::vector<int> const& layer1ECalScaleETBins() const { return pnode_[layer1ECal].iparams_; }
std::vector<int> const& layer1HCalScaleETBins() const { return pnode_[layer1HCal].iparams_; }
std::vector<int> const& layer1HFScaleETBins() const { return pnode_[layer1HF].iparams_; }
Expand All @@ -560,6 +564,12 @@ namespace l1t {
void setLayer1ECalScaleFactors(std::vector<double> params) { pnode_[layer1ECal].dparams_ = std::move(params); }
void setLayer1HCalScaleFactors(std::vector<double> params) { pnode_[layer1HCal].dparams_ = std::move(params); }
void setLayer1HFScaleFactors(std::vector<double> params) { pnode_[layer1HF].dparams_ = std::move(params); }
void setLayer1HCalFBLUTUpper(std::vector<unsigned> params) {
pnode_[layer1HCalFBUpper].uparams_ = std::move(params);
}
void setLayer1HCalFBLUTLower(std::vector<unsigned> params) {
pnode_[layer1HCalFBLower].uparams_ = std::move(params);
}
void setLayer1ECalScaleETBins(std::vector<int> params) { pnode_[layer1ECal].iparams_ = std::move(params); }
void setLayer1HCalScaleETBins(std::vector<int> params) { pnode_[layer1HCal].iparams_ = std::move(params); }
void setLayer1HFScaleETBins(std::vector<int> params) { pnode_[layer1HF].iparams_ = std::move(params); }
Expand Down
2 changes: 2 additions & 0 deletions L1Trigger/L1TCalorimeter/plugins/L1TCaloParamsESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ L1TCaloParamsESProducer::L1TCaloParamsESProducer(const edm::ParameterSet& conf)
m_params_helper.setLayer1ECalScaleFactors(conf.getParameter<std::vector<double>>("layer1ECalScaleFactors"));
m_params_helper.setLayer1HCalScaleFactors(conf.getParameter<std::vector<double>>("layer1HCalScaleFactors"));
m_params_helper.setLayer1HFScaleFactors(conf.getParameter<std::vector<double>>("layer1HFScaleFactors"));
m_params_helper.setLayer1HCalFBLUTUpper(conf.getParameter<std::vector<unsigned>>("layer1HCalFBLUTUpper"));
m_params_helper.setLayer1HCalFBLUTLower(conf.getParameter<std::vector<unsigned>>("layer1HCalFBLUTLower"));

m_params_helper.setLayer1ECalScaleETBins(conf.getParameter<std::vector<int>>("layer1ECalScaleETBins"));
m_params_helper.setLayer1HCalScaleETBins(conf.getParameter<std::vector<int>>("layer1HCalScaleETBins"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ L1TCaloStage2ParamsESProducer::L1TCaloStage2ParamsESProducer(const edm::Paramete
m_params_helper.setLayer1ECalScaleFactors(conf.getParameter<std::vector<double>>("layer1ECalScaleFactors"));
m_params_helper.setLayer1HCalScaleFactors(conf.getParameter<std::vector<double>>("layer1HCalScaleFactors"));
m_params_helper.setLayer1HFScaleFactors(conf.getParameter<std::vector<double>>("layer1HFScaleFactors"));
m_params_helper.setLayer1HCalFBLUTUpper(conf.getParameter<std::vector<unsigned>>("layer1HCalFBLUTUpper"));
m_params_helper.setLayer1HCalFBLUTLower(conf.getParameter<std::vector<unsigned>>("layer1HCalFBLUTLower"));

m_params_helper.setLayer1ECalScaleETBins(conf.getParameter<std::vector<int>>("layer1ECalScaleETBins"));
m_params_helper.setLayer1HCalScaleETBins(conf.getParameter<std::vector<int>>("layer1HCalScaleETBins"));
Expand Down
Loading