test
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  if (eta==CaloTools::kHFBegin) continue;
40 
41  // Get four towers +/- eta and phi and phi+1 to all be packed in this loop
45  l1t::CaloTower t4 = towers->at(i,l1t::CaloTools::caloTowerHash(-1*eta,phi+1));
46 
47  // Merge phi and phi+1 into one block (phi is LSW, phi+1 is MSW)
48  uint32_t word1 = \
49  std::min(t1.hwPt(), 0x1FF) |
50  (t1.hwEtRatio() & 0x7) << 9 |
51  (t1.hwQual() & 0xF) << 12;
52 
53  word1 = word1 |
54  std::min(t2.hwPt(), 0x1FF) << 16 |
55  (t2.hwEtRatio() & 0x7) << 25 |
56  (t2.hwQual() & 0xF) << 28;
57 
58  load.push_back(word1);
59 
60  // Do it all again for -eta
61 
62  uint32_t word2 = \
63  std::min(t3.hwPt(), 0x1FF) |
64  (t3.hwEtRatio() & 0x7) << 9 |
65  (t3.hwQual() & 0xF) << 12;
66 
67  word2 = word2 |
68  std::min(t4.hwPt(), 0x1FF) << 16 |
69  (t4.hwEtRatio() & 0x7) << 25 |
70  (t4.hwQual() & 0xF) << 28;
71 
72  load.push_back(word2);
73 
74  }
75 
76  res.push_back(Block(id, load));
77 
78  }
79  }
80  return res;
81  }
82 }
83 }
84 
int i
Definition: DBlmapReader.cc:9
int hwEtRatio() const
Definition: CaloTower.cc:74
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:66
static const int kHFBegin
Definition: CaloTools.h:40
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
def load
Definition: svgfig.py:546
std::vector< Block > Blocks
Definition: Block.h:68
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.h:51
int hwPt() const
Definition: L1Candidate.h:48
Geom::Phi< T > phi() const
#define DEFINE_L1T_PACKER(type)
Definition: Packer.h:36