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 
55  prod.produces<EcalTrigPrimDigiCollection>();
56  prod.produces<HcalTrigPrimDigiCollection>();
57  prod.produces<L1CaloRegionCollection>();
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 
l1t::stage2::CaloLayer1Setup::registerConsumes
std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: CaloLayer1Setup.cc:11
l1t::stage2::CaloLayer1Setup::registerProducts
void registerProducts(edm::ProducesCollector) override
Definition: CaloLayer1Setup.cc:54
PackerFactory.h
MessageLogger.h
l1t::UnpackerMap
std::map< int, std::shared_ptr< Unpacker > > UnpackerMap
Definition: PackingSetup.h:25
l1t::stage2::CaloLayer1Setup::getCollections
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: CaloLayer1Setup.cc:60
PackingSetupFactory.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::SortedCollection
Definition: SortedCollection.h:49
l1t::PackerFactory::get
static const PackerFactory * get()
Definition: PackerFactory.h:14
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
l1t::stage2::CaloLayer1Setup::fillDescription
void fillDescription(edm::ParameterSetDescription &desc) override
Definition: CaloLayer1Setup.cc:16
l1t::PackerMap
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:23
DEFINE_L1T_PACKING_SETUP
#define DEFINE_L1T_PACKING_SETUP(type)
Definition: PackingSetupFactory.h:24
l1t::stage2::CaloLayer1Setup::getPackers
PackerMap getPackers(int fed, unsigned int fw) override
Definition: CaloLayer1Setup.cc:22
l1t::stage2::CaloLayer1Setup::getUnpackers
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: CaloLayer1Setup.cc:64
l1t::UnpackerFactory::get
static const UnpackerFactory * get()
Definition: UnpackerFactory.h:14
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
UnpackerFactory.h
CaloLayer1Setup.h
edm::LogWarning
Definition: MessageLogger.h:141
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
l1t
delete x;
Definition: CaloConfig.h:22
fw
Definition: estimate_field.h:12
l1t::stage2::CaloLayer1Setup
Definition: CaloLayer1Setup.h:15
cc
res
Definition: Electron.h:6
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
looper.cfg
cfg
Definition: looper.py:297
l1t::UnpackerFactory::make
std::shared_ptr< Unpacker > make(const std::string &) const
Definition: UnpackerFactory.cc:17
edm::ProducesCollector
Definition: ProducesCollector.h:43
L1CaloRegionCollection
std::vector< L1CaloRegion > L1CaloRegionCollection
Definition: L1CaloCollections.h:11
l1t::stage2::CaloLayer1Tokens
Definition: CaloLayer1Tokens.h:12
amc
Definition: AMCSpec.h:8
l1t::PackerFactory::make
std::shared_ptr< Packer > make(const std::string &) const
Definition: PackerFactory.cc:10
l1t::stage2::CaloLayer1Collections
Definition: CaloLayer1Collections.h:11
edm::Event
Definition: Event.h:73
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37