test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetPacker.cc
Go to the documentation of this file.
2 
4 
5 #include "CaloTokens.h"
6 
8 
9 namespace l1t {
10  namespace stage2 {
11  class JetPacker : public Packer {
12  public:
13  JetPacker(int b1, int b2) : b1_(b1), b2_(b2) {}
14  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
15  int b1_, b2_;
16  };
17 
18  class GTJetPacker : public JetPacker {
19  public:
20  GTJetPacker() : JetPacker(12,14) {}
21  };
22  class CaloJetPacker : public JetPacker {
23  public:
24  CaloJetPacker() : JetPacker(13,15) {}
25  };
26 
27 
28  }
29 }
30 
31 // Implementation
32 
33 namespace l1t {
34 namespace stage2 {
35  Blocks
37  {
39  event.getByToken(static_cast<const CommonTokens*>(toks)->getJetToken(), jets);
40 
41  std::vector<uint32_t> load1, load2;
42 
43  // loop over BX
44  int nBx=0;
45  for (int i = jets->getFirstBX(); i <= jets->getLastBX(); ++i) {
46 
47  // get jets from this BX
48  for (auto j = jets->begin(i); j != jets->end(i); ++j ) {
49 
50  uint32_t packed_eta = abs(j->hwEta()) & 0x7F;
51  if (j->hwEta() < 0){
52  packed_eta = (128 - packed_eta) | 1<<7;
53  }
54 
55  uint32_t word = \
56  std::min(j->hwPt(), 0x7FF) |
57  packed_eta << 11 |
58  (j->hwPhi() & 0xFF) << 19 |
59  (j->hwQual() & 0x7) << 27;
60 
61  // Depending on the number, push onto appropriate link
62  if (load1.size() - nBx*l1t::stage2::layer2::demux::nJetPerLink < l1t::stage2::layer2::demux::nJetPerLink) load1.push_back(word);
63  else load2.push_back(word);
64 
65  }
66 
67 
68  // push zeroes if jets are missing must do this for each BX and each link
71 
72  nBx++;
73 
74  }
75 
76 
77 
78  return {Block(b1_, load1), Block(b2_, load2)};
79  }
80 }
81 }
82 
int i
Definition: DBlmapReader.cc:9
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: JetPacker.cc:36
vector< PseudoJet > jets
std::vector< Block > Blocks
Definition: Block.h:68
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
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
JetPacker(int b1, int b2)
Definition: JetPacker.cc:13
#define DEFINE_L1T_PACKER(type)
Definition: Packer.h:36