CMS 3D CMS Logo

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