Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-04 02:02:47

0001 #ifndef L1RCTReceiverCard_h
0002 #define L1RCTReceiverCard_h
0003 
0004 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTRegion.h"
0005 #include <bitset>
0006 #include <cstdlib>
0007 #include <fstream>
0008 #include <iostream>
0009 #include <string>
0010 #include <vector>
0011 
0012 class L1RCTLookupTables;
0013 
0014 class L1RCTReceiverCard {
0015 public:
0016   L1RCTReceiverCard(int crateNumber, int cardNumber, const L1RCTLookupTables *rctLookupTables);
0017 
0018   // No default constructor, no copy constructor,
0019   // and no assignment operator
0020   L1RCTReceiverCard() = delete;
0021 
0022   ~L1RCTReceiverCard();
0023 
0024   // Information needed to identify cards
0025   int crateNumber() { return crtNo; }
0026   int cardNumber() { return cardNo; }
0027 
0028   // Takes in a 64 element vector of unsigned shorts.
0029   // First layer is ecal the second is hcal.
0030   // goes in order of (for crate 0,card 0)
0031   // (Region 1)   (Region 0)
0032   // 29 25 21 17 13 09 05 01
0033   // 30 26 22 18 14 10 06 02
0034   // 31 27 23 19 15 11 07 03
0035   // 32 28 24 20 16 12 08 04
0036   //
0037   // For card 6 of crate 0 it would look like
0038   //
0039   // 13 09 05 01
0040   // 14 10 06 02
0041   // 15 11 07 03
0042   // 16 12 08 04
0043   // 17 21 25 29
0044   // 18 22 26 30
0045   // 19 23 27 31
0046   // 20 24 28 32
0047   //
0048   // In either case it is set up as so that 0-31 are the 8bit ecal energies
0049   // plus the fine grain bit, and 32-63 are the 8bit hcal energies plus
0050   // the muon bit.
0051   void fillInput(const std::vector<unsigned short> &input);
0052   void fillTauBits();
0053   void fillRegionSums();
0054   void fillMuonBits();
0055 
0056   // For each of the following functions the appropriate arguments are
0057   // 0 or 1
0058   L1RCTRegion *getRegion(int i) { return &regions.at(i); }
0059   unsigned short getTauBitRegion(int i) { return tauBits.at(i); }
0060   unsigned short getMuonBitRegion(int i) { return muonBits.at(i); }
0061   unsigned short getOverFlowBitRegion(int i) { return overFlowBits.at(i); }
0062   unsigned short getEtIn10BitsRegion(int i) { return etIn10Bits.at(i); }
0063 
0064   std::vector<unsigned short> towerToRegionMap(int towernum);
0065 
0066   void print();
0067 
0068   void printEdges() {
0069     regions.at(0).printEdges();
0070     regions.at(1).printEdges();
0071   }
0072 
0073   void randomInput();
0074   void fileInput(char *filename);
0075 
0076 private:
0077   std::vector<L1RCTRegion> regions;
0078 
0079   unsigned short calcRegionSum(L1RCTRegion region);
0080   unsigned short calcTauBit(L1RCTRegion region);
0081   unsigned short calcMuonBit(L1RCTRegion region);
0082   unsigned short crtNo;
0083   unsigned short cardNo;
0084 
0085   const L1RCTLookupTables *rctLookupTables_;
0086 
0087   std::vector<unsigned short> etIn10Bits;
0088   std::vector<unsigned short> overFlowBits;
0089   std::vector<unsigned short> muonBits;
0090   std::vector<unsigned short> tauBits;
0091 };
0092 #endif