CMS 3D CMS Logo

GTSetup.cc
Go to the documentation of this file.
4 
11 
12 #include "GTSetup.h"
13 
14 namespace l1t {
15  namespace stage2 {
16  std::unique_ptr<PackerTokens> GTSetup::registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) {
17  return std::unique_ptr<PackerTokens>(new GTTokens(cfg, cc));
18  }
19 
21  desc.addOptional<edm::InputTag>("GtInputTag")->setComment("for stage2");
22  desc.addOptional<edm::InputTag>("ExtInputTag")->setComment("for stage2");
23  desc.addOptional<edm::InputTag>("MuonInputTag")->setComment("for stage2");
24  desc.addOptional<edm::InputTag>("ShowerInputTag")->setComment("for Run3");
25  desc.addOptional<edm::InputTag>("EGammaInputTag")->setComment("for stage2");
26  desc.addOptional<edm::InputTag>("JetInputTag")->setComment("for stage2");
27  desc.addOptional<edm::InputTag>("TauInputTag")->setComment("for stage2");
28  desc.addOptional<edm::InputTag>("EtSumInputTag")->setComment("for stage2");
29  }
30 
31  PackerMap GTSetup::getPackers(int fed, unsigned int fw) {
32  PackerMap res;
33 
34  if ((fed == 1404) || (fed == 1405)) {
35  // Use board id 1 for packing
36  //fed id 1404 corresponds to the production crate, 1405 to the test crate
37  auto gt_muon_packer =
38  static_pointer_cast<l1t::stage2::GTMuonPacker>(PackerFactory::get()->make("stage2::GTMuonPacker"));
39  gt_muon_packer->setFed(fed);
40  gt_muon_packer->setFwVersion(fw);
41  res[{1, 1}] = {gt_muon_packer,
42  PackerFactory::get()->make("stage2::GTEGammaPacker"),
43  PackerFactory::get()->make("stage2::GTEtSumPacker"),
44  PackerFactory::get()->make("stage2::GTJetPacker"),
45  PackerFactory::get()->make("stage2::GTTauPacker"),
46  PackerFactory::get()->make("stage2::GlobalAlgBlkPacker"),
47  PackerFactory::get()->make("stage2::GlobalExtBlkPacker")};
48  }
49 
50  return res;
51  }
52 
54  prod.produces<MuonBxCollection>("Muon");
55  prod.produces<MuonShowerBxCollection>("MuonShower");
56  prod.produces<EGammaBxCollection>("EGamma");
57  prod.produces<EtSumBxCollection>("EtSum");
58  prod.produces<JetBxCollection>("Jet");
59  prod.produces<TauBxCollection>("Tau");
60  prod.produces<GlobalAlgBlkBxCollection>();
61  prod.produces<GlobalExtBlkBxCollection>();
62  for (int i = 2; i < 7; ++i) { // Collections from boards 2-6
63  prod.produces<MuonBxCollection>("Muon" + std::to_string(i));
64  prod.produces<MuonShowerBxCollection>("MuonShower" + std::to_string(i));
65  prod.produces<EGammaBxCollection>("EGamma" + std::to_string(i));
66  prod.produces<EtSumBxCollection>("EtSum" + std::to_string(i));
67  prod.produces<JetBxCollection>("Jet" + std::to_string(i));
68  prod.produces<TauBxCollection>("Tau" + std::to_string(i));
69  }
70  }
71 
72  std::unique_ptr<UnpackerCollections> GTSetup::getCollections(edm::Event& e) {
73  return std::unique_ptr<UnpackerCollections>(new GTCollections(e));
74  }
75 
76  UnpackerMap GTSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
77  auto muon_unp =
78  static_pointer_cast<l1t::stage2::MuonUnpacker>(UnpackerFactory::get()->make("stage2::MuonUnpacker"));
79  auto egamma_unp =
80  static_pointer_cast<l1t::stage2::EGammaUnpacker>(UnpackerFactory::get()->make("stage2::EGammaUnpacker"));
81  auto etsum_unp =
82  static_pointer_cast<l1t::stage2::EtSumUnpacker>(UnpackerFactory::get()->make("stage2::EtSumUnpacker"));
83  auto jet_unp = static_pointer_cast<l1t::stage2::JetUnpacker>(UnpackerFactory::get()->make("stage2::JetUnpacker"));
84  auto tau_unp = static_pointer_cast<l1t::stage2::TauUnpacker>(UnpackerFactory::get()->make("stage2::TauUnpacker"));
85 
86  if (fw >= 0x10f2) {
87  etsum_unp = static_pointer_cast<l1t::stage2::EtSumUnpacker>(
88  UnpackerFactory::get()->make("stage2::EtSumUnpacker_0x10010057"));
89  }
90 
91  auto alg_unp = UnpackerFactory::get()->make("stage2::GlobalAlgBlkUnpacker");
92  auto ext_unp = UnpackerFactory::get()->make("stage2::GlobalExtBlkUnpacker");
93 
94  muon_unp->setAlgoVersion(fw);
95  muon_unp->setFedNumber(fed);
96 
97  muon_unp->setMuonCopy(amc - 1);
98  egamma_unp->setEGammaCopy(amc - 1);
99  etsum_unp->setEtSumCopy(amc - 1);
100  jet_unp->setJetCopy(amc - 1);
101  tau_unp->setTauCopy(amc - 1);
102 
104 
105  if ((fed == 1404) || (fed == 1405)) {
106  // From the rx buffers
107  // fed id 1404 corresponds to the production crate, 1405 to the test crate
108  res[0] = muon_unp;
109  res[2] = muon_unp;
110  res[4] = muon_unp;
111  res[6] = muon_unp;
112  res[8] = egamma_unp;
113  res[10] = egamma_unp;
114  res[12] = jet_unp;
115  res[14] = jet_unp;
116  res[16] = tau_unp;
117  res[18] = tau_unp;
118  res[20] = etsum_unp;
119 
120  if (amc == 1) { // only unpack first uGT board for the external signal inputs (single copy)
121  res[24] = ext_unp;
122  //res[22] = empty link no data
123  res[26] = ext_unp;
124  res[28] = ext_unp;
125  res[30] = ext_unp;
126  }
127 
128  //From tx buffers
129  res[33] = alg_unp;
130  res[35] = alg_unp;
131  res[37] = alg_unp;
132  res[39] = alg_unp;
133  res[41] = alg_unp;
134  res[43] = alg_unp;
135  res[45] = alg_unp;
136  res[47] = alg_unp;
137  res[49] = alg_unp;
138  }
139 
140  return res;
141  }
142  } // namespace stage2
143 } // namespace l1t
144 
std::shared_ptr< Packer > make(const std::string &) const
void setFed(unsigned fedId)
Definition: MuonPacker.h:18
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: GTSetup.cc:76
delete x;
Definition: CaloConfig.h:22
std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: GTSetup.cc:16
Definition: Electron.h:6
static std::string to_string(const XMLCh *ch)
static const PackerFactory * get()
Definition: PackerFactory.h:14
void registerProducts(edm::ProducesCollector) override
Definition: GTSetup.cc:53
std::map< int, std::shared_ptr< Unpacker > > UnpackerMap
Definition: PackingSetup.h:25
PackerMap getPackers(int fed, unsigned int fw) override
Definition: GTSetup.cc:31
#define DEFINE_L1T_PACKING_SETUP(type)
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: GTSetup.cc:72
static const UnpackerFactory * get()
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
void fillDescription(edm::ParameterSetDescription &desc) override
Definition: GTSetup.cc:20