CMS 3D CMS Logo

GMTSetup.cc
Go to the documentation of this file.
2 
6 
9 
10 #include "GMTSetup.h"
11 
12 #include <array>
13 #include <string>
14 
15 namespace l1t {
16  namespace stage2 {
17  std::unique_ptr<PackerTokens> GMTSetup::registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) {
18  return std::unique_ptr<PackerTokens>(new GMTTokens(cfg, cc));
19  }
20 
22  desc.addOptional<edm::InputTag>("BMTFInputLabel")->setComment("for stage2");
23  desc.addOptional<edm::InputTag>("OMTFInputLabel")->setComment("for stage2");
24  desc.addOptional<edm::InputTag>("EMTFInputLabel")->setComment("for stage2");
25  desc.addOptional<edm::InputTag>("ImdInputLabelBMTF")
26  ->setComment("uGMT intermediate muon from BMTF after first sorting stage");
27  desc.addOptional<edm::InputTag>("ImdInputLabelEMTFNeg")
28  ->setComment("uGMT intermediate muon from neg. EMTF side after first sorting stage");
29  desc.addOptional<edm::InputTag>("ImdInputLabelEMTFPos")
30  ->setComment("uGMT intermediate muon from pos. EMTF side after first sorting stage");
31  desc.addOptional<edm::InputTag>("ImdInputLabelOMTFNeg")
32  ->setComment("uGMT intermediate muon from neg. OMTF side after first sorting stage");
33  desc.addOptional<edm::InputTag>("ImdInputLabelOMTFPos")
34  ->setComment("uGMT intermediate muon from pos. OMTF side after first sorting stage");
35  }
36 
37  PackerMap GMTSetup::getPackers(int fed, unsigned int fw) {
38  PackerMap res;
39  if (fed == 1402) {
40  // Use amc_no and board id 1 for packing
41  res[{1, 1}] = {
42  PackerFactory::get()->make("stage2::RegionalMuonGMTPacker"),
43  PackerFactory::get()->make("stage2::GMTMuonPacker"),
44  PackerFactory::get()->make("stage2::IntermediateMuonPacker"),
45  };
46  }
47  return res;
48  }
49 
54  prod.produces<MuonBxCollection>("Muon");
55  for (int i = 1; i < 6; ++i) {
56  prod.produces<MuonBxCollection>("MuonCopy" + std::to_string(i));
57  }
58  prod.produces<MuonBxCollection>("imdMuonsBMTF");
59  prod.produces<MuonBxCollection>("imdMuonsEMTFNeg");
60  prod.produces<MuonBxCollection>("imdMuonsEMTFPos");
61  prod.produces<MuonBxCollection>("imdMuonsOMTFNeg");
62  prod.produces<MuonBxCollection>("imdMuonsOMTFPos");
63  }
64 
65  std::unique_ptr<UnpackerCollections> GMTSetup::getCollections(edm::Event& e) {
66  return std::unique_ptr<UnpackerCollections>(new GMTCollections(e));
67  }
68 
69  UnpackerMap GMTSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
71 
72  // MP7 input link numbers are represented by even numbers starting from 0 (iLink=link*2)
73  // input muons on links 36-71
74  auto gmt_in_unp = UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker");
75  for (int iLink = 72; iLink < 144; iLink += 2)
76  res[iLink] = gmt_in_unp;
77 
78  // MP7 output link numbers are represented by odd numbers (oLink=link*2+1)
79  // internal muons on links 24-31
80  auto gmt_imd_unp = static_pointer_cast<l1t::stage2::IntermediateMuonUnpacker>(
81  UnpackerFactory::get()->make("stage2::IntermediateMuonUnpacker"));
82  gmt_imd_unp->setAlgoVersion(fw);
83  for (int oLink = 49; oLink < 65; oLink += 2)
84  res[oLink] = gmt_imd_unp;
85 
86  // output muons on links 0-23 (6 copies on 4 links each)
87  std::array<std::shared_ptr<l1t::stage2::MuonUnpacker>, 6> gmt_out_unps;
88  int i = 0;
89  for (auto gmt_out_unp : gmt_out_unps) {
90  gmt_out_unp =
91  static_pointer_cast<l1t::stage2::MuonUnpacker>(UnpackerFactory::get()->make("stage2::MuonUnpacker"));
92  gmt_out_unp->setAlgoVersion(fw);
93  gmt_out_unp->setFedNumber(fed);
94  gmt_out_unp->setMuonCopy(i);
95 
96  int oLinkMin = i * 8 + 1;
97  for (int oLink = oLinkMin; oLink < oLinkMin + 8; oLink += 2)
98  res[oLink] = gmt_out_unp;
99 
100  ++i;
101  }
102 
103  return res;
104  }
105  } // namespace stage2
106 } // namespace l1t
107 
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: GMTSetup.cc:65
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
std::shared_ptr< Packer > make(const std::string &) const
delete x;
Definition: CaloConfig.h:22
Definition: Electron.h:6
static const PackerFactory * get()
Definition: PackerFactory.h:14
std::map< int, std::shared_ptr< Unpacker > > UnpackerMap
Definition: PackingSetup.h:25
void fillDescription(edm::ParameterSetDescription &desc) override
Definition: GMTSetup.cc:21
PackerMap getPackers(int fed, unsigned int fw) override
Definition: GMTSetup.cc:37
void registerProducts(edm::ProducesCollector) override
Definition: GMTSetup.cc:50
std::shared_ptr< Unpacker > make(const std::string &) const
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: GMTSetup.cc:69
#define DEFINE_L1T_PACKING_SETUP(type)
std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: GMTSetup.cc:17
static const UnpackerFactory * get()
void setAlgoVersion(const unsigned int version)
Definition: Unpacker.h:19
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:23
Definition: AMCSpec.h:8