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