CMS 3D CMS Logo

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