CMS 3D CMS Logo

BMTFSetup.cc
Go to the documentation of this file.
2 
6 
7 #include "BMTFSetup.h"
8 
9 namespace l1t {
10  namespace stage2 {
11 
12  std::unique_ptr<PackerTokens>
14  {
15  return std::unique_ptr<PackerTokens>(new BMTFTokens(cfg, cc));
16  }
17 
19 
20  PackerMap
21  BMTFSetup::getPackers(int fed, unsigned int fw)
22  {
23  PackerMap res;
24  //res are in format res[amc_no, board_id]
25 
26  if (fed == 1376 || fed == 1377) {
27 
28  std::array<int,12> board_out = { {1,7,2,8,3,9,4,10,5,11,6,12} };//these are board_ids per amc_no-1
29 
30  for (unsigned int i=1; i<=board_out.size(); i++)
31  {
32  if (i%2 != 0) {//maybe this check is not needed
33  res[{i, board_out[i-1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
34  PackerFactory::get()->make("stage2::BMTFPackerInputs")};
35  }
36  else{
37  res[{i, board_out[i-1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
38  PackerFactory::get()->make("stage2::BMTFPackerInputs")};
39  }
40 
41  }
42  }//if feds
43 
44  /*
45  if (fed == 1376) {
46  std::cout << "fed is 1376" << std::endl;
47  for (int i=1; i <= 12; i = i+2){//itr for amc_no = 1,3,5,7,9,11
48  res[{i,board_out[i-1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
49  PackerFactory::get()->make("stage2::BMTFPackerInputs")};
50  }
51 
52  }
53  else if (fed == 1377) {
54  std::cout << "fed is 1377" << std::endl;
55  for (int i=2; i <=12; i = i+2){//itr for amc_no = 2,4,6,8,10,12
56  res[{i,board_out[i-1]}] = {PackerFactory::get()->make("stage2::BMTFPackerOutput"),
57  PackerFactory::get()->make("stage2::BMTFPackerInputs")};
58  }
59 
60  }
61  else{
62  std::cout << std::endl;
63  std::cout << "The given fed is not a BMTF fed (1376 or 1377)" << std::endl;
64  std::cout << std::endl;
65  }//if feds
66  */
67 
68  return res;
69  }//getPackers
70 
71  void
73  {
74  prod.produces<RegionalMuonCandBxCollection>("BMTF");
75  //prod.produces<L1MuDTChambPhContainer>("PhiDigis");
76  //prod.produces<L1MuDTChambThContainer>("TheDigis");
77  prod.produces<L1MuDTChambPhContainer>();
78  prod.produces<L1MuDTChambThContainer>();
79  }
80 
81  std::unique_ptr<UnpackerCollections>
83  {
84  return std::unique_ptr<UnpackerCollections>(new BMTFCollections(e));
85  }
86 
88  BMTFSetup::getUnpackers(int fed, int board, int amc, unsigned int fw)
89  {
90 
91  auto outputMuon = UnpackerFactory::get()->make("stage2::BMTFUnpackerOutput");
92  auto inputMuonsOld = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsOldQual");
93  auto inputMuonsNew = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsNewQual");
94 
96  if (fed == 1376 || fed == 1377) {
97  for (int iL = 0; iL <= 70; iL += 2) {
98  if (iL == 12 || iL == 14 || ( iL > 26 && iL < 32) || iL == 60 || iL == 62)
99  continue;
100 
101  if (fw < 2452619552){
102  res[iL] = inputMuonsOld;
103  }
104  else{
105  res[iL] = inputMuonsNew;
106  }
107  }
108  res[123] = outputMuon;
109  }
110  return res;
111  };
112  };
113 }
114 
virtual std::unique_ptr< PackerTokens > registerConsumes(const edm::ParameterSet &cfg, edm::ConsumesCollector &cc) override
Definition: BMTFSetup.cc:13
std::shared_ptr< Packer > make(const std::string &) const
delete x;
Definition: CaloConfig.h:22
virtual PackerMap getPackers(int fed, unsigned int fw) override
Definition: BMTFSetup.cc:21
Definition: Electron.h:4
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
virtual void fillDescription(edm::ParameterSetDescription &desc) override
Definition: BMTFSetup.cc:18
#define DEFINE_L1T_PACKING_SETUP(type)
virtual std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: BMTFSetup.cc:82
virtual void registerProducts(edm::stream::EDProducerBase &prod) override
Definition: BMTFSetup.cc:72
static const UnpackerFactory * get()
virtual UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: BMTFSetup.cc:88
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:25
Definition: AMCSpec.h:8