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