CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowerPacker.cc
Go to the documentation of this file.
2 
5 
6 #include "CaloTokens.h"
7 
8 namespace l1t {
9  namespace stage2 {
10  class CaloTowerPacker : public Packer {
11  public:
12  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
13  };
14  }
15 }
16 
17 // Implementation
18 
19 namespace l1t {
20 namespace stage2 {
21  Blocks
23  {
24 
26  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloTowerToken(), towers);
27 
28  Blocks res;
29 
30  for (int i = towers->getFirstBX(); i <= towers->getLastBX(); ++i) {
31 
32  for (int phi = 1; phi <=72; phi=phi+2) { // Two phi values per link
33 
34  unsigned int id = 2*phi - 2; // Block IDs start at zero and span even numbers up to 142
35  std::vector<uint32_t> load;
36 
37  for (int eta = 1; eta <=41; eta++) { // This is abs(eta) since +/- eta are interleaved in time
38 
39  // Get four towers +/- eta and phi and phi+1 to all be packed in this loop
43  l1t::CaloTower t4 = towers->at(i,l1t::CaloTools::caloTowerHash(-1*eta,phi+1));
44 
45  // Merge phi and phi+1 into one block (phi is LSW, phi+1 is MSW)
46  uint32_t word1 = \
47  std::min(t1.hwPt(), 0x1FF) |
48  (t1.hwEtRatio() & 0x7) << 9 |
49  (t1.hwQual() & 0xF) << 12;
50 
51  word1 = word1 |
52  std::min(t2.hwPt(), 0x1FF) << 16 |
53  (t2.hwEtRatio() & 0x7) << 25 |
54  (t2.hwQual() & 0xF) << 28;
55 
56  load.push_back(word1);
57 
58  // Do it all again for -eta
59 
60  uint32_t word2 = \
61  std::min(t3.hwPt(), 0x1FF) |
62  (t3.hwEtRatio() & 0x7) << 9 |
63  (t3.hwQual() & 0xF) << 12;
64 
65  word2 = word2 |
66  std::min(t4.hwPt(), 0x1FF) << 16 |
67  (t4.hwEtRatio() & 0x7) << 25 |
68  (t4.hwQual() & 0xF) << 28;
69 
70  load.push_back(word2);
71 
72  }
73 
74  res.push_back(Block(id, load));
75 
76  }
77  }
78  return res;
79  }
80 }
81 }
82 
int i
Definition: DBlmapReader.cc:9
int hwEtRatio() const
Definition: CaloTower.cc:74
T eta() const
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:45
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
def load
Definition: svgfig.py:546
std::vector< Block > Blocks
Definition: Block.h:45
T min(T a, T b)
Definition: MathUtil.h:58
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
int hwQual() const
Definition: L1Candidate.cc:89
int hwPt() const
Definition: L1Candidate.cc:69
#define DEFINE_L1T_PACKER(type)
Definition: Packer.h:36
Definition: DDAxes.h:10