CMS 3D CMS Logo

GMTSetup.cc
Go to the documentation of this file.
3 
7 
13 
14 #include "GMTSetup.h"
15 
16 #include <array>
17 #include <string>
18 
19 namespace l1t {
20  namespace stage2 {
21  std::unique_ptr<PackerTokens> GMTSetup::registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) {
22  return std::unique_ptr<PackerTokens>(new GMTTokens(cfg, cc));
23  }
24 
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")
30  ->setComment("uGMT intermediate muon from BMTF after first sorting stage");
31  desc.addOptional<edm::InputTag>("ImdInputLabelEMTFNeg")
32  ->setComment("uGMT intermediate muon from neg. EMTF side after first sorting stage");
33  desc.addOptional<edm::InputTag>("ImdInputLabelEMTFPos")
34  ->setComment("uGMT intermediate muon from pos. EMTF side after first sorting stage");
35  desc.addOptional<edm::InputTag>("ImdInputLabelOMTFNeg")
36  ->setComment("uGMT intermediate muon from neg. OMTF side after first sorting stage");
37  desc.addOptional<edm::InputTag>("ImdInputLabelOMTFPos")
38  ->setComment("uGMT intermediate muon from pos. OMTF side after first sorting stage");
39  desc.addOptional<edm::InputTag>("ShowerInputLabel")->setComment("for Run3");
40  desc.addOptional<edm::InputTag>("EMTFShowerInputLabel")->setComment("for Run3");
41  }
42 
43  PackerMap GMTSetup::getPackers(int fed, unsigned int fw) {
44  PackerMap res;
45  if (fed == 1402) {
46  auto gmt_in_packer = static_pointer_cast<l1t::stage2::RegionalMuonGMTPacker>(
47  PackerFactory::get()->make("stage2::RegionalMuonGMTPacker"));
48  if (fw >= 0x8000000) {
49  gmt_in_packer->setUseEmtfLooseShowers();
50  }
51  if (fw >= 0x7000000) {
52  gmt_in_packer->setUseEmtfNominalTightShowers();
53  }
54  if (fw >= 0x6010000) {
55  gmt_in_packer->setUseEmtfDisplacementInfo();
56  }
57  if (fw >= 0x6000000) {
58  gmt_in_packer->setIsKbmtf();
59  }
60  auto gmt_out_packer =
61  static_pointer_cast<l1t::stage2::GMTMuonPacker>(PackerFactory::get()->make("stage2::GMTMuonPacker"));
62  gmt_out_packer->setFed(fed);
63  gmt_out_packer->setFwVersion(fw);
64  // Use amc_no and board id 1 for packing
65  res[{1, 1}] = {
66  gmt_in_packer,
67  gmt_out_packer,
68  PackerFactory::get()->make("stage2::IntermediateMuonPacker"),
69  };
70  }
71  return res;
72  }
73 
75  prod.produces<RegionalMuonCandBxCollection>("BMTF");
76  prod.produces<RegionalMuonCandBxCollection>("OMTF");
77  prod.produces<RegionalMuonCandBxCollection>("EMTF");
78  prod.produces<MuonBxCollection>("Muon");
79  for (size_t i = 1; i < GMTCollections::NUM_OUTPUT_COPIES; ++i) {
80  prod.produces<MuonBxCollection>("MuonCopy" + std::to_string(i));
81  }
82  prod.produces<MuonBxCollection>("imdMuonsBMTF");
83  prod.produces<MuonBxCollection>("imdMuonsEMTFNeg");
84  prod.produces<MuonBxCollection>("imdMuonsEMTFPos");
85  prod.produces<MuonBxCollection>("imdMuonsOMTFNeg");
86  prod.produces<MuonBxCollection>("imdMuonsOMTFPos");
87 
88  prod.produces<RegionalMuonShowerBxCollection>("EMTF");
89  prod.produces<MuonShowerBxCollection>("MuonShower");
90  for (size_t i = 1; i < GMTCollections::NUM_OUTPUT_COPIES; ++i) {
91  prod.produces<MuonShowerBxCollection>("MuonShowerCopy" + std::to_string(i));
92  }
93  }
94 
95  std::unique_ptr<UnpackerCollections> GMTSetup::getCollections(edm::Event& e) {
96  return std::unique_ptr<UnpackerCollections>(new GMTCollections(e));
97  }
98 
99  UnpackerMap GMTSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
101 
102  // MP7 input link numbers are represented by even numbers starting from 0 (iLink=link*2)
103  // input muons on links 36-71
104  auto gmt_in_unp = static_pointer_cast<l1t::stage2::RegionalMuonGMTUnpacker>(
105  UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker"));
106  if (fw >= 0x8000000) {
107  gmt_in_unp->setUseEmtfLooseShowers();
108  }
109  if (fw >= 0x7000000) {
110  gmt_in_unp->setUseEmtfNominalTightShowers();
111  }
112  if (fw >= 0x6010000) {
113  gmt_in_unp->setUseEmtfDisplacementInfo();
114  }
115  if (fw >= 0x6000000) {
116  gmt_in_unp->setIsKbmtf();
117  }
118 
119  for (int iLink = 72; iLink < 144; iLink += 2) {
120  res[iLink] = gmt_in_unp;
121  }
122 
123  // MP7 output link numbers are represented by odd numbers (oLink=link*2+1)
124  // internal muons on links 24-31
125  auto gmt_imd_unp = static_pointer_cast<l1t::stage2::IntermediateMuonUnpacker>(
126  UnpackerFactory::get()->make("stage2::IntermediateMuonUnpacker"));
127  gmt_imd_unp->setAlgoVersion(fw);
128  for (int oLink = 49; oLink < 65; oLink += 2)
129  res[oLink] = gmt_imd_unp;
130 
131  // output muons on links 0-23 (6 copies on 4 links each)
132  std::array<std::shared_ptr<l1t::stage2::MuonUnpacker>, 6> gmt_out_unps;
133  int i = 0;
134  for (auto gmt_out_unp : gmt_out_unps) {
135  gmt_out_unp =
136  static_pointer_cast<l1t::stage2::MuonUnpacker>(UnpackerFactory::get()->make("stage2::MuonUnpacker"));
137  gmt_out_unp->setAlgoVersion(fw);
138  gmt_out_unp->setFedNumber(fed);
139  gmt_out_unp->setMuonCopy(i);
140 
141  int oLinkMin = i * 8 + 1;
142  for (int oLink = oLinkMin; oLink < oLinkMin + 8; oLink += 2)
143  res[oLink] = gmt_out_unp;
144 
145  ++i;
146  }
147 
148  return res;
149  }
150  } // namespace stage2
151 } // namespace l1t
152 
std::shared_ptr< Packer > make(const std::string &) const
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: GMTSetup.cc:95
void setFed(unsigned fedId)
Definition: MuonPacker.h:18
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
std::string to_string(const V &value)
Definition: OMSAccess.h:77
delete x;
Definition: CaloConfig.h:22
Definition: Electron.h:6
static constexpr size_t NUM_OUTPUT_COPIES
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:25
PackerMap getPackers(int fed, unsigned int fw) override
Definition: GMTSetup.cc:43
void registerProducts(edm::ProducesCollector) override
Definition: GMTSetup.cc:74
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: GMTSetup.cc:99
#define DEFINE_L1T_PACKING_SETUP(type)
std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: GMTSetup.cc:21
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
std::shared_ptr< Unpacker > make(const std::string &) const
Definition: AMCSpec.h:8