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>("kBMTF");
75  prod.produces<RegionalMuonCandBxCollection>("BMTF");
76  //prod.produces<L1MuDTChambPhContainer>("PhiDigis");
77  //prod.produces<L1MuDTChambThContainer>("TheDigis");
78  prod.produces<L1MuDTChambPhContainer>();
79  prod.produces<L1MuDTChambThContainer>();
80  }
81 
82  std::unique_ptr<UnpackerCollections>
84  {
85  return std::unique_ptr<UnpackerCollections>(new BMTFCollections(e));
86  }
87 
89  BMTFSetup::getUnpackers(int fed, int board, int amc, unsigned int fw)
90  {
91 
92  auto outputMuon = std::make_shared<BMTFUnpackerOutput>();
93  auto outputKalmanMuon = std::make_shared<BMTFUnpackerOutput>(true);
94  auto inputMuonsOld = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsOldQual");
95  auto inputMuonsNew = UnpackerFactory::get()->make("stage2::BMTFUnpackerInputsNewQual");
96 
98  if (fed == 1376 || fed == 1377) {
99  for (int iL = 0; iL <= 70; iL += 2) {
100  if (iL == 12 || iL == 14 || ( iL > 26 && iL < 32) || iL == 60 || iL == 62)
101  continue;
102 
103  if (fw < 2452619552){
104  res[iL] = inputMuonsOld;
105  }
106  else{
107  res[iL] = inputMuonsNew;
108  }
109  }
110  res[123] = outputMuon;
111  res[125] = outputKalmanMuon;
112  }
113  return res;
114  };
115  };
116 }
117 
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:83
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:89
std::map< std::pair< int, int >, Packers > PackerMap
Definition: PackingSetup.h:25
Definition: AMCSpec.h:8