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)).c_str());
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  // input muons
81  auto gmt_in_unp = UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker");
82  for (int iLink = 72; iLink < 144; iLink += 2)
83  res[iLink] = gmt_in_unp;
84 
85  // internal muons
86  auto gmt_imd_unp = static_pointer_cast<l1t::stage2::IntermediateMuonUnpacker>(UnpackerFactory::get()->make("stage2::IntermediateMuonUnpacker"));
87  gmt_imd_unp->setAlgoVersion(fw);
88  for (int oLink = 49; oLink < 63; oLink += 2)
89  res[oLink] = gmt_imd_unp;
90 
91  // output muons (6 copies)
92  std::array<std::shared_ptr<l1t::stage2::MuonUnpacker>, 6> gmt_out_unps;
93  int i = 0;
94  for (auto gmt_out_unp:gmt_out_unps) {
95  gmt_out_unp = static_pointer_cast<l1t::stage2::MuonUnpacker>(UnpackerFactory::get()->make("stage2::MuonUnpacker"));
96  gmt_out_unp->setAlgoVersion(fw);
97  gmt_out_unp->setFedNumber(fed);
98  gmt_out_unp->setMuonCopy(i);
99 
100  int oLinkMin = i*8+1;
101  for (int oLink = oLinkMin; oLink < oLinkMin+8; oLink += 2)
102  res[oLink] = gmt_out_unp;
103 
104  ++i;
105  }
106 
107  return res;
108  }
109  }
110 }
111 
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
virtual std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: GMTSetup.cc:70
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:53
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:25
virtual PackerMap getPackers(int fed, unsigned int fw) override
Definition: GMTSetup.cc:38
void setAlgoVersion(const unsigned int version)
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:76
#define DEFINE_L1T_PACKING_SETUP(type)
virtual std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: GMTSetup.cc:19
static const UnpackerFactory * get()
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:25
Definition: AMCSpec.h:8