CMS 3D CMS Logo

GTSetup.cc
Go to the documentation of this file.
2 
6 
12 
13 #include "GTSetup.h"
14 
15 namespace l1t {
16  namespace stage2 {
17  std::unique_ptr<PackerTokens>
19  {
20  return std::unique_ptr<PackerTokens>(new GTTokens(cfg, cc));
21  }
22 
23  void
25  {
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>("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
36  GTSetup::getPackers(int fed, unsigned int fw)
37  {
38  PackerMap res;
39 
40  if (fed == 1404) {
41  // Use board id 1 for packing
42  res[{1, 1}] = {
43 
44  PackerFactory::get()->make("stage2::GTMuonPacker"),
45  PackerFactory::get()->make("stage2::GTEGammaPacker"),
46  PackerFactory::get()->make("stage2::GTEtSumPacker"),
47  PackerFactory::get()->make("stage2::GTJetPacker"),
48  PackerFactory::get()->make("stage2::GTTauPacker"),
49  PackerFactory::get()->make("stage2::GlobalAlgBlkPacker"),
50  PackerFactory::get()->make("stage2::GlobalExtBlkPacker")
51  };
52 
53  }
54 
55  return res;
56  }
57 
58  void
60  {
61 
62  prod.produces<MuonBxCollection>("Muon");
63  prod.produces<EGammaBxCollection>("EGamma");
64  prod.produces<EtSumBxCollection>("EtSum");
65  prod.produces<JetBxCollection>("Jet");
66  prod.produces<TauBxCollection>("Tau");
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<EGammaBxCollection>("EGamma" + std::to_string(i));
72  prod.produces<EtSumBxCollection>( "EtSum" + 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 
79  std::unique_ptr<UnpackerCollections>
81  {
82  return std::unique_ptr<UnpackerCollections>(new GTCollections(e));
83  }
84 
86  GTSetup::getUnpackers(int fed, int board, int amc, unsigned int fw)
87  {
88 
89  auto muon_unp = static_pointer_cast<l1t::stage2::MuonUnpacker>(UnpackerFactory::get()->make("stage2::MuonUnpacker"));
90  auto egamma_unp = static_pointer_cast<l1t::stage2::EGammaUnpacker>(UnpackerFactory::get()->make("stage2::EGammaUnpacker"));
91  auto etsum_unp = static_pointer_cast<l1t::stage2::EtSumUnpacker>(UnpackerFactory::get()->make("stage2::EtSumUnpacker"));
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 
95  auto alg_unp = UnpackerFactory::get()->make("stage2::GlobalAlgBlkUnpacker");
96  auto ext_unp = UnpackerFactory::get()->make("stage2::GlobalExtBlkUnpacker");
97 
98  muon_unp->setAlgoVersion(fw);
99  muon_unp->setFedNumber(fed);
100 
101  muon_unp->setMuonCopy(amc-1);
102  egamma_unp->setEGammaCopy(amc-1);
103  etsum_unp->setEtSumCopy(amc-1);
104  jet_unp->setJetCopy(amc-1);
105  tau_unp->setTauCopy(amc-1);
106 
108 
109  if (fed == 1404) {
110 
111  // From the rx buffers
112  res[0] = muon_unp;
113  res[2] = muon_unp;
114  res[4] = muon_unp;
115  res[6] = muon_unp;
116  res[8] = egamma_unp;
117  res[10] = egamma_unp;
118  res[12] = jet_unp;
119  res[14] = jet_unp;
120  res[16] = tau_unp;
121  res[18] = tau_unp;
122  res[20] = etsum_unp;
123 
124  if(amc == 1) { // only unpack first uGT board for the external signal inputs (single copy)
125  res[24] = ext_unp;
126  //res[22] = empty link no data
127  res[26] = ext_unp;
128  res[28] = ext_unp;
129  res[30] = ext_unp;
130  }
131 
132  //From tx buffers
133  res[33] = alg_unp;
134  res[35] = alg_unp;
135  res[37] = alg_unp;
136  res[39] = alg_unp;
137  res[41] = alg_unp;
138  res[43] = alg_unp;
139  res[45] = alg_unp;
140  res[47] = alg_unp;
141  res[49] = alg_unp;
142 
143  }
144 
145  return res;
146  }
147  }
148 }
149 
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
std::shared_ptr< Packer > make(const std::string &) const
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: GTSetup.cc:86
delete x;
Definition: CaloConfig.h:22
std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: GTSetup.cc:18
Definition: Electron.h:6
static const PackerFactory * get()
Definition: PackerFactory.h:14
std::map< int, std::shared_ptr< Unpacker > > UnpackerMap
Definition: PackingSetup.h:27
std::shared_ptr< Unpacker > make(const std::string &) const
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:25
Definition: AMCSpec.h:8
void registerProducts(edm::stream::EDProducerBase &prod) override
Definition: GTSetup.cc:59
void fillDescription(edm::ParameterSetDescription &desc) override
Definition: GTSetup.cc:24