00001 #ifndef L1RCTReceiverCard_h 00002 #define L1RCTReceiverCard_h 00003 00004 #include <cstdlib> 00005 #include <fstream> 00006 #include <iostream> 00007 #include <vector> 00008 #include <bitset> 00009 #include <string> 00010 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTRegion.h" 00011 00012 class L1RCTLookupTables; 00013 00014 class L1RCTReceiverCard { 00015 00016 public: 00017 00018 L1RCTReceiverCard(int crateNumber, int cardNumber, const L1RCTLookupTables *rctLookupTables); 00019 ~L1RCTReceiverCard(); 00020 00021 //Information needed to identify cards 00022 int crateNumber() {return crtNo;} 00023 int cardNumber() {return cardNo;} 00024 00025 //Takes in a 64 element vector of unsigned shorts. 00026 //First layer is ecal the second is hcal. 00027 //goes in order of (for crate 0,card 0) 00028 // (Region 1) (Region 0) 00029 // 29 25 21 17 13 09 05 01 00030 // 30 26 22 18 14 10 06 02 00031 // 31 27 23 19 15 11 07 03 00032 // 32 28 24 20 16 12 08 04 00033 // 00034 // For card 6 of crate 0 it would look like 00035 // 00036 // 13 09 05 01 00037 // 14 10 06 02 00038 // 15 11 07 03 00039 // 16 12 08 04 00040 // 17 21 25 29 00041 // 18 22 26 30 00042 // 19 23 27 31 00043 // 20 24 28 32 00044 // 00045 //In either case it is set up as so that 0-31 are the 8bit ecal energies 00046 //plus the fine grain bit, and 32-63 are the 8bit hcal energies plus 00047 //the muon bit. 00048 void fillInput(std::vector<unsigned short> input); 00049 void fillTauBits(); 00050 void fillRegionSums(); 00051 void fillMuonBits(); 00052 00053 //For each of the following functions the appropriate arguments are 00054 //0 or 1 00055 L1RCTRegion *getRegion(int i) { 00056 return ®ions.at(i); 00057 } 00058 unsigned short getTauBitRegion(int i) {return tauBits.at(i);} 00059 unsigned short getMuonBitRegion(int i) {return muonBits.at(i);} 00060 unsigned short getOverFlowBitRegion(int i) {return overFlowBits.at(i);} 00061 unsigned short getEtIn10BitsRegion(int i) {return etIn10Bits.at(i);} 00062 00063 std::vector<unsigned short> towerToRegionMap(int towernum); 00064 00065 void print(); 00066 00067 void printEdges(){ 00068 regions.at(0).printEdges(); 00069 regions.at(1).printEdges(); 00070 } 00071 00072 void randomInput(); 00073 void fileInput(char* filename); 00074 00075 private: 00076 00077 std::vector<L1RCTRegion> regions; 00078 00079 unsigned short calcRegionSum(L1RCTRegion region); 00080 unsigned short calcTauBit(L1RCTRegion region); 00081 unsigned short calcMuonBit(L1RCTRegion region); 00082 unsigned short crtNo; 00083 unsigned short cardNo; 00084 00085 const L1RCTLookupTables* rctLookupTables_; 00086 00087 std::vector<unsigned short> etIn10Bits; 00088 std::vector<unsigned short> overFlowBits; 00089 std::vector<unsigned short> muonBits; 00090 std::vector<unsigned short> tauBits; 00091 00092 //No default constructor, no copy constructor, 00093 //and no assignment operator 00094 L1RCTReceiverCard(); 00095 }; 00096 #endif