Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:36:13

0001 #include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
0002 #include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h"
0003 #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
0004 
0005 #include "BMTFSetup.h"
0006 
0007 namespace l1t {
0008   namespace stage2 {
0009 
0010     std::unique_ptr<PackerTokens> BMTFSetup::registerConsumes(const edm::ParameterSet& cfg,
0011                                                               edm::ConsumesCollector& cc) {
0012       return std::unique_ptr<PackerTokens>(new BMTFTokens(cfg, cc));
0013     }
0014 
0015     void BMTFSetup::fillDescription(edm::ParameterSetDescription& desc) {}
0016 
0017     PackerMap BMTFSetup::getPackers(int fed, unsigned int fw) {
0018       PackerMap res;
0019       //res are in format res[amc_no, board_id]
0020 
0021       if (fed == 1376 || fed == 1377) {
0022         for (auto board : boardIdPerSlot) {
0023           auto packer_out = std::make_shared<BMTFPackerOutput>();
0024           auto packer_in = PackerFactory::get()->make("stage2::BMTFPackerInputs");
0025           if (fw >= firstKalmanFwVer) {
0026             packer_out->setKalmanAlgoTrue();
0027           }
0028           res[{board.first, board.second}] = {packer_out, packer_in};
0029         }
0030       }  //if BMTF feds
0031 
0032       return res;
0033     }  //getPackers
0034 
0035     void BMTFSetup::registerProducts(edm::ProducesCollector prod) {
0036       prod.produces<RegionalMuonCandBxCollection>("BMTF");
0037       prod.produces<RegionalMuonCandBxCollection>("BMTF2");
0038       prod.produces<L1MuDTChambPhContainer>();
0039       prod.produces<L1MuDTChambThContainer>();
0040     }
0041 
0042     std::unique_ptr<UnpackerCollections> BMTFSetup::getCollections(edm::Event& e) {
0043       return std::unique_ptr<UnpackerCollections>(new BMTFCollections(e));
0044     }
0045 
0046     UnpackerMap BMTFSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
0047       auto inputMuonsOld = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsOldQual");
0048       auto inputMuonsNew = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsNewQual");
0049       auto outputMuon = std::make_shared<BMTFUnpackerOutput>();        // triggering collection
0050       auto outputMuon2 = std::make_shared<BMTFUnpackerOutput>(false);  // secondary coll
0051       if (fw >= firstKalmanFwVer)
0052         outputMuon->setKalmanAlgoTrue();
0053       else
0054         outputMuon2->setKalmanAlgoTrue();
0055 
0056       UnpackerMap res;
0057       if (fed == 1376 || fed == 1377) {
0058         // Input links
0059         for (int iL = 0; iL <= 70; iL += 2) {
0060           if (iL == 12 || iL == 14 || (iL > 26 && iL < 32) || iL == 60 || iL == 62)
0061             continue;
0062 
0063           if (fw < firstNewInputsFwVer) {
0064             res[iL] = inputMuonsOld;
0065           } else {
0066             res[iL] = inputMuonsNew;
0067           }
0068         }
0069 
0070         // Output links
0071         res[123] = outputMuon;
0072         res[125] = outputMuon2;
0073       }
0074 
0075       return res;
0076     };
0077   };  // namespace stage2
0078 }  // namespace l1t
0079 
0080 DEFINE_L1T_PACKING_SETUP(l1t::stage2::BMTFSetup);