CMS 3D CMS Logo

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