CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PhysCandPacker.cc
Go to the documentation of this file.
2 
4 
5 #include "CaloTokens.h"
6 
7 template<typename T, typename F>
9 process(unsigned int id, const BXVector<T>& coll, F filter)
10 {
11  std::vector<uint32_t> load;
12 
13  for (int i = coll.getFirstBX(); i <= coll.getLastBX(); ++i) {
14  uint16_t jetbit[4] = {0, 0, 0, 0};
15  int n = 0;
16  for (auto j = coll.begin(i); j != coll.end(i) && n < 4; ++j) {
17  if (!filter(*j))
18  continue;
19  //std::cout << j->hwPt() << " @ " << j->hwEta() << ", " << j->hwPhi() << " > " << j->hwQual() << " > " << j->hwIso() << std::endl;
20  jetbit[n++] = std::min(j->hwPt(), 0x3F) |
21  (abs(j->hwEta()) & 0x7) << 6 |
22  ((j->hwEta() >> 3) & 0x1) << 9 |
23  (j->hwPhi() & 0x1F) << 10;
24  }
25  uint32_t word0=(jetbit[0] & 0xFFFF) | ((jetbit[1] & 0xFFFF) << 16);
26  uint32_t word1=(jetbit[2] & 0xFFFF) | ((jetbit[3] & 0xFFFF) << 16);
27 
28  word0 |= (1 << 31) | (1 << 15);
29  word1 |= ((i == 0) << 31) | ((i == 0) << 15);
30 
31  load.push_back(word0);
32  load.push_back(word1);
33  }
34 
35  return {l1t::Block(id, load)};
36 }
37 
38 namespace l1t {
39  namespace stage1 {
40  class IsoEGammaPacker : public Packer {
41  public:
42  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
43  };
44 
45  class NonIsoEGammaPacker : public Packer {
46  public:
47  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
48  };
49 
50  class CentralJetPacker : public Packer {
51  public:
52  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
53  };
54 
55  class ForwardJetPacker : public Packer {
56  public:
57  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
58  };
59 
60  class TauPacker : public Packer {
61  public:
62  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
63  };
64 
65  class IsoTauPacker : public Packer {
66  public:
67  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
68  };
69  }
70 }
71 
72 // Implementation
73 
74 namespace l1t {
75  namespace stage1 {
76  Blocks
78  {
80  event.getByToken(static_cast<const CaloTokens*>(toks)->getEGammaToken(), egammas);
81 
82  return process(1, *egammas, [](const l1t::EGamma& eg) -> bool { return eg.hwIso() == 1; });
83  }
84 
85  Blocks
87  {
89  event.getByToken(static_cast<const CaloTokens*>(toks)->getEGammaToken(), egammas);
90 
91  return process(2, *egammas, [](const l1t::EGamma& eg) -> bool { return eg.hwIso() == 0; });
92  }
93 
94  Blocks
96  {
98  event.getByToken(static_cast<const CaloTokens*>(toks)->getJetToken(), jets);
99 
100  return process(3, *jets, [](const l1t::Jet& jet) -> bool { return !(jet.hwQual() & 2); });
101  }
102 
103  Blocks
105  {
107  event.getByToken(static_cast<const CaloTokens*>(toks)->getJetToken(), jets);
108 
109  return process(4, *jets, [](const l1t::Jet& jet) -> bool { return jet.hwQual() & 2; });
110  }
111 
112  Blocks
114  {
116  event.getByToken(static_cast<const CaloTokens*>(toks)->getTauToken(), taus);
117 
118  return process(5, *taus, [](const l1t::Tau& tau) -> bool { return true; });
119  }
120 
121  Blocks
123  {
125  event.getByToken(static_cast<const CaloTokens*>(toks)->getIsoTauToken(), taus);
126 
127  return process(8, *taus, [](const l1t::Tau& tau) -> bool { return true; });
128  }
129  }
130 }
131 
const_iterator end(int bx) const
int i
Definition: DBlmapReader.cc:9
Definition: Tau.h:13
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
int hwIso() const
Definition: L1Candidate.cc:84
Definition: Jet.h:13
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
vector< PseudoJet > jets
def load
Definition: svgfig.py:546
std::vector< Block > Blocks
Definition: Block.h:45
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
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
int hwQual() const
Definition: L1Candidate.cc:89
int getFirstBX() const
JetCorrectorParametersCollection coll
Definition: classes.h:10
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
int getLastBX() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
tuple process
Definition: LaserDQM_cfg.py:3
const_iterator begin(int bx) const
#define DEFINE_L1T_PACKER(type)
Definition: Packer.h:36
virtual Blocks pack(const edm::Event &, const PackerTokens *) override