Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-03 19:40:38

0001 #include "FWCore/MessageLogger/interface/MessageLogger.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 "CaloLayer1Setup.h"
0008 
0009 namespace l1t {
0010   namespace stage2 {
0011     std::unique_ptr<PackerTokens> CaloLayer1Setup::registerConsumes(const edm::ParameterSet& cfg,
0012                                                                     edm::ConsumesCollector& cc) {
0013       return std::unique_ptr<PackerTokens>(new CaloLayer1Tokens(cfg, cc));
0014     }
0015 
0016     void CaloLayer1Setup::fillDescription(edm::ParameterSetDescription& desc) {
0017       desc.addOptional<edm::InputTag>("ecalDigis");
0018       desc.addOptional<edm::InputTag>("hcalDigis");
0019       desc.addOptional<edm::InputTag>("caloRegions");
0020     }
0021 
0022     PackerMap CaloLayer1Setup::getPackers(int fed, unsigned int fw) {
0023       PackerMap res;
0024 
0025       if (fed == 1354) {
0026         // AMC #, board #
0027         res[{2, 3}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0028         res[{3, 4}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0029         res[{5, 5}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0030         res[{8, 6}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0031         res[{9, 7}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0032         res[{11, 8}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0033       } else if (fed == 1356) {
0034         // AMC #, board #
0035         res[{2, 15}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0036         res[{3, 16}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0037         res[{5, 17}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0038         res[{8, 0}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0039         res[{9, 1}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0040         res[{11, 2}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0041       } else if (fed == 1358) {
0042         // AMC #, board #
0043         res[{2, 9}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0044         res[{3, 10}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0045         res[{5, 11}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0046         res[{8, 12}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0047         res[{9, 13}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0048         res[{11, 14}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
0049       }
0050 
0051       return res;
0052     }
0053 
0054     void CaloLayer1Setup::registerProducts(edm::ProducesCollector prod) {
0055       prod.produces<EcalTrigPrimDigiCollection>();
0056       prod.produces<HcalTrigPrimDigiCollection>();
0057       prod.produces<L1CaloRegionCollection>();
0058       for (int i = 0; i < 5; ++i) {
0059         prod.produces<EcalTrigPrimDigiCollection>("EcalDigisBx" + std::to_string(i + 1));
0060       }
0061     }
0062 
0063     std::unique_ptr<UnpackerCollections> CaloLayer1Setup::getCollections(edm::Event& e) {
0064       return std::unique_ptr<UnpackerCollections>(new CaloLayer1Collections(e));
0065     }
0066 
0067     UnpackerMap CaloLayer1Setup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
0068       UnpackerMap res;
0069       LogDebug("L1T") << "CaloLayer1Setup: about to pick an unpacker for fed " << fed << " board " << board << " amc "
0070                       << amc << " fw 0x" << std::hex << fw << std::dec;
0071       if (fed == 1354 || fed == 1356 || fed == 1358) {
0072         if (board < 18) {
0073           res[0] = UnpackerFactory::get()->make("stage2::CaloLayer1Unpacker");
0074         }
0075       }
0076 
0077       return res;
0078     }
0079   }  // namespace stage2
0080 }  // namespace l1t
0081 
0082 DEFINE_L1T_PACKING_SETUP(l1t::stage2::CaloLayer1Setup);