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 >= 0x8010000) {
49  gmt_in_packer->setUseOmtfDisplacementInfo();
50  }
51  if (fw >= 0x8000000) {
52  gmt_in_packer->setUseEmtfLooseShowers();
53  }
54  if (fw >= 0x7000000) {
55  gmt_in_packer->setUseEmtfNominalTightShowers();
56  }
57  if (fw >= 0x6010000) {
58  gmt_in_packer->setUseEmtfDisplacementInfo();
59  }
60  if (fw >= 0x6000000) {
61  gmt_in_packer->setIsKbmtf();
62  }
63  auto gmt_out_packer =
64  static_pointer_cast<l1t::stage2::GMTMuonPacker>(PackerFactory::get()->make("stage2::GMTMuonPacker"));
65  gmt_out_packer->setFed(fed);
66  gmt_out_packer->setFwVersion(fw);
67  // Use amc_no and board id 1 for packing
68  res[{1, 1}] = {
69  gmt_in_packer,
70  gmt_out_packer,
71  PackerFactory::get()->make("stage2::IntermediateMuonPacker"),
72  };
73  }
74  return res;
75  }
76 
78  prod.produces<RegionalMuonCandBxCollection>("BMTF");
79  prod.produces<RegionalMuonCandBxCollection>("OMTF");
80  prod.produces<RegionalMuonCandBxCollection>("EMTF");
81  prod.produces<MuonBxCollection>("Muon");
82  for (size_t i = 1; i < GMTCollections::NUM_OUTPUT_COPIES; ++i) {
83  prod.produces<MuonBxCollection>("MuonCopy" + std::to_string(i));
84  }
85  prod.produces<MuonBxCollection>("imdMuonsBMTF");
86  prod.produces<MuonBxCollection>("imdMuonsEMTFNeg");
87  prod.produces<MuonBxCollection>("imdMuonsEMTFPos");
88  prod.produces<MuonBxCollection>("imdMuonsOMTFNeg");
89  prod.produces<MuonBxCollection>("imdMuonsOMTFPos");
90 
91  prod.produces<RegionalMuonShowerBxCollection>("EMTF");
92  prod.produces<MuonShowerBxCollection>("MuonShower");
93  for (size_t i = 1; i < GMTCollections::NUM_OUTPUT_COPIES; ++i) {
94  prod.produces<MuonShowerBxCollection>("MuonShowerCopy" + std::to_string(i));
95  }
96  }
97 
98  std::unique_ptr<UnpackerCollections> GMTSetup::getCollections(edm::Event& e) {
99  return std::unique_ptr<UnpackerCollections>(new GMTCollections(e));
100  }
101 
102  UnpackerMap GMTSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
104 
105  // MP7 input link numbers are represented by even numbers starting from 0 (iLink=link*2)
106  // input muons on links 36-71
107  auto gmt_in_unp = static_pointer_cast<l1t::stage2::RegionalMuonGMTUnpacker>(
108  UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker"));
109  if (fw >= 0x8010000) {
110  gmt_in_unp->setUseOmtfDisplacementInfo();
111  }
112  if (fw >= 0x8000000) {
113  gmt_in_unp->setUseEmtfLooseShowers();
114  }
115  if (fw >= 0x7000000) {
116  gmt_in_unp->setUseEmtfNominalTightShowers();
117  }
118  if (fw >= 0x6010000) {
119  gmt_in_unp->setUseEmtfDisplacementInfo();
120  }
121  if (fw >= 0x6000000) {
122  gmt_in_unp->setIsKbmtf();
123  }
124 
125  for (int iLink = 72; iLink < 144; iLink += 2) {
126  res[iLink] = gmt_in_unp;
127  }
128 
129  // MP7 output link numbers are represented by odd numbers (oLink=link*2+1)
130  // internal muons on links 24-31
131  auto gmt_imd_unp = static_pointer_cast<l1t::stage2::IntermediateMuonUnpacker>(
132  UnpackerFactory::get()->make("stage2::IntermediateMuonUnpacker"));
133  gmt_imd_unp->setAlgoVersion(fw);
134  for (int oLink = 49; oLink < 65; oLink += 2)
135  res[oLink] = gmt_imd_unp;
136 
137  // output muons on links 0-23 (6 copies on 4 links each)
138  std::array<std::shared_ptr<l1t::stage2::MuonUnpacker>, 6> gmt_out_unps;
139  int i = 0;
140  for (auto gmt_out_unp : gmt_out_unps) {
141  gmt_out_unp =
142  static_pointer_cast<l1t::stage2::MuonUnpacker>(UnpackerFactory::get()->make("stage2::MuonUnpacker"));
143  gmt_out_unp->setAlgoVersion(fw);
144  gmt_out_unp->setFedNumber(fed);
145  gmt_out_unp->setMuonCopy(i);
146 
147  int oLinkMin = i * 8 + 1;
148  for (int oLink = oLinkMin; oLink < oLinkMin + 8; oLink += 2)
149  res[oLink] = gmt_out_unp;
150 
151  ++i;
152  }
153 
154  return res;
155  }
156  } // namespace stage2
157 } // namespace l1t
158 
std::shared_ptr< Packer > make(const std::string &) const
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: GMTSetup.cc:98
void setFed(unsigned fedId)
Definition: MuonPacker.h:18
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
delete x;
Definition: CaloConfig.h:22
Definition: Electron.h:6
static std::string to_string(const XMLCh *ch)
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:77
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: GMTSetup.cc:102
#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