CMS 3D CMS Logo

RCTEmRegionPacker.cc
Go to the documentation of this file.
3 
5 
12 
13 #include "PhysicsToBitConverter.h"
14 #include "rctDataBase.h"
15 
16 #include "CaloTokens.h"
17 #include "RCTEmRegionPacker.h"
18 
19 namespace l1t {
20  namespace stage1 {
23  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloRegionToken(), caloregion);
24 
26  event.getByToken(static_cast<const CaloTokens*>(toks)->getCaloEmCandToken(), caloemcand);
27 
28  std::vector<uint32_t> load[36];
29 
30  for (int i = 0; i <= 0; ++i) {
31  int n = 0;
33  for (auto j = caloregion->begin(); j != caloregion->end(); ++j, ++n) {
34  int et = (int)j->et();
35  int overFlow = (int)j->overFlow();
36  int fineGrain = (int)j->fineGrain();
37  int mip = (int)j->mip();
38  bool tauveto = j->tauVeto();
39  //int quiet=(int)j->quiet();
40 
41  int rctCrate = (int)j->rctCrate();
42  int rctCard = (int)j->rctCard();
43  int rctRegion = (int)j->rctRegionIndex();
44  bool isHf = (bool)j->isHf();
45 
46  if (!isHf) {
47  converter[rctCrate].SetRCEt(et, rctCard, rctRegion);
48  converter[rctCrate].SetRCOf(overFlow, rctCard, rctRegion);
49  converter[rctCrate].SetRCTau(tauveto, rctCard, rctRegion);
50  converter[rctCrate].SetRCHad(mip, rctCard, rctRegion);
51  LogDebug("L1T") << "CRATE" << rctCrate << "region=" << rctRegion << ", card=" << rctCard << ", rgnEt=" << et
52  << ", overflow=" << overFlow << ", tauveto=" << tauveto << ", hadveto=" << mip << std::endl;
53 
54  } else {
55  converter[rctCrate].SetHFEt(et, rctRegion);
56  converter[rctCrate].SetHFFg(fineGrain, rctRegion);
57  LogDebug("L1T") << "CRATE" << rctCrate << "region=" << rctRegion << ", rgnEt=" << et << std::endl;
58  }
59  } //end calo region
60 
61  int m = 0;
62  for (auto j = caloemcand->begin(); j != caloemcand->end(); ++j, ++m) {
63  int rank = (int)j->rank();
64  int index = (int)j->index();
65  int rctCrate = (int)j->rctCrate();
66  bool isolated = (bool)j->isolated();
67  int rctCard = (int)j->rctCard();
68  int rctRegion = (int)j->rctRegion();
69 
70  if (isolated) {
71  converter[rctCrate].SetIEEt(rank, index);
72  converter[rctCrate].SetIEReg(rctRegion, index);
73  converter[rctCrate].SetIECard(rctCard, index);
74  LogDebug("L1T") << "CRATE" << rctCrate << "ISO em rank=" << rank << ", region=" << rctRegion
75  << ", card=" << rctCard << std::endl;
76  } else {
77  converter[rctCrate].SetNEEt(rank, index);
78  converter[rctCrate].SetNEReg(rctRegion, index);
79  converter[rctCrate].SetNECard(rctCard, index);
80  LogDebug("L1T") << "CRATE" << rctCrate << "NON ISO em rank=" << rank << ", region=" << rctRegion
81  << ", card=" << rctCard << std::endl;
82  }
83  } //end of em cand
84 
85  for (int in = 0; in < 18; in++) {
86  converter[in].Extract32bitwords();
87  for (int d = 0; d < 6; d++) {
88  load[2 * in].push_back((uint32_t)converter[in].Get32bitWordLinkEven(d));
89  load[2 * in + 1].push_back((uint32_t)converter[in].Get32bitWordLinkOdd(d));
90  }
91  }
92  } // end of BX
93 
94  rctDataBase database;
95 
96  Blocks res = {};
97 
98  for (int i = 0; i < 36; ++i) {
99  unsigned int mycrateRCT = (int)(i / 2);
100  bool myRCTeven;
101  if (i % 2 == 0)
102  myRCTeven = true;
103  else
104  myRCTeven = false;
105  int linkMP7 = -1;
106  database.GetLinkMP7(mycrateRCT, myRCTeven, linkMP7);
107  res.push_back(Block(2 * linkMP7, load[i], 0));
108  res.push_back(Block(2 * linkMP7, load[i], 1));
109  }
110  return res;
111  }
112  } // namespace stage1
113 } // namespace l1t
void GetLinkMP7(unsigned int RCTcrate, bool RCTeven, int &linkMP7)
Definition: rctDataBase.h:50
delete x;
Definition: CaloConfig.h:22
Definition: Electron.h:6
std::vector< Block > Blocks
Definition: Block.h:99
d
Definition: ztail.py:151
#define DEFINE_L1T_PACKER(type)
Definition: PackerFactory.h:23
def load(fileName)
Definition: svgfig.py:547
Definition: event.py:1
Blocks pack(const edm::Event &, const PackerTokens *) override
#define LogDebug(id)