CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
l1t::stage2::CaloTowerPacker Class Reference
Inheritance diagram for l1t::stage2::CaloTowerPacker:
l1t::Packer

Public Member Functions

virtual Blocks pack (const edm::Event &, const PackerTokens *) override
 

Detailed Description

Definition at line 10 of file CaloTowerPacker.cc.

Member Function Documentation

Blocks l1t::stage2::CaloTowerPacker::pack ( const edm::Event event,
const PackerTokens toks 
)
overridevirtual

Implements l1t::Packer.

Definition at line 22 of file CaloTowerPacker.cc.

References l1t::CaloTools::caloTowerHash(), eta, l1t::CaloTower::hwEtRatio(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), i, svgfig::load(), min(), phi(), and HLT_25ns14e33_v1_cff::towers.

Referenced by pyrootRender.interactiveRender::draw().

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  }
int i
Definition: DBlmapReader.cc:9
int hwEtRatio() const
Definition: CaloTower.cc:74
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:45
def load
Definition: svgfig.py:546
std::vector< Block > Blocks
Definition: Block.h:68
T min(T a, T b)
Definition: MathUtil.h:58
int hwQual() const
Definition: L1Candidate.cc:89
int hwPt() const
Definition: L1Candidate.cc:69