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