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<RegionalMuonCandBxCollection>("BMTF2");
76  prod.produces<L1MuDTChambPhContainer>();
77  prod.produces<L1MuDTChambThContainer>();
78 
79  // Depricated
80  //prod.produces<L1MuDTChambPhContainer>("PhiDigis");
81  //prod.produces<L1MuDTChambThContainer>("TheDigis");
82  }
83 
84  std::unique_ptr<UnpackerCollections>
86  {
87  return std::unique_ptr<UnpackerCollections>(new BMTFCollections(e));
88  }
89 
91  BMTFSetup::getUnpackers(int fed, int board, int amc, unsigned int fw)
92  {
93 
94  auto inputMuonsOld = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsOldQual");
95  auto inputMuonsNew = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsNewQual");
96 
97  auto outputMuon = std::make_shared<BMTFUnpackerOutput>(); //here is the triggering collection
98  auto outputMuon2 = std::make_shared<BMTFUnpackerOutput>(false); //here is the secondary
99  if (fw >= 2499805536) //this is in HEX '95000160'
100  outputMuon -> setKalmanAlgoTrue();
101  else
102  outputMuon2 -> setKalmanAlgoTrue();
103 
105  if (fed == 1376 || fed == 1377) {
106 
107  // Input links
108  for (int iL = 0; iL <= 70; iL += 2) {
109  if (iL == 12 || iL == 14 || ( iL > 26 && iL < 32) || iL == 60 || iL == 62)
110  continue;
111 
112  if (fw < 2452619552){
113  res[iL] = inputMuonsOld;
114  }
115  else{
116  res[iL] = inputMuonsNew;
117  }
118  }
119 
120  // Output links
121  res[123] = outputMuon;
122  res[125] = outputMuon2;
123  }
124 
125  return res;
126  };
127  };
128 }
129 
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
PackerMap getPackers(int fed, unsigned int fw) override
Definition: BMTFSetup.cc:21
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
void fillDescription(edm::ParameterSetDescription &desc) override
Definition: BMTFSetup.cc:18
#define DEFINE_L1T_PACKING_SETUP(type)
std::unique_ptr< UnpackerCollections > getCollections(edm::Event &e) override
Definition: BMTFSetup.cc:85
void registerProducts(edm::stream::EDProducerBase &prod) override
Definition: BMTFSetup.cc:72
static const UnpackerFactory * get()
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override
Definition: BMTFSetup.cc:91
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:25
Definition: AMCSpec.h:8