CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1RCTReceiverCard Class Reference

#include <L1RCTReceiverCard.h>

Public Member Functions

int cardNumber ()
 
int crateNumber ()
 
void fileInput (char *filename)
 
void fillInput (const std::vector< unsigned short > &input)
 
void fillMuonBits ()
 
void fillRegionSums ()
 
void fillTauBits ()
 
unsigned short getEtIn10BitsRegion (int i)
 
unsigned short getMuonBitRegion (int i)
 
unsigned short getOverFlowBitRegion (int i)
 
L1RCTRegiongetRegion (int i)
 
unsigned short getTauBitRegion (int i)
 
 L1RCTReceiverCard (int crateNumber, int cardNumber, const L1RCTLookupTables *rctLookupTables)
 
void print ()
 
void printEdges ()
 
void randomInput ()
 
std::vector< unsigned short > towerToRegionMap (int towernum)
 
 ~L1RCTReceiverCard ()
 

Private Member Functions

unsigned short calcMuonBit (L1RCTRegion region)
 
unsigned short calcRegionSum (L1RCTRegion region)
 
unsigned short calcTauBit (L1RCTRegion region)
 
 L1RCTReceiverCard ()=delete
 

Private Attributes

unsigned short cardNo
 
unsigned short crtNo
 
std::vector< unsigned short > etIn10Bits
 
std::vector< unsigned short > muonBits
 
std::vector< unsigned short > overFlowBits
 
const L1RCTLookupTablesrctLookupTables_
 
std::vector< L1RCTRegionregions
 
std::vector< unsigned short > tauBits
 

Detailed Description

Definition at line 14 of file L1RCTReceiverCard.h.

Constructor & Destructor Documentation

◆ L1RCTReceiverCard() [1/2]

L1RCTReceiverCard::L1RCTReceiverCard ( int  crateNumber,
int  cardNumber,
const L1RCTLookupTables rctLookupTables 
)

Definition at line 18 of file L1RCTReceiverCard.cc.

19  : regions(2),
22  rctLookupTables_(rctLookupTables),
23  etIn10Bits(2),
24  overFlowBits(2),
25  muonBits(2),
26  tauBits(2) {}

◆ ~L1RCTReceiverCard()

L1RCTReceiverCard::~L1RCTReceiverCard ( )

Definition at line 28 of file L1RCTReceiverCard.cc.

28 {}

◆ L1RCTReceiverCard() [2/2]

L1RCTReceiverCard::L1RCTReceiverCard ( )
privatedelete

Member Function Documentation

◆ calcMuonBit()

unsigned short L1RCTReceiverCard::calcMuonBit ( L1RCTRegion  region)
private

Definition at line 232 of file L1RCTReceiverCard.cc.

232  {
233  unsigned short muonBit = 0;
234  for (int i = 0; i < 4; i++) {
235  for (int j = 0; j < 4; j++) {
236  muonBit = muonBit || region.getMuonBit(i, j);
237  }
238  }
239  return muonBit;
240 }

References mps_fire::i, dqmiolumiharvest::j, L1TScalersSCAL_cfi::muonBit, and HLT_FULL_cff::region.

Referenced by fillMuonBits().

◆ calcRegionSum()

unsigned short L1RCTReceiverCard::calcRegionSum ( L1RCTRegion  region)
private

Definition at line 207 of file L1RCTReceiverCard.cc.

207  {
208  unsigned short sum = 0;
209  unsigned short overflow = 0;
210  for (int i = 0; i < 4; i++) {
211  for (int j = 0; j < 4; j++) {
212  unsigned short towerEt = region.getEtIn9Bits(i, j);
213  // If tower is saturated, peg the region to max value
214  // if(towerEt == 0x1FF) sum = 0x3FF; // HARDWARE DOESN'T DO THIS!!
215  // else
216  sum = sum + towerEt;
217  }
218  }
219  if (sum > 1023) {
220  sum = 1023;
221  overflow = 1;
222  }
223  unsigned short sumFullInfo = sum * 2 + overflow;
224  return sumFullInfo;
225 }

References mps_fire::i, dqmiolumiharvest::j, and HLT_FULL_cff::region.

Referenced by fillRegionSums().

◆ calcTauBit()

unsigned short L1RCTReceiverCard::calcTauBit ( L1RCTRegion  region)
private

Definition at line 161 of file L1RCTReceiverCard.cc.

161  {
162  bitset<4> etaPattern;
163  bitset<4> phiPattern;
164 
165  bitset<4> badPattern5(string("0101"));
166  bitset<4> badPattern7(string("0111"));
167  bitset<4> badPattern9(string("1001"));
168  bitset<4> badPattern10(string("1010"));
169  bitset<4> badPattern11(string("1011"));
170  bitset<4> badPattern13(string("1101"));
171  bitset<4> badPattern14(string("1110"));
172  bitset<4> badPattern15(string("1111"));
173 
174  for (int i = 0; i < 4; i++) {
175  phiPattern[i] = region.getActivityBit(i, 0) || region.getActivityBit(i, 1) || region.getActivityBit(i, 2) ||
176  region.getActivityBit(i, 3);
177  etaPattern[i] = region.getActivityBit(0, i) || region.getActivityBit(1, i) || region.getActivityBit(2, i) ||
178  region.getActivityBit(3, i);
179  }
180 
181  bool answer;
182 
183  if (etaPattern != badPattern5 && etaPattern != badPattern7 && etaPattern != badPattern10 &&
184  etaPattern != badPattern11 && etaPattern != badPattern13 && etaPattern != badPattern14 &&
185  etaPattern != badPattern15 && phiPattern != badPattern5 && phiPattern != badPattern7 &&
186  phiPattern != badPattern10 && phiPattern != badPattern11 && phiPattern != badPattern13 &&
187  phiPattern != badPattern14 && phiPattern != badPattern15 && etaPattern != badPattern9 &&
188  phiPattern != badPattern9) { // adding in "9"
189  // return false;
190  answer = false;
191  }
192  // else return true;
193  else {
194  answer = true;
195  }
196  // std::cout << "Tau veto set to " << answer << std::endl;
197  return answer;
198 }

References submit::answer, mps_fire::i, and HLT_FULL_cff::region.

Referenced by fillTauBits().

◆ cardNumber()

int L1RCTReceiverCard::cardNumber ( )
inline

Definition at line 21 of file L1RCTReceiverCard.h.

21 { return cardNo; }

References cardNo.

◆ crateNumber()

int L1RCTReceiverCard::crateNumber ( )
inline

Definition at line 20 of file L1RCTReceiverCard.h.

20 { return crtNo; }

References crtNo.

◆ fileInput()

void L1RCTReceiverCard::fileInput ( char *  filename)

Definition at line 37 of file L1RCTReceiverCard.cc.

37  {
38  std::vector<unsigned short> input(64);
39  unsigned short x;
40  std::ifstream instream(filename);
41  if (instream) {
42  for (int i = 0; i < 64; i++) {
43  if (!(instream >> x))
44  break;
45  else
46  input.at(i) = x;
47  }
48  }
50 }

References corrVsCorr::filename, fillInput(), mps_fire::i, input, and x.

◆ fillInput()

void L1RCTReceiverCard::fillInput ( const std::vector< unsigned short > &  input)

Definition at line 71 of file L1RCTReceiverCard.cc.

71  {
72  std::vector<unsigned short> ecalInput(32);
73  std::vector<unsigned short> ecalFG(32);
74  std::vector<unsigned short> hcalInput(32);
75  std::vector<unsigned short> hcalMuon(32);
76 
77  for (int i = 0; i < 32; i++) {
78  ecalInput.at(i) = input.at(i) / 2;
79  ecalFG.at(i) = input.at(i) & 1;
80  hcalInput.at(i) = input.at(i + 32) / 2;
81  hcalMuon.at(i) = input.at(i + 32) & 1;
82  unsigned long lookup = rctLookupTables_->lookup(
83  ecalInput.at(i), hcalInput.at(i), ecalFG.at(i), crtNo, cardNo, i); // tower number 0-31 now
84  unsigned short etIn7Bits = lookup & 127;
85  unsigned short etIn9Bits = (lookup >> 8) & 511;
86  unsigned short HE_FGBit = (lookup >> 7) & 1;
87  unsigned short activityBit = (lookup >> 17) & 1;
88  std::vector<unsigned short> indices = towerToRegionMap(i);
89  unsigned short r = indices.at(0);
90  unsigned short row = indices.at(1);
91  unsigned short col = indices.at(2);
92  regions.at(r).setEtIn7Bits(row, col, etIn7Bits);
93  regions.at(r).setEtIn9Bits(row, col, etIn9Bits);
94  regions.at(r).setHE_FGBit(row, col, HE_FGBit);
95  regions.at(r).setMuonBit(row, col, hcalMuon.at(i));
96  regions.at(r).setActivityBit(row, col, activityBit);
97  }
98 }

References cardNo, cuy::col, crtNo, mps_fire::i, bTagCombinedSVVariables_cff::indices, input, L1RCTLookupTables::lookup(), alignCSCRings::r, rctLookupTables_, regions, and towerToRegionMap().

Referenced by fileInput(), and randomInput().

◆ fillMuonBits()

void L1RCTReceiverCard::fillMuonBits ( )

Definition at line 227 of file L1RCTReceiverCard.cc.

227  {
228  for (int i = 0; i < 2; i++)
229  muonBits.at(i) = calcMuonBit(regions.at(i));
230 }

References calcMuonBit(), mps_fire::i, muonBits, and regions.

◆ fillRegionSums()

void L1RCTReceiverCard::fillRegionSums ( )

Definition at line 200 of file L1RCTReceiverCard.cc.

200  {
201  for (int i = 0; i < 2; i++) {
202  etIn10Bits.at(i) = (calcRegionSum(regions.at(i))) / 2;
203  overFlowBits.at(i) = (calcRegionSum(regions.at(i)) & 1);
204  }
205 }

References calcRegionSum(), etIn10Bits, mps_fire::i, overFlowBits, and regions.

◆ fillTauBits()

void L1RCTReceiverCard::fillTauBits ( )

Definition at line 156 of file L1RCTReceiverCard.cc.

156  {
157  for (int i = 0; i < 2; i++)
158  tauBits.at(i) = calcTauBit(regions.at(i));
159 }

References calcTauBit(), mps_fire::i, regions, and tauBits.

◆ getEtIn10BitsRegion()

unsigned short L1RCTReceiverCard::getEtIn10BitsRegion ( int  i)
inline

Definition at line 57 of file L1RCTReceiverCard.h.

57 { return etIn10Bits.at(i); }

References etIn10Bits, and mps_fire::i.

◆ getMuonBitRegion()

unsigned short L1RCTReceiverCard::getMuonBitRegion ( int  i)
inline

Definition at line 55 of file L1RCTReceiverCard.h.

55 { return muonBits.at(i); }

References mps_fire::i, and muonBits.

◆ getOverFlowBitRegion()

unsigned short L1RCTReceiverCard::getOverFlowBitRegion ( int  i)
inline

Definition at line 56 of file L1RCTReceiverCard.h.

56 { return overFlowBits.at(i); }

References mps_fire::i, and overFlowBits.

◆ getRegion()

L1RCTRegion* L1RCTReceiverCard::getRegion ( int  i)
inline

Definition at line 53 of file L1RCTReceiverCard.h.

53 { return &regions.at(i); }

References mps_fire::i, and regions.

◆ getTauBitRegion()

unsigned short L1RCTReceiverCard::getTauBitRegion ( int  i)
inline

Definition at line 54 of file L1RCTReceiverCard.h.

54 { return tauBits.at(i); }

References mps_fire::i, and tauBits.

◆ print()

void L1RCTReceiverCard::print ( void  )

Definition at line 242 of file L1RCTReceiverCard.cc.

242  {
243  std::cout << "Receiver Card " << cardNo << " in Crate " << crtNo << std::endl;
244 
245  for (int i = 0; i < 2; i++) {
246  std::cout << "Region " << i << " information" << std::endl;
247  regions.at(i).print();
248  std::cout << "Region Et sum " << etIn10Bits.at(i) << std::endl;
249  std::cout << "Tau Veto Bit " << tauBits.at(i) << std::endl;
250  std::cout << "Muon Bit " << muonBits.at(i) << std::endl;
251  }
252 }

References cardNo, gather_cfg::cout, crtNo, etIn10Bits, mps_fire::i, muonBits, regions, and tauBits.

◆ printEdges()

void L1RCTReceiverCard::printEdges ( )
inline

Definition at line 63 of file L1RCTReceiverCard.h.

63  {
64  regions.at(0).printEdges();
65  regions.at(1).printEdges();
66  }

References regions.

◆ randomInput()

void L1RCTReceiverCard::randomInput ( )

Definition at line 30 of file L1RCTReceiverCard.cc.

30  {
31  std::vector<unsigned short> input(64);
32  for (int i = 0; i < 64; i++)
33  input.at(i) = rand() & 511;
35 }

References fillInput(), mps_fire::i, and input.

◆ towerToRegionMap()

vector< unsigned short > L1RCTReceiverCard::towerToRegionMap ( int  towernum)

Definition at line 100 of file L1RCTReceiverCard.cc.

100  {
101  std::vector<unsigned short> returnVec(3);
102  unsigned short region;
103  unsigned short towerrow;
104  unsigned short towercol;
105  if (crtNo < 9) {
106  if (cardNo != 6) {
107  if (towernum < 16) {
108  region = 0;
109  towerrow = towernum % 4;
110  towercol = 3 - (towernum / 4);
111  } else {
112  region = 1;
113  towerrow = towernum % 4;
114  towercol = 7 - (towernum / 4);
115  }
116  } else {
117  if (towernum < 16) {
118  region = 0;
119  towerrow = towernum % 4;
120  towercol = 3 - (towernum / 4);
121  } else {
122  region = 1;
123  towerrow = towernum % 4;
124  towercol = (towernum / 4) - 4;
125  }
126  }
127  } else {
128  if (cardNo != 6) {
129  if (towernum < 16) {
130  region = 0;
131  towerrow = towernum % 4;
132  towercol = towernum / 4;
133  } else {
134  region = 1;
135  towerrow = towernum % 4;
136  towercol = (towernum / 4) - 4;
137  }
138  } else {
139  if (towernum < 16) {
140  region = 0;
141  towerrow = towernum % 4;
142  towercol = towernum / 4;
143  } else {
144  region = 1;
145  towerrow = towernum % 4;
146  towercol = 7 - (towernum / 4);
147  }
148  }
149  }
150  returnVec.at(0) = region;
151  returnVec.at(1) = towerrow;
152  returnVec.at(2) = towercol;
153  return returnVec;
154 }

References cardNo, crtNo, and HLT_FULL_cff::region.

Referenced by fillInput().

Member Data Documentation

◆ cardNo

unsigned short L1RCTReceiverCard::cardNo
private

Definition at line 78 of file L1RCTReceiverCard.h.

Referenced by cardNumber(), fillInput(), print(), and towerToRegionMap().

◆ crtNo

unsigned short L1RCTReceiverCard::crtNo
private

Definition at line 77 of file L1RCTReceiverCard.h.

Referenced by crateNumber(), fillInput(), print(), and towerToRegionMap().

◆ etIn10Bits

std::vector<unsigned short> L1RCTReceiverCard::etIn10Bits
private

Definition at line 82 of file L1RCTReceiverCard.h.

Referenced by fillRegionSums(), getEtIn10BitsRegion(), and print().

◆ muonBits

std::vector<unsigned short> L1RCTReceiverCard::muonBits
private

Definition at line 84 of file L1RCTReceiverCard.h.

Referenced by fillMuonBits(), getMuonBitRegion(), and print().

◆ overFlowBits

std::vector<unsigned short> L1RCTReceiverCard::overFlowBits
private

Definition at line 83 of file L1RCTReceiverCard.h.

Referenced by fillRegionSums(), and getOverFlowBitRegion().

◆ rctLookupTables_

const L1RCTLookupTables* L1RCTReceiverCard::rctLookupTables_
private

Definition at line 80 of file L1RCTReceiverCard.h.

Referenced by fillInput().

◆ regions

std::vector<L1RCTRegion> L1RCTReceiverCard::regions
private

◆ tauBits

std::vector<unsigned short> L1RCTReceiverCard::tauBits
private

Definition at line 85 of file L1RCTReceiverCard.h.

Referenced by fillTauBits(), getTauBitRegion(), and print().

bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
mps_fire.i
i
Definition: mps_fire.py:428
L1RCTReceiverCard::crtNo
unsigned short crtNo
Definition: L1RCTReceiverCard.h:77
input
static const std::string input
Definition: EdmProvDump.cc:48
L1RCTReceiverCard::crateNumber
int crateNumber()
Definition: L1RCTReceiverCard.h:20
L1RCTLookupTables::lookup
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const
Definition: L1RCTLookupTables.cc:22
cuy.col
col
Definition: cuy.py:1010
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1RCTReceiverCard::fillInput
void fillInput(const std::vector< unsigned short > &input)
Definition: L1RCTReceiverCard.cc:71
DDAxes::x
L1RCTReceiverCard::cardNo
unsigned short cardNo
Definition: L1RCTReceiverCard.h:78
L1RCTReceiverCard::rctLookupTables_
const L1RCTLookupTables * rctLookupTables_
Definition: L1RCTReceiverCard.h:80
L1RCTReceiverCard::calcTauBit
unsigned short calcTauBit(L1RCTRegion region)
Definition: L1RCTReceiverCard.cc:161
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
submit.answer
answer
Definition: submit.py:45
L1RCTReceiverCard::tauBits
std::vector< unsigned short > tauBits
Definition: L1RCTReceiverCard.h:85
L1RCTReceiverCard::overFlowBits
std::vector< unsigned short > overFlowBits
Definition: L1RCTReceiverCard.h:83
L1TScalersSCAL_cfi.muonBit
muonBit
Definition: L1TScalersSCAL_cfi.py:15
L1RCTReceiverCard::calcMuonBit
unsigned short calcMuonBit(L1RCTRegion region)
Definition: L1RCTReceiverCard.cc:232
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
L1RCTReceiverCard::etIn10Bits
std::vector< unsigned short > etIn10Bits
Definition: L1RCTReceiverCard.h:82
L1RCTReceiverCard::calcRegionSum
unsigned short calcRegionSum(L1RCTRegion region)
Definition: L1RCTReceiverCard.cc:207
alignCSCRings.r
r
Definition: alignCSCRings.py:93
L1RCTReceiverCard::regions
std::vector< L1RCTRegion > regions
Definition: L1RCTReceiverCard.h:72
L1RCTReceiverCard::muonBits
std::vector< unsigned short > muonBits
Definition: L1RCTReceiverCard.h:84
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
L1RCTReceiverCard::cardNumber
int cardNumber()
Definition: L1RCTReceiverCard.h:21
L1RCTReceiverCard::towerToRegionMap
std::vector< unsigned short > towerToRegionMap(int towernum)
Definition: L1RCTReceiverCard.cc:100