CMS 3D CMS Logo

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