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

Era support for the BMTF Packer #32367

Closed
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "BMTFPackerOutput.h"

#include <vector>
//#include <bitset>//debug

// Implementation
namespace l1t {
Expand All @@ -12,8 +10,9 @@ namespace l1t {
auto muonToken = static_cast<const BMTFTokens*>(toks)->getOutputMuonToken();

Blocks blocks;

const int bmtfBlockID = 123;
edm::LogInfo("L1T-BMTFPackerOutput") << "Will use setup:"
<< " isKalman->" << isKalman_;

edm::Handle<RegionalMuonCandBxCollection> muons;
event.getByToken(muonToken, muons);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "EventFilter/L1TRawToDigi/interface/Packer.h"
#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,15 @@ namespace l1t {
//res are in format res[amc_no, board_id]

if (fed == 1376 || fed == 1377) {
std::array<int, 12> board_out = {{1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12}}; //these are board_ids per amc_no-1

for (unsigned int i = 1; i <= board_out.size(); i++) {
if (i % 2 != 0) { //maybe this check is not needed
res[{i, board_out[i - 1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
PackerFactory::get()->make("stage2::BMTFPackerInputs")};
} else {
res[{i, board_out[i - 1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
PackerFactory::get()->make("stage2::BMTFPackerInputs")};
for (auto board : boardIdPerSlot) {
auto packer_out = std::make_shared<BMTFPackerOutput>();
auto packer_in = PackerFactory::get()->make("stage2::BMTFPackerInputs");
if (fw >= firstKalmanFwVer) {
packer_out->setKalmanAlgoTrue();
}
res[{board.first, board.second}] = {packer_out, packer_in};
}
} //if feds

/*
if (fed == 1376) {
std::cout << "fed is 1376" << std::endl;
for (int i=1; i <= 12; i = i+2){//itr for amc_no = 1,3,5,7,9,11
res[{i,board_out[i-1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
PackerFactory::get()->make("stage2::BMTFPackerInputs")};
}

}
else if (fed == 1377) {
std::cout << "fed is 1377" << std::endl;
for (int i=2; i <=12; i = i+2){//itr for amc_no = 2,4,6,8,10,12
res[{i,board_out[i-1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
PackerFactory::get()->make("stage2::BMTFPackerInputs")};
}

}
else{
std::cout << std::endl;
std::cout << "The given fed is not a BMTF fed (1376 or 1377)" << std::endl;
std::cout << std::endl;
}//if feds
*/
} //if BMTF feds

return res;
} //getPackers
Expand All @@ -64,10 +37,6 @@ namespace l1t {
prod.produces<RegionalMuonCandBxCollection>("BMTF2");
prod.produces<L1MuDTChambPhContainer>();
prod.produces<L1MuDTChambThContainer>();

// Depricated
//prod.produces<L1MuDTChambPhContainer>("PhiDigis");
//prod.produces<L1MuDTChambThContainer>("TheDigis");
}

std::unique_ptr<UnpackerCollections> BMTFSetup::getCollections(edm::Event& e) {
Expand All @@ -77,10 +46,9 @@ namespace l1t {
UnpackerMap BMTFSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
auto inputMuonsOld = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsOldQual");
auto inputMuonsNew = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsNewQual");

auto outputMuon = std::make_shared<BMTFUnpackerOutput>(); //here is the triggering collection
auto outputMuon2 = std::make_shared<BMTFUnpackerOutput>(false); //here is the secondary
if (fw >= 2499805536) //this is in HEX '95000160'
auto outputMuon = std::make_shared<BMTFUnpackerOutput>(); // triggering collection
auto outputMuon2 = std::make_shared<BMTFUnpackerOutput>(false); // secondary coll
if (fw >= firstKalmanFwVer)
outputMuon->setKalmanAlgoTrue();
else
outputMuon2->setKalmanAlgoTrue();
Expand All @@ -92,7 +60,7 @@ namespace l1t {
if (iL == 12 || iL == 14 || (iL > 26 && iL < 32) || iL == 60 || iL == 62)
continue;

if (fw < 2452619552) {
if (fw < firstNewInputsFwVer) {
res[iL] = inputMuonsOld;
} else {
res[iL] = inputMuonsNew;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "BMTFCollections.h"
#include "BMTFTokens.h"
#include "BMTFUnpackerOutput.h"
#include "BMTFPackerOutput.h"

namespace l1t {
namespace stage2 {
Expand All @@ -20,6 +21,25 @@ namespace l1t {
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;

private:
const std::map<int, int> boardIdPerSlot{
// {slot, boardId}
{1, 1},
{3, 2},
{5, 3},
{7, 4},
{9, 5},
{11, 6}, // Top Crate
{2, 7},
{4, 8},
{6, 9},
{8, 10},
{10, 11},
{12, 12} // Bottom Crate
};
const unsigned int firstNewInputsFwVer = 0x92300120;
const unsigned int firstKalmanFwVer = 0x95000160;
};
} // namespace stage2
} // namespace l1t
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"

#include "L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h"

#include "BMTFUnpackerOutput.h"

namespace l1t {
Expand All @@ -22,6 +20,10 @@ namespace l1t {
bxBlocks =
block.getBxBlocks((unsigned int)6, false); //it returnes 6-32bit bxBlocks originated from the amc13 Block

edm::LogInfo("L1T") << "Will use the setup:"
<< " ZS_enabled->" << ZS_enabled << " isTriggeringAlgo->" << isTriggeringAlgo << " isKalman->"
<< isKalman;

RegionalMuonCandBxCollection *res;
if (isTriggeringAlgo)
res = static_cast<BMTFCollections *>(coll)->getBMTFMuons();
Expand All @@ -45,8 +47,7 @@ namespace l1t {

int processor = block.amc().getBoardID() - 1;
if (processor < 0 || processor > 11) {
edm::LogInfo("l1t:stage2::BMTFUnpackerOutput::unpack")
<< "Processor found out of range so it will be calculated by the old way";
edm::LogInfo("L1T") << "Processor found out of range, it will be calculated by the old way";
if (block.amc().getAMCNumber() % 2 != 0)
processor = block.amc().getAMCNumber() / 2;
else
Expand Down
17 changes: 17 additions & 0 deletions EventFilter/L1TRawToDigi/python/bmtfDigis_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,27 @@
InputLabel = cms.InputTag("rawDataCollector"),
FedIds = cms.vint32(1376,1377),
FWId = cms.uint32(1),
FWOverride = cms.bool(False),
lenSlinkHeader = cms.untracked.int32(8),
lenSlinkTrailer = cms.untracked.int32(8),
lenAMCHeader = cms.untracked.int32(8),
lenAMCTrailer = cms.untracked.int32(0),
lenAMC13Header = cms.untracked.int32(8),
lenAMC13Trailer = cms.untracked.int32(8)
)

## Era: Run2_2016
from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
stage2L1Trigger.toModify(bmtfDigis, FWId = cms.uint32(0x93500160))

## Era: Run2_2017
from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
stage2L1Trigger_2017.toModify(bmtfDigis, FWId = cms.uint32(0x93500160))

### Era: Run2_2018
from Configuration.Eras.Modifier_stage2L1Trigger_2018_cff import stage2L1Trigger_2018
stage2L1Trigger_2018.toModify(bmtfDigis, FWId = cms.uint32(0x93500160))

### Era: Run3_2021
from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021
stage2L1Trigger_2021.toModify(bmtfDigis, FWId = cms.uint32(0x95030160))
8 changes: 4 additions & 4 deletions EventFilter/L1TRawToDigi/python/bmtfStage2Raw_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

## Era: Run2_2016
from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger
stage2L1Trigger.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(1))
stage2L1Trigger.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(0x93500160))

## Era: Run2_2017
from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
stage2L1Trigger_2017.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(1))
stage2L1Trigger_2017.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(0x93500160))

### Era: Run2_2018
from Configuration.Eras.Modifier_stage2L1Trigger_2018_cff import stage2L1Trigger_2018
stage2L1Trigger_2018.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(1))
stage2L1Trigger_2018.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(0x93500160))

### Era: Run3_2021
from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021
stage2L1Trigger_2021.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(2499805536))
stage2L1Trigger_2021.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x95030160))