CMS 3D CMS Logo

CaloLayer1Setup.cc
Go to the documentation of this file.
2 
6 
7 #include "CaloLayer1Setup.h"
8 
9 namespace l1t {
10  namespace stage2 {
11  std::unique_ptr<PackerTokens> CaloLayer1Setup::registerConsumes(const edm::ParameterSet& cfg,
13  return std::unique_ptr<PackerTokens>(new CaloLayer1Tokens(cfg, cc));
14  }
15 
17  desc.addOptional<edm::InputTag>("ecalDigis");
18  desc.addOptional<edm::InputTag>("hcalDigis");
19  desc.addOptional<edm::InputTag>("caloRegions");
20  }
21 
22  PackerMap CaloLayer1Setup::getPackers(int fed, unsigned int fw) {
23  PackerMap res;
24 
25  if (fed == 1354) {
26  // AMC #, board #
27  res[{2, 3}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
28  res[{3, 4}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
29  res[{5, 5}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
30  res[{8, 6}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
31  res[{9, 7}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
32  res[{11, 8}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
33  } else if (fed == 1356) {
34  // AMC #, board #
35  res[{2, 15}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
36  res[{3, 16}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
37  res[{5, 17}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
38  res[{8, 0}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
39  res[{9, 1}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
40  res[{11, 2}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
41  } else if (fed == 1358) {
42  // AMC #, board #
43  res[{2, 9}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
44  res[{3, 10}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
45  res[{5, 11}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
46  res[{8, 12}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
47  res[{9, 13}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
48  res[{11, 14}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
49  }
50 
51  return res;
52  }
53 
58  }
59 
60  std::unique_ptr<UnpackerCollections> CaloLayer1Setup::getCollections(edm::Event& e) {
61  return std::unique_ptr<UnpackerCollections>(new CaloLayer1Collections(e));
62  }
63 
64  UnpackerMap CaloLayer1Setup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
66  LogDebug("L1T") << "CaloLayer1Setup: about to pick an unpacker for fed " << fed << " board " << board << " amc "
67  << amc << " fw 0x" << std::hex << fw << std::dec;
68  if (fed == 1354 || fed == 1356 || fed == 1358) {
69  if (board < 18) {
70  if (fw == 0x12345678) {
71  res[0] = UnpackerFactory::get()->make("stage2::CaloLayer1Unpacker");
72  }
73  // e.g.
74  // else if (fw == 0xdeadbeef) {
75  // res[0] = UnpackerFactory::get()->make("stage2::CaloLayer1Unpacker_v2");
76  // }
77  else {
78  edm::LogWarning("L1T")
79  << "CaloLayer1Setup: unexpected CTP7 firmware ID, will try unpacking with default unpacker anyway";
80  res[0] = UnpackerFactory::get()->make("stage2::CaloLayer1Unpacker");
81  }
82  }
83  }
84 
85  return res;
86  }
87  } // namespace stage2
88 } // namespace l1t
89 
#define LogDebug(id)
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
std::shared_ptr< Packer > make(const std::string &) const
void registerProducts(edm::ProducesCollector) override
delete x;
Definition: CaloConfig.h:22
Definition: Electron.h:6
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
static const PackerFactory * get()
Definition: PackerFactory.h:14
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
std::map< int, std::shared_ptr< Unpacker > > UnpackerMap
Definition: PackingSetup.h:25
std::shared_ptr< Unpacker > make(const std::string &) const
std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
#define DEFINE_L1T_PACKING_SETUP(type)
static const UnpackerFactory * get()
void fillDescription(edm::ParameterSetDescription &desc) override
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:23
std::vector< L1CaloRegion > L1CaloRegionCollection
Definition: AMCSpec.h:8
PackerMap getPackers(int fed, unsigned int fw) override