CMS 3D CMS Logo

L1RCTReceiverCard Class Reference

#include <L1Trigger/RegionalCaloTrigger/interface/L1RCTReceiverCard.h>

List of all members.

Public Member Functions

int cardNumber ()
int crateNumber ()
void fileInput (char *filename)
void fillInput (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.

00018                                                                                                              :
00019   regions(2),crtNo(crateNumber),cardNo(cardNumber),
00020   rctLookupTables_(rctLookupTables),
00021   etIn10Bits(2), overFlowBits(2),muonBits(2),tauBits(2)
00022 {
00023 }

L1RCTReceiverCard::~L1RCTReceiverCard (  ) 

Definition at line 25 of file L1RCTReceiverCard.cc.

00025 {}

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().

00244                                                                {
00245   unsigned short muonBit = 0;
00246   for(int i = 0; i<4; i++){
00247     for(int j = 0; j<4; j++){
00248       muonBit = muonBit || region.getMuonBit(i,j);
00249     }
00250   }
00251   return muonBit;
00252 
00253 }

unsigned short L1RCTReceiverCard::calcRegionSum ( L1RCTRegion  region  )  [private]

Definition at line 219 of file L1RCTReceiverCard.cc.

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

Referenced by fillRegionSums().

00219                                                                  {
00220   unsigned short sum = 0;
00221   unsigned short overflow = 0;
00222   for(int i = 0; i<4; i++){
00223     for(int j = 0; j<4; j++){
00224       unsigned short towerEt = region.getEtIn9Bits(i,j);
00225       // If tower is saturated, peg the region to max value
00226       //if(towerEt == 0x1FF) sum = 0x3FF;  // HARDWARE DOESN'T DO THIS!!
00227       //else 
00228       sum = sum + towerEt;
00229     }
00230   }
00231   if(sum > 1023){
00232     sum = 1023;
00233     overflow = 1;
00234   }
00235   unsigned short sumFullInfo = sum*2 + overflow;
00236   return sumFullInfo;
00237 }

unsigned short L1RCTReceiverCard::calcTauBit ( L1RCTRegion  region  )  [private]

Definition at line 171 of file L1RCTReceiverCard.cc.

References L1RCTRegion::getActivityBit(), and i.

Referenced by fillTauBits().

00171                                                               {
00172   bitset<4> etaPattern;
00173   bitset<4> phiPattern;
00174 
00175   bitset<4> badPattern5(string("0101"));
00176   bitset<4> badPattern7(string("0111"));
00177   bitset<4> badPattern9(string("1001"));
00178   bitset<4> badPattern10(string("1010"));
00179   bitset<4> badPattern11(string("1011"));
00180   bitset<4> badPattern13(string("1101"));
00181   bitset<4> badPattern14(string("1110"));
00182   bitset<4> badPattern15(string("1111"));
00183 
00184   for(int i = 0; i<4; i++){
00185     phiPattern[i] = region.getActivityBit(i,0) || region.getActivityBit(i,1) ||
00186       region.getActivityBit(i,2) || region.getActivityBit(i,3);
00187     etaPattern[i] = region.getActivityBit(0,i) || region.getActivityBit(1,i) ||
00188       region.getActivityBit(2,i) || region.getActivityBit(3,i);
00189   }
00190 
00191   bool answer;
00192   
00193   if(etaPattern != badPattern5 && etaPattern != badPattern7 && 
00194      etaPattern != badPattern10 && etaPattern != badPattern11 &&
00195      etaPattern != badPattern13 && etaPattern != badPattern14 &&
00196      etaPattern != badPattern15 && phiPattern != badPattern5 && 
00197      phiPattern != badPattern7 && phiPattern != badPattern10 && 
00198      phiPattern != badPattern11 && phiPattern != badPattern13 && 
00199      phiPattern != badPattern14 && phiPattern != badPattern15 &&
00200      etaPattern != badPattern9 && phiPattern != badPattern9){       // adding in "9"
00201     //return false;
00202     answer = false;
00203   }
00204   //else return true;
00205   else {
00206     answer = true;
00207   }
00208   // cout << "Tau veto set to " << answer << endl;
00209   return answer;
00210 }

int L1RCTReceiverCard::cardNumber (  )  [inline]

Definition at line 23 of file L1RCTReceiverCard.h.

References cardNo.

00023 {return cardNo;}

int L1RCTReceiverCard::crateNumber (  )  [inline]

Definition at line 22 of file L1RCTReceiverCard.h.

References crtNo.

00022 {return crtNo;}

void L1RCTReceiverCard::fileInput ( char *  filename  ) 

Definition at line 34 of file L1RCTReceiverCard.cc.

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

00034                                                {
00035   vector<unsigned short> input(64);
00036   unsigned short x;
00037   std::ifstream instream(filename);
00038   if(instream){
00039     for(int i = 0; i<64; i++){
00040       if(!(instream >> x))
00041         break;
00042       else
00043         input.at(i) = x;
00044     }
00045   }
00046   fillInput(input);
00047 }

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

Referenced by fileInput(), and randomInput().

void L1RCTReceiverCard::fillMuonBits (  ) 

Definition at line 239 of file L1RCTReceiverCard.cc.

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

00239                                     {
00240   for(int i = 0; i<2; i++)
00241     muonBits.at(i) = calcMuonBit(regions.at(i));
00242 }

void L1RCTReceiverCard::fillRegionSums (  ) 

Definition at line 212 of file L1RCTReceiverCard.cc.

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

00212                                       {
00213   for(int i = 0; i<2; i++){
00214     etIn10Bits.at(i) = (calcRegionSum(regions.at(i)))/2;
00215     overFlowBits.at(i) = (calcRegionSum(regions.at(i)) & 1);
00216   }
00217 }

void L1RCTReceiverCard::fillTauBits (  ) 

Definition at line 166 of file L1RCTReceiverCard.cc.

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

00166                                    {
00167   for(int i = 0; i<2; i++)
00168     tauBits.at(i) = calcTauBit(regions.at(i));
00169 }

unsigned short L1RCTReceiverCard::getEtIn10BitsRegion ( int  i  )  [inline]

Definition at line 61 of file L1RCTReceiverCard.h.

References etIn10Bits.

00061 {return etIn10Bits.at(i);}

unsigned short L1RCTReceiverCard::getMuonBitRegion ( int  i  )  [inline]

Definition at line 59 of file L1RCTReceiverCard.h.

References muonBits.

00059 {return muonBits.at(i);}

unsigned short L1RCTReceiverCard::getOverFlowBitRegion ( int  i  )  [inline]

Definition at line 60 of file L1RCTReceiverCard.h.

References overFlowBits.

00060 {return overFlowBits.at(i);}

L1RCTRegion* L1RCTReceiverCard::getRegion ( int  i  )  [inline]

Definition at line 55 of file L1RCTReceiverCard.h.

References regions.

00055                                 {
00056     return &regions.at(i);
00057   }

unsigned short L1RCTReceiverCard::getTauBitRegion ( int  i  )  [inline]

Definition at line 58 of file L1RCTReceiverCard.h.

References tauBits.

00058 {return tauBits.at(i);}

void L1RCTReceiverCard::print ( void   ) 

Definition at line 255 of file L1RCTReceiverCard.cc.

References GenMuonPlsPt100GeV_cfg::cout, crtNo, lat::endl(), etIn10Bits, i, muonBits, regions, and tauBits.

00255                              {
00256   cout <<"Receiver Card " << cardNo << " in Crate " << crtNo <<endl;
00257 
00258   for(int i=0;i<2;i++){
00259     cout << "Region " << i << " information" << endl;
00260     regions.at(i).print();
00261     cout << "Region Et sum " << etIn10Bits.at(i) << endl;
00262     cout << "Tau Veto Bit " << tauBits.at(i) << endl;
00263     cout << "Muon Bit " << muonBits.at(i) << endl;
00264   }
00265 }

void L1RCTReceiverCard::printEdges (  )  [inline]

Definition at line 67 of file L1RCTReceiverCard.h.

References regions.

00067                    {
00068     regions.at(0).printEdges();
00069     regions.at(1).printEdges();
00070   }

void L1RCTReceiverCard::randomInput (  ) 

Definition at line 27 of file L1RCTReceiverCard.cc.

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

00027                                    {
00028   vector<unsigned short> input(64);
00029   for(int i = 0; i<64;i++)
00030     input.at(i) = rand()&511;
00031   fillInput(input);
00032 }

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

Definition at line 101 of file L1RCTReceiverCard.cc.

References crtNo.

00101                                                                       {
00102   vector<unsigned short> returnVec(3);
00103   unsigned short region;
00104   unsigned short towerrow;
00105   unsigned short towercol;
00106   if(crtNo <9){
00107     if(cardNo != 6){
00108       if(towernum < 16){
00109         region = 0;
00110         towerrow = towernum%4;
00111         towercol = 3-(towernum/4);
00112       }
00113       else{
00114         region = 1;
00115         towerrow = towernum%4;
00116         towercol = 7-(towernum/4);
00117       }
00118     }
00119     else{
00120       if(towernum < 16){
00121         region = 0;
00122         towerrow = towernum%4;
00123         towercol = 3-(towernum/4);
00124       }
00125       else{
00126         region = 1;
00127         towerrow = towernum%4;
00128         towercol = (towernum/4)-4;
00129       }
00130     }
00131   }
00132   else{
00133     if(cardNo != 6){
00134       if(towernum < 16){
00135         region = 0;
00136         towerrow = towernum%4;
00137         towercol = towernum/4;
00138       }
00139       else{
00140         region = 1;
00141         towerrow = towernum%4;
00142         towercol = (towernum/4)-4;
00143       }
00144     }
00145     else{
00146       if(towernum < 16){
00147         region = 0;
00148         towerrow = towernum%4;
00149         towercol = towernum/4;
00150       }
00151       else{
00152         region = 1;
00153         towerrow = towernum%4;
00154         towercol = 7-(towernum/4);
00155       }
00156     }
00157   }
00158   returnVec.at(0)=region;
00159   returnVec.at(1)=towerrow;
00160   returnVec.at(2)=towercol;
00161   return returnVec;
00162 }    


Member Data Documentation

unsigned short L1RCTReceiverCard::cardNo [private]

Definition at line 83 of file L1RCTReceiverCard.h.

Referenced by cardNumber().

unsigned short L1RCTReceiverCard::crtNo [private]

Definition at line 82 of file L1RCTReceiverCard.h.

Referenced by crateNumber(), 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.

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

Definition at line 77 of file L1RCTReceiverCard.h.

Referenced by fillMuonBits(), fillRegionSums(), fillTauBits(), getRegion(), print(), and printEdges().

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

Definition at line 90 of file L1RCTReceiverCard.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:58 2009 for CMSSW by  doxygen 1.5.4