CMS 3D CMS Logo

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