CMS 3D CMS Logo

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