CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 

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::L1RCTReceiverCard ( int  crateNumber,
int  cardNumber,
const L1RCTLookupTables rctLookupTables 
)

Definition at line 18 of file L1RCTReceiverCard.cc.

18  :
20  rctLookupTables_(rctLookupTables),
22 {
23 }
unsigned short cardNo
unsigned short crtNo
const L1RCTLookupTables * rctLookupTables_
std::vector< unsigned short > overFlowBits
std::vector< unsigned short > etIn10Bits
std::vector< unsigned short > muonBits
std::vector< unsigned short > tauBits
std::vector< L1RCTRegion > regions
L1RCTReceiverCard::~L1RCTReceiverCard ( )

Definition at line 25 of file L1RCTReceiverCard.cc.

25 {}
L1RCTReceiverCard::L1RCTReceiverCard ( )
private

Member Function Documentation

unsigned short L1RCTReceiverCard::calcMuonBit ( L1RCTRegion  region)
private

Definition at line 244 of file L1RCTReceiverCard.cc.

References L1RCTRegion::getMuonBit(), i, and j.

Referenced by fillMuonBits().

244  {
245  unsigned short muonBit = 0;
246  for(int i = 0; i<4; i++){
247  for(int j = 0; j<4; j++){
248  muonBit = muonBit || region.getMuonBit(i,j);
249  }
250  }
251  return muonBit;
252 
253 }
int i
Definition: DBlmapReader.cc:9
unsigned short getMuonBit(int i, int j) const
Definition: L1RCTRegion.cc:70
int j
Definition: DBlmapReader.cc:9
unsigned short L1RCTReceiverCard::calcRegionSum ( L1RCTRegion  region)
private

Definition at line 219 of file L1RCTReceiverCard.cc.

References L1RCTRegion::getEtIn9Bits(), i, and j.

Referenced by fillRegionSums().

219  {
220  unsigned short sum = 0;
221  unsigned short overflow = 0;
222  for(int i = 0; i<4; i++){
223  for(int j = 0; j<4; j++){
224  unsigned short towerEt = region.getEtIn9Bits(i,j);
225  // If tower is saturated, peg the region to max value
226  //if(towerEt == 0x1FF) sum = 0x3FF; // HARDWARE DOESN'T DO THIS!!
227  //else
228  sum = sum + towerEt;
229  }
230  }
231  if(sum > 1023){
232  sum = 1023;
233  overflow = 1;
234  }
235  unsigned short sumFullInfo = sum*2 + overflow;
236  return sumFullInfo;
237 }
int i
Definition: DBlmapReader.cc:9
unsigned short getEtIn9Bits(int i, int j) const
Definition: L1RCTRegion.cc:59
int j
Definition: DBlmapReader.cc:9
unsigned short L1RCTReceiverCard::calcTauBit ( L1RCTRegion  region)
private

Definition at line 171 of file L1RCTReceiverCard.cc.

References submit::answer, L1RCTRegion::getActivityBit(), and i.

Referenced by fillTauBits().

171  {
172  bitset<4> etaPattern;
173  bitset<4> phiPattern;
174 
175  bitset<4> badPattern5(string("0101"));
176  bitset<4> badPattern7(string("0111"));
177  bitset<4> badPattern9(string("1001"));
178  bitset<4> badPattern10(string("1010"));
179  bitset<4> badPattern11(string("1011"));
180  bitset<4> badPattern13(string("1101"));
181  bitset<4> badPattern14(string("1110"));
182  bitset<4> badPattern15(string("1111"));
183 
184  for(int i = 0; i<4; i++){
185  phiPattern[i] = region.getActivityBit(i,0) || region.getActivityBit(i,1) ||
186  region.getActivityBit(i,2) || region.getActivityBit(i,3);
187  etaPattern[i] = region.getActivityBit(0,i) || region.getActivityBit(1,i) ||
188  region.getActivityBit(2,i) || region.getActivityBit(3,i);
189  }
190 
191  bool answer;
192 
193  if(etaPattern != badPattern5 && etaPattern != badPattern7 &&
194  etaPattern != badPattern10 && etaPattern != badPattern11 &&
195  etaPattern != badPattern13 && etaPattern != badPattern14 &&
196  etaPattern != badPattern15 && phiPattern != badPattern5 &&
197  phiPattern != badPattern7 && phiPattern != badPattern10 &&
198  phiPattern != badPattern11 && phiPattern != badPattern13 &&
199  phiPattern != badPattern14 && phiPattern != badPattern15 &&
200  etaPattern != badPattern9 && phiPattern != badPattern9){ // adding in "9"
201  //return false;
202  answer = false;
203  }
204  //else return true;
205  else {
206  answer = true;
207  }
208  // std::cout << "Tau veto set to " << answer << std::endl;
209  return answer;
210 }
answer
Definition: submit.py:44
int i
Definition: DBlmapReader.cc:9
unsigned short getActivityBit(int i, int j) const
Definition: L1RCTRegion.cc:82
int L1RCTReceiverCard::cardNumber ( )
inline

Definition at line 23 of file L1RCTReceiverCard.h.

References cardNo.

23 {return cardNo;}
unsigned short cardNo
int L1RCTReceiverCard::crateNumber ( )
inline

Definition at line 22 of file L1RCTReceiverCard.h.

References crtNo.

22 {return crtNo;}
unsigned short crtNo
void L1RCTReceiverCard::fileInput ( char *  filename)

Definition at line 34 of file L1RCTReceiverCard.cc.

References fillInput(), i, input, and x.

34  {
35  std::vector<unsigned short> input(64);
36  unsigned short x;
37  std::ifstream instream(filename);
38  if(instream){
39  for(int i = 0; i<64; i++){
40  if(!(instream >> x))
41  break;
42  else
43  input.at(i) = x;
44  }
45  }
47 }
int i
Definition: DBlmapReader.cc:9
void fillInput(const std::vector< unsigned short > &input)
static std::string const input
Definition: EdmProvDump.cc:43
tuple filename
Definition: lut2db_cfg.py:20
void L1RCTReceiverCard::fillInput ( const std::vector< unsigned short > &  input)

Definition at line 70 of file L1RCTReceiverCard.cc.

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

Referenced by fileInput(), and randomInput().

70  {
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(ecalInput.at(i),hcalInput.at(i),ecalFG.at(i),crtNo, cardNo, i); // tower number 0-31 now
83  unsigned short etIn7Bits = lookup&127;
84  unsigned short etIn9Bits = (lookup >> 8)&511;
85  unsigned short HE_FGBit = (lookup>>7)&1;
86  unsigned short activityBit = (lookup>>17)&1;
87  std::vector<unsigned short> indices = towerToRegionMap(i);
88  unsigned short r = indices.at(0);
89  unsigned short row = indices.at(1);
90  unsigned short col = indices.at(2);
91  regions.at(r).setEtIn7Bits(row,col,etIn7Bits);
92  regions.at(r).setEtIn9Bits(row,col,etIn9Bits);
93  regions.at(r).setHE_FGBit(row,col,HE_FGBit);
94  regions.at(r).setMuonBit(row,col,hcalMuon.at(i));
95  regions.at(r).setActivityBit(row,col,activityBit);
96  }
97 
98 }
int i
Definition: DBlmapReader.cc:9
unsigned short cardNo
unsigned short crtNo
static std::string const input
Definition: EdmProvDump.cc:43
const L1RCTLookupTables * rctLookupTables_
std::vector< unsigned short > towerToRegionMap(int towernum)
std::vector< L1RCTRegion > regions
int col
Definition: cuy.py:1008
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const
void L1RCTReceiverCard::fillMuonBits ( )

Definition at line 239 of file L1RCTReceiverCard.cc.

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

239  {
240  for(int i = 0; i<2; i++)
241  muonBits.at(i) = calcMuonBit(regions.at(i));
242 }
int i
Definition: DBlmapReader.cc:9
unsigned short calcMuonBit(L1RCTRegion region)
std::vector< unsigned short > muonBits
std::vector< L1RCTRegion > regions
void L1RCTReceiverCard::fillRegionSums ( )

Definition at line 212 of file L1RCTReceiverCard.cc.

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

212  {
213  for(int i = 0; i<2; i++){
214  etIn10Bits.at(i) = (calcRegionSum(regions.at(i)))/2;
215  overFlowBits.at(i) = (calcRegionSum(regions.at(i)) & 1);
216  }
217 }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned short > overFlowBits
std::vector< unsigned short > etIn10Bits
unsigned short calcRegionSum(L1RCTRegion region)
std::vector< L1RCTRegion > regions
void L1RCTReceiverCard::fillTauBits ( )

Definition at line 166 of file L1RCTReceiverCard.cc.

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

166  {
167  for(int i = 0; i<2; i++)
168  tauBits.at(i) = calcTauBit(regions.at(i));
169 }
int i
Definition: DBlmapReader.cc:9
unsigned short calcTauBit(L1RCTRegion region)
std::vector< unsigned short > tauBits
std::vector< L1RCTRegion > regions
unsigned short L1RCTReceiverCard::getEtIn10BitsRegion ( int  i)
inline

Definition at line 61 of file L1RCTReceiverCard.h.

References etIn10Bits.

61 {return etIn10Bits.at(i);}
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned short > etIn10Bits
unsigned short L1RCTReceiverCard::getMuonBitRegion ( int  i)
inline

Definition at line 59 of file L1RCTReceiverCard.h.

References muonBits.

59 {return muonBits.at(i);}
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned short > muonBits
unsigned short L1RCTReceiverCard::getOverFlowBitRegion ( int  i)
inline

Definition at line 60 of file L1RCTReceiverCard.h.

References overFlowBits.

60 {return overFlowBits.at(i);}
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned short > overFlowBits
L1RCTRegion* L1RCTReceiverCard::getRegion ( int  i)
inline

Definition at line 55 of file L1RCTReceiverCard.h.

References regions.

55  {
56  return &regions.at(i);
57  }
int i
Definition: DBlmapReader.cc:9
std::vector< L1RCTRegion > regions
unsigned short L1RCTReceiverCard::getTauBitRegion ( int  i)
inline

Definition at line 58 of file L1RCTReceiverCard.h.

References tauBits.

58 {return tauBits.at(i);}
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned short > tauBits
void L1RCTReceiverCard::print ( void  )

Definition at line 255 of file L1RCTReceiverCard.cc.

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

255  {
256  std::cout <<"Receiver Card " << cardNo << " in Crate " << crtNo <<std::endl;
257 
258  for(int i=0;i<2;i++){
259  std::cout << "Region " << i << " information" << std::endl;
260  regions.at(i).print();
261  std::cout << "Region Et sum " << etIn10Bits.at(i) << std::endl;
262  std::cout << "Tau Veto Bit " << tauBits.at(i) << std::endl;
263  std::cout << "Muon Bit " << muonBits.at(i) << std::endl;
264  }
265 }
int i
Definition: DBlmapReader.cc:9
unsigned short cardNo
unsigned short crtNo
std::vector< unsigned short > etIn10Bits
std::vector< unsigned short > muonBits
std::vector< unsigned short > tauBits
tuple cout
Definition: gather_cfg.py:121
std::vector< L1RCTRegion > regions
void L1RCTReceiverCard::printEdges ( )
inline

Definition at line 67 of file L1RCTReceiverCard.h.

References regions.

67  {
68  regions.at(0).printEdges();
69  regions.at(1).printEdges();
70  }
std::vector< L1RCTRegion > regions
void L1RCTReceiverCard::randomInput ( )

Definition at line 27 of file L1RCTReceiverCard.cc.

References fillInput(), i, input, and rand().

27  {
28  std::vector<unsigned short> input(64);
29  for(int i = 0; i<64;i++)
30  input.at(i) = rand()&511;
32 }
int i
Definition: DBlmapReader.cc:9
void fillInput(const std::vector< unsigned short > &input)
static std::string const input
Definition: EdmProvDump.cc:43
Signal rand(Signal arg)
Definition: vlib.cc:442
vector< unsigned short > L1RCTReceiverCard::towerToRegionMap ( int  towernum)

Definition at line 101 of file L1RCTReceiverCard.cc.

References cardNo, crtNo, and HLT_25ns14e33_v3_cff::region.

Referenced by fillInput().

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

Member Data Documentation

unsigned short L1RCTReceiverCard::cardNo
private

Definition at line 83 of file L1RCTReceiverCard.h.

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

unsigned short L1RCTReceiverCard::crtNo
private

Definition at line 82 of file L1RCTReceiverCard.h.

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

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

Definition at line 87 of file L1RCTReceiverCard.h.

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

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

Definition at line 89 of file L1RCTReceiverCard.h.

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

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

Definition at line 88 of file L1RCTReceiverCard.h.

Referenced by fillRegionSums(), and getOverFlowBitRegion().

const L1RCTLookupTables* L1RCTReceiverCard::rctLookupTables_
private

Definition at line 85 of file L1RCTReceiverCard.h.

Referenced by fillInput().

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

Definition at line 90 of file L1RCTReceiverCard.h.

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