test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RegionalMuonGMTPacker.cc
Go to the documentation of this file.
2 
4 
6 #include "GMTTokens.h"
7 
8 namespace l1t {
9  namespace stage2 {
10  class RegionalMuonGMTPacker : public Packer {
11  public:
12  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
13  private:
14  typedef std::map<unsigned int, std::vector<uint32_t>> PayloadMap;
15  void packTF(const edm::Event&, const edm::EDGetTokenT<RegionalMuonCandBxCollection>&, Blocks&, const std::vector<unsigned int>&);
16  };
17  }
18 }
19 
20 // Implementation
21 namespace l1t {
22  namespace stage2 {
23  Blocks
25  {
26 
27  //auto bmtfToken = static_cast<const GMTTokens*>(toks)->getRegionalMuonCandTokenBMTF();
28  //auto omtfToken = static_cast<const GMTTokens*>(toks)->getRegionalMuonCandTokenOMTF();
29  //auto emtfToken = static_cast<const GMTTokens*>(toks)->getRegionalMuonCandTokenEMTF();
30 
31  Blocks blocks;
32 
33  // link ids for the different TFs
34  //std::vector<unsigned int> bmtfLinks {48,49,50,51,52,53,54,55,56,57,58,59};
35  //std::vector<unsigned int> omtfLinks {42,43,44,45,46,47,60,61,62,63,64,65};
36  //std::vector<unsigned int> emtfLinks {36,37,38,39,40,41,66,67,68,69,70,71};
37 
38  // pack the muons for each TF in blocks
39  //packTF(event, bmtfToken, blocks, bmtfLinks);
40  //packTF(event, omtfToken, blocks, omtfLinks);
41  //packTF(event, emtfToken, blocks, emtfLinks);
42 
43  return blocks;
44  }
45 
46  void
48  {
50  event.getByToken(tfToken, muons);
51 
52  PayloadMap payloadMap;
53 
54  unsigned bxCtr = 0;
55  for (int i = muons->getFirstBX(); i <= muons->getLastBX(); ++i, ++bxCtr) {
56  for (auto mu = muons->begin(i); mu != muons->end(i); ++mu) {
57  uint32_t msw = 0;
58  uint32_t lsw = 0;
59 
61 
62  payloadMap[mu->link()*2].push_back(lsw);
63  payloadMap[mu->link()*2].push_back(msw);
64  }
65 
66  // muons are expected to come on a range of links depending on the the TF
67  // but even if there was no muon coming from a processor the block should be generated
68  // so add these links without muons to the map as well so that they will be filled with zeros
69  for (const auto &link : links) {
70  if (payloadMap.count(link*2) == 0) {
71  payloadMap[link*2].push_back(0);
72  } else {
73  // if the key was already created in a previous BX then seed an entry for the padding if nothing was filled in this bx
74  if (payloadMap[link*2].size() == bxCtr * 6) {
75  payloadMap[link*2].push_back(0);
76  }
77  }
78  }
79 
80  // padding to 3 muons per block id (link) per BX
81  for (auto &kv : payloadMap) {
82  while (kv.second.size() % 6 != 0) {
83  kv.second.push_back(0);
84  }
85  }
86  }
87 
88  // push everything in the blocks vector
89  for (auto &kv : payloadMap) {
90  blocks.push_back(Block(kv.first, kv.second));
91  }
92  }
93  }
94 }
95 
int i
Definition: DBlmapReader.cc:9
std::map< unsigned int, std::vector< uint32_t > > PayloadMap
static void generatePackedDataWords(const RegionalMuonCand &, uint32_t &, uint32_t &)
std::vector< Block > Blocks
Definition: Block.h:68
const int mu
Definition: Constants.h:22
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
list blocks
Definition: gather_cfg.py:90
tuple muons
Definition: patZpeak.py:38
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
void packTF(const edm::Event &, const edm::EDGetTokenT< RegionalMuonCandBxCollection > &, Blocks &, const std::vector< unsigned int > &)
#define DEFINE_L1T_PACKER(type)
Definition: Packer.h:36
tuple size
Write out results.