CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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>("EGammaInputTag")->setComment("for stage2");
25  desc.addOptional<edm::InputTag>("JetInputTag")->setComment("for stage2");
26  desc.addOptional<edm::InputTag>("TauInputTag")->setComment("for stage2");
27  desc.addOptional<edm::InputTag>("EtSumInputTag")->setComment("for stage2");
28  }
29 
30  PackerMap GTSetup::getPackers(int fed, unsigned int fw) {
31  PackerMap res;
32 
33  if (fed == 1404) {
34  // Use board id 1 for packing
35  auto gt_muon_packer =
36  static_pointer_cast<l1t::stage2::GTMuonPacker>(PackerFactory::get()->make("stage2::GTMuonPacker"));
37  gt_muon_packer->setFed(fed);
38  gt_muon_packer->setFwVersion(fw);
39  res[{1, 1}] = {gt_muon_packer,
40  PackerFactory::get()->make("stage2::GTEGammaPacker"),
41  PackerFactory::get()->make("stage2::GTEtSumPacker"),
42  PackerFactory::get()->make("stage2::GTJetPacker"),
43  PackerFactory::get()->make("stage2::GTTauPacker"),
44  PackerFactory::get()->make("stage2::GlobalAlgBlkPacker"),
45  PackerFactory::get()->make("stage2::GlobalExtBlkPacker")};
46  }
47 
48  return res;
49  }
50 
52  prod.produces<MuonBxCollection>("Muon");
53  prod.produces<EGammaBxCollection>("EGamma");
54  prod.produces<EtSumBxCollection>("EtSum");
55  prod.produces<JetBxCollection>("Jet");
56  prod.produces<TauBxCollection>("Tau");
59  for (int i = 2; i < 7; ++i) { // Collections from boards 2-6
60  prod.produces<MuonBxCollection>("Muon" + std::to_string(i));
61  prod.produces<EGammaBxCollection>("EGamma" + std::to_string(i));
62  prod.produces<EtSumBxCollection>("EtSum" + std::to_string(i));
63  prod.produces<JetBxCollection>("Jet" + std::to_string(i));
64  prod.produces<TauBxCollection>("Tau" + std::to_string(i));
65  }
66  }
67 
68  std::unique_ptr<UnpackerCollections> GTSetup::getCollections(edm::Event& e) {
69  return std::unique_ptr<UnpackerCollections>(new GTCollections(e));
70  }
71 
72  UnpackerMap GTSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
73  auto muon_unp =
74  static_pointer_cast<l1t::stage2::MuonUnpacker>(UnpackerFactory::get()->make("stage2::MuonUnpacker"));
75  auto egamma_unp =
76  static_pointer_cast<l1t::stage2::EGammaUnpacker>(UnpackerFactory::get()->make("stage2::EGammaUnpacker"));
77  auto etsum_unp =
78  static_pointer_cast<l1t::stage2::EtSumUnpacker>(UnpackerFactory::get()->make("stage2::EtSumUnpacker"));
79  auto jet_unp = static_pointer_cast<l1t::stage2::JetUnpacker>(UnpackerFactory::get()->make("stage2::JetUnpacker"));
80  auto tau_unp = static_pointer_cast<l1t::stage2::TauUnpacker>(UnpackerFactory::get()->make("stage2::TauUnpacker"));
81 
82  if (fw >= 0x10f2) {
83  etsum_unp = static_pointer_cast<l1t::stage2::EtSumUnpacker>(
84  UnpackerFactory::get()->make("stage2::EtSumUnpacker_0x10010057"));
85  }
86 
87  auto alg_unp = UnpackerFactory::get()->make("stage2::GlobalAlgBlkUnpacker");
88  auto ext_unp = UnpackerFactory::get()->make("stage2::GlobalExtBlkUnpacker");
89 
90  muon_unp->setAlgoVersion(fw);
91  muon_unp->setFedNumber(fed);
92 
93  muon_unp->setMuonCopy(amc - 1);
94  egamma_unp->setEGammaCopy(amc - 1);
95  etsum_unp->setEtSumCopy(amc - 1);
96  jet_unp->setJetCopy(amc - 1);
97  tau_unp->setTauCopy(amc - 1);
98 
99  UnpackerMap res;
100 
101  if (fed == 1404) {
102  // From the rx buffers
103  res[0] = muon_unp;
104  res[2] = muon_unp;
105  res[4] = muon_unp;
106  res[6] = muon_unp;
107  res[8] = egamma_unp;
108  res[10] = egamma_unp;
109  res[12] = jet_unp;
110  res[14] = jet_unp;
111  res[16] = tau_unp;
112  res[18] = tau_unp;
113  res[20] = etsum_unp;
114 
115  if (amc == 1) { // only unpack first uGT board for the external signal inputs (single copy)
116  res[24] = ext_unp;
117  //res[22] = empty link no data
118  res[26] = ext_unp;
119  res[28] = ext_unp;
120  res[30] = ext_unp;
121  }
122 
123  //From tx buffers
124  res[33] = alg_unp;
125  res[35] = alg_unp;
126  res[37] = alg_unp;
127  res[39] = alg_unp;
128  res[41] = alg_unp;
129  res[43] = alg_unp;
130  res[45] = alg_unp;
131  res[47] = alg_unp;
132  res[49] = alg_unp;
133  }
134 
135  return res;
136  }
137  } // namespace stage2
138 } // namespace l1t
139 
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
tuple cfg
Definition: looper.py:296
void setFed(unsigned fedId)
Definition: MuonPacker.h:18
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
std::shared_ptr< Packer > make(const std::string &) const
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: GTSetup.cc:72
std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: GTSetup.cc:16
static const PackerFactory * get()
Definition: PackerFactory.h:14
void registerProducts(edm::ProducesCollector) override
Definition: GTSetup.cc:51
std::map< int, std::shared_ptr< Unpacker > > UnpackerMap
Definition: PackingSetup.h:25
double amc
Definition: hdecay.h:20
std::shared_ptr< Unpacker > make(const std::string &) const
PackerMap getPackers(int fed, unsigned int fw) override
Definition: GTSetup.cc:30
#define DEFINE_L1T_PACKING_SETUP(type)
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: GTSetup.cc:68
static const UnpackerFactory * get()
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:23
void fillDescription(edm::ParameterSetDescription &desc) override
Definition: GTSetup.cc:20