test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GTSetup.cc
Go to the documentation of this file.
2 
5 
7 
8 #include "GTCollections.h"
9 #include "GTTokens.h"
10 
11 namespace l1t {
12  namespace stage2 {
13  class GTSetup : public PackingSetup {
14  public:
15  virtual std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override {
16  return std::unique_ptr<PackerTokens>(new GTTokens(cfg, cc));
17  };
18 
19  virtual void fillDescription(edm::ParameterSetDescription& desc) override {
20  desc.addOptional<edm::InputTag>("GtInputTag")->setComment("for stage2");
21  desc.addOptional<edm::InputTag>("ExtInputTag")->setComment("for stage2");
22  desc.addOptional<edm::InputTag>("MuonInputTag")->setComment("for stage2");
23  desc.addOptional<edm::InputTag>("EGammaInputTag")->setComment("for stage2");
24  desc.addOptional<edm::InputTag>("JetInputTag")->setComment("for stage2");
25  desc.addOptional<edm::InputTag>("TauInputTag")->setComment("for stage2");
26  desc.addOptional<edm::InputTag>("EtSumInputTag")->setComment("for stage2");
27  };
28 
29  virtual PackerMap getPackers(int fed, unsigned int fw) override {
30  PackerMap res;
31 
32  if (fed == 1404) {
33  // Use board id 1 for packing
34  res[{1, 1}] = {
35 
36  PackerFactory::get()->make("stage2::GTMuonPacker"),
37  PackerFactory::get()->make("stage2::GTEGammaPacker"),
38  PackerFactory::get()->make("stage2::GTEtSumPacker"),
39  PackerFactory::get()->make("stage2::GTJetPacker"),
40  PackerFactory::get()->make("stage2::GTTauPacker"),
41  PackerFactory::get()->make("stage2::GlobalAlgBlkPacker"),
42  //PackerFactory::get()->make("stage2::GlobalExtBlkPacker")
43  };
44 
45  }
46 
47  return res;
48  };
49 
51 
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");
57  prod.produces<GlobalAlgBlkBxCollection>();
58  prod.produces<GlobalExtBlkBxCollection>();
59 
60  };
61 
62  virtual std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override {
63  return std::unique_ptr<UnpackerCollections>(new GTCollections(e));
64  };
65 
66  virtual UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override {
67 
68  auto muon_unp = UnpackerFactory::get()->make("stage2::MuonUnpacker");
69  auto egamma_unp = UnpackerFactory::get()->make("stage2::EGammaUnpacker");
70  auto etsum_unp = UnpackerFactory::get()->make("stage2::EtSumUnpacker");
71  auto jet_unp = UnpackerFactory::get()->make("stage2::JetUnpacker");
72  auto tau_unp = UnpackerFactory::get()->make("stage2::TauUnpacker");
73  auto alg_unp = UnpackerFactory::get()->make("stage2::GlobalAlgBlkUnpacker");
74  auto ext_unp = UnpackerFactory::get()->make("stage2::GlobalExtBlkUnpacker");
75 
76 
77  UnpackerMap res;
78 
79  if (fed == 1404) {
80 
81  //only unpack first uGT board for the inputs (single copy)
82  if(amc == 1) {
83  // From the rx buffers
84  res[0] = muon_unp;
85  res[2] = muon_unp;
86  res[4] = muon_unp;
87  res[6] = muon_unp;
88  res[8] = egamma_unp;
89  res[10] = egamma_unp;
90  res[12] = jet_unp;
91  res[14] = jet_unp;
92  res[16] = tau_unp;
93  res[18] = tau_unp;
94  res[20] = etsum_unp;
95  res[24] = ext_unp;
96  //res[22] = empty link no data
97  res[26] = ext_unp;
98  res[28] = ext_unp;
99  res[30] = ext_unp;
100  }
101 
102  //From tx buffers
103  res[33] = alg_unp;
104  res[35] = alg_unp;
105  res[37] = alg_unp;
106  res[39] = alg_unp;
107  res[41] = alg_unp;
108  res[43] = alg_unp;
109  res[45] = alg_unp;
110  res[47] = alg_unp;
111  res[49] = alg_unp;
112 
113  }
114 
115  return res;
116  };
117  };
118  }
119 }
120 
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
tuple cfg
Definition: looper.py:293
std::shared_ptr< Packer > make(const std::string &) const
Definition: Packer.cc:12
virtual void registerProducts(edm::stream::EDProducerBase &prod) override
Definition: GTSetup.cc:50
virtual std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: GTSetup.cc:15
static const PackerFactory * get()
Definition: Packer.h:28
std::map< int, std::shared_ptr< Unpacker > > UnpackerMap
Definition: PackingSetup.h:27
double amc
Definition: hdecay.h:20
virtual void fillDescription(edm::ParameterSetDescription &desc) override
Definition: GTSetup.cc:19
std::shared_ptr< Unpacker > make(const std::string &) const
Definition: Unpacker.cc:21
virtual std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: GTSetup.cc:62
static const UnpackerFactory * get()
Definition: Unpacker.h:23
virtual UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: GTSetup.cc:66
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:25
#define DEFINE_L1T_PACKING_SETUP(type)
Definition: PackingSetup.h:61
virtual PackerMap getPackers(int fed, unsigned int fw) override
Definition: GTSetup.cc:29