test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HFRingPacker.cc
Go to the documentation of this file.
2 
4 
5 #include "CaloTokens.h"
6 
7 namespace l1t {
8  namespace stage1 {
9  class HFRingPacker : public Packer {
10  public:
11  virtual Blocks pack(const edm::Event&, const PackerTokens*) override;
12  };
13  }
14 }
15 
16 // Implementation
17 
18 namespace l1t {
19  namespace stage1 {
20  Blocks
22  {
24  event.getByToken(static_cast<const CaloTokens*>(toks)->getEtSumToken(), etSums);
25 
26  edm::Handle<CaloSpareBxCollection> calosparesHFBitCounts;
27  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloSpareHFBitCountsToken(), calosparesHFBitCounts);
28 
29  edm::Handle<CaloSpareBxCollection> calosparesHFRingSums;
30  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloSpareHFRingSumsToken(), calosparesHFRingSums);
31 
32  std::vector<uint32_t> load;
33 
34  for (int i = etSums->getFirstBX(); i <= etSums->getLastBX(); ++i) {
35  int n = 0;
36 
37  int hfbitcount=0;
38  int hfringsum=0;
39  int htmissphi=0;
40  int htmiss=0;
41 
42  int flaghtmiss=0;
43 
44  for (auto j = etSums->begin(i); j != etSums->end(i) && n < 4; ++j, ++n) {
45  if (j->getType()==l1t::EtSum::kMissingHt){
46 
47  flaghtmiss=j->hwQual() & 0x1;
48  htmiss=std::min(j->hwPt(),0x7F);
49  htmissphi=std::min(j->hwPhi(),0x1F);
50  }
51  }
52 
53  n=0;
54 
55  for (auto j = calosparesHFBitCounts->begin(i); j != calosparesHFBitCounts->end(i) && n < 2; ++j, ++n) {
56  hfbitcount=std::min(j->hwPt(),0xFFF);
57  }
58 
59  n=0;
60 
61  for (auto j = calosparesHFRingSums->begin(i); j != calosparesHFRingSums->end(i) && n < 2; ++j, ++n) {
62  hfringsum=std::min(j->hwPt(),0xFFF);
63  }
64 
65  uint16_t object[4]={0,0,0,0};
66 
67  object[0]=hfbitcount|((hfringsum & 0x7) << 12);
68  object[1]=htmissphi|((htmiss & 0x7F) << 5 ) |(flaghtmiss<<12)|(0x1 << 14);
69  object[2]=((hfringsum>>3) & 0x1FF) |(0x1)<<10 | (0x1)<<12 | (0x1)<<14;
70  object[3]= 0x1 | (0x1 << 2) | (0x1 << 4) | (0x1 << 6) |(0x1 << 8) | (0x1 << 10) | (0x1 << 12) | (0x1 << 14);
71 
72  uint32_t word0=(object[0] & 0xFFFF) | ((object[1] & 0xFFFF) << 16);
73  uint32_t word1=(object[2] & 0xFFFF) | ((object[3] & 0xFFFF) << 16);
74 
75  word0 |= (1 << 31) | (1 << 15);
76  word1 |= ((i == 0) << 31) | ((i == 0) << 15);
77 
78  load.push_back(word0);
79  load.push_back(word1);
80  }
81 
82  return {Block(7, load)};
83  }
84  }
85 }
86 
int i
Definition: DBlmapReader.cc:9
def load
Definition: svgfig.py:546
std::vector< Block > Blocks
Definition: Block.h:68
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
virtual Blocks pack(const edm::Event &, const PackerTokens *) override
Definition: HFRingPacker.cc:21
#define DEFINE_L1T_PACKER(type)
Definition: Packer.h:36