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