Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-16 00:05:33

0001 #include "FWCore/Utilities/interface/InputTag.h"
0002 
0003 #include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
0004 #include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h"
0005 #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
0006 
0007 #include "EMTFSetup.h"
0008 
0009 namespace l1t {
0010   namespace stage2 {
0011     std::unique_ptr<PackerTokens> EMTFSetup::registerConsumes(const edm::ParameterSet& cfg,
0012                                                               edm::ConsumesCollector& cc) {
0013       return std::unique_ptr<PackerTokens>(new EMTFTokens(cfg, cc));
0014     }
0015 
0016     // Not sure what this block does, or if it's necessary - AWB 27.01.16
0017     void EMTFSetup::fillDescription(edm::ParameterSetDescription& desc) {
0018       desc.addOptional<edm::InputTag>("EMTFInputLabelAWB")->setComment("for stage2");
0019     }
0020 
0021     PackerMap EMTFSetup::getPackers(int fed, unsigned int fw) {
0022       PackerMap res;
0023 
0024       if (fed == 1402) {
0025         // Use amc_no and board id 1 for packing
0026         res[{1, 1}] = {
0027             // "RegionalMuonEMTFPacker" should be defined in RegionalMuonEMTFPacker.cc - AWB 11.01.15
0028             PackerFactory::get()->make("stage2::RegionalMuonEMTFPacker"),
0029             // Should we even be doing a MuonPacker? = AWB 11.01.15
0030             PackerFactory::get()->make("stage2::MuonPacker"),
0031         };
0032       }
0033 
0034       return res;
0035     }
0036 
0037     void EMTFSetup::registerProducts(edm::ProducesCollector prod) {
0038       prod.produces<RegionalMuonCandBxCollection>();
0039       prod.produces<RegionalMuonShowerBxCollection>();
0040       prod.produces<EMTFDaqOutCollection>();
0041       prod.produces<EMTFHitCollection>();
0042       prod.produces<EMTFTrackCollection>();
0043       prod.produces<CSCCorrelatedLCTDigiCollection>();
0044       prod.produces<CSCShowerDigiCollection>();
0045       prod.produces<CPPFDigiCollection>();
0046       prod.produces<GEMPadDigiClusterCollection>();
0047     }
0048 
0049     std::unique_ptr<UnpackerCollections> EMTFSetup::getCollections(edm::Event& e) {
0050       return std::unique_ptr<UnpackerCollections>(new EMTFCollections(e));
0051     }
0052 
0053     UnpackerMap EMTFSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
0054       // std::cout << "Inside EMTFSetup.cc: getUnpackers" << std::endl;
0055 
0056       // Presumably need some logic based on fed, amc, etc (c.f. CaloSetup.cc) - AWB 11.01.16
0057       UnpackerMap res;
0058 
0059       // "RegionalMuonEMTFPacker" should be defined in RegionalMuonEMTFPacker.cc - AWB 11.01.15
0060 
0061       auto emtf_headers_unp = UnpackerFactory::get()->make(
0062           "stage2::emtf::HeadersBlockUnpacker");  // Unpack "AMC data header" and "Event Record Header"
0063       auto emtf_counters_unp =
0064           UnpackerFactory::get()->make("stage2::emtf::CountersBlockUnpacker");             // Unpack "Block of Counters"
0065       auto emtf_me_unp = UnpackerFactory::get()->make("stage2::emtf::MEBlockUnpacker");    // Unpack "ME Data Record"
0066       auto emtf_rpc_unp = UnpackerFactory::get()->make("stage2::emtf::RPCBlockUnpacker");  // Unpack "RPC Data Record"
0067       auto emtf_gem_unp = UnpackerFactory::get()->make("stage2::emtf::GEMBlockUnpacker");  // Unpack "GEM Data Record"
0068       // auto emtf_me0_unp = UnpackerFactory::get()->make("stage2::emtf::ME0BlockUnpacker"); // Unpack "ME0 Data Record"
0069       auto emtf_sp_unp =
0070           UnpackerFactory::get()->make("stage2::emtf::SPBlockUnpacker");  // Unpack "SP Output Data Record"
0071       auto emtf_trailers_unp =
0072           UnpackerFactory::get()->make("stage2::emtf::TrailersBlockUnpacker");  // Unpack "Event Record Trailer"
0073 
0074       // All unpacker units apart from header and trailer now requires algo version - EY 14.09.22
0075       emtf_me_unp->setAlgoVersion(fw);
0076       emtf_sp_unp->setAlgoVersion(fw);
0077       emtf_rpc_unp->setAlgoVersion(fw);
0078       emtf_gem_unp->setAlgoVersion(fw);
0079 
0080       // Index of res is block->header().getID(), matching block_patterns_ in src/Block.cc
0081       res[l1t::mtf7::EvHd] = emtf_headers_unp;
0082       res[l1t::mtf7::CnBlk] = emtf_counters_unp;
0083       res[l1t::mtf7::ME] = emtf_me_unp;
0084       res[l1t::mtf7::RPC] = emtf_rpc_unp;
0085       res[l1t::mtf7::GEM] = emtf_gem_unp;
0086       // res[l1t::mtf7::ME0]  = emtf_me0_unp;
0087       res[l1t::mtf7::SPOut] = emtf_sp_unp;
0088       res[l1t::mtf7::EvTr] = emtf_trailers_unp;
0089 
0090       return res;
0091     }  // End virtual UnpackerMap getUnpackers
0092   }    // End namespace stage2
0093 }  // End namespace l1t
0094 
0095 DEFINE_L1T_PACKING_SETUP(l1t::stage2::EMTFSetup);