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  if (fw >=0x10f2) {
96  etsum_unp = static_pointer_cast<l1t::stage2::EtSumUnpacker>(UnpackerFactory::get()->make("stage2::EtSumUnpacker_0x10010057"));
97  }
98 
99  auto alg_unp = UnpackerFactory::get()->make("stage2::GlobalAlgBlkUnpacker");
100  auto ext_unp = UnpackerFactory::get()->make("stage2::GlobalExtBlkUnpacker");
101 
102  muon_unp->setAlgoVersion(fw);
103  muon_unp->setFedNumber(fed);
104 
105  muon_unp->setMuonCopy(amc-1);
106  egamma_unp->setEGammaCopy(amc-1);
107  etsum_unp->setEtSumCopy(amc-1);
108  jet_unp->setJetCopy(amc-1);
109  tau_unp->setTauCopy(amc-1);
110 
112 
113  if (fed == 1404) {
114 
115  // From the rx buffers
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  }
148 
149  return res;
150  }
151  }
152 }
153 
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