Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:35

0001 #ifndef L1RCT_h
0002 #define L1RCT_h
0003 
0004 #include <bitset>
0005 #include <iomanip>
0006 #include <iostream>
0007 #include <string>
0008 #include <vector>
0009 
0010 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTCrate.h"
0011 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTNeighborMap.h"
0012 
0013 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0014 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0015 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0016 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegion.h"
0017 
0018 class L1RCTLookupTables;
0019 
0020 class L1RCT {
0021 public:
0022   L1RCT(const L1RCTLookupTables *rctLookupTables);
0023 
0024   // Organize input for consumption by the cards
0025   void input();
0026 
0027   // For testing accept external input
0028   void input(const std::vector<std::vector<std::vector<unsigned short>>> &barrelIn,
0029              const std::vector<std::vector<unsigned short>> &hfIn);
0030 
0031   // Should send commands to all crates to send commands to all RCs to
0032   // process the input data and then send it on to the EICs and then
0033   // to the JSCs
0034   void processEvent();
0035 
0036   void fileInput(const char *filename);  // added "const" also in .cc
0037 
0038   void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection);
0039 
0040   void randomInput();
0041 
0042   void print();
0043   void printCrate(int i) { crates.at(i).print(); }
0044   void printJSC(int i) { crates.at(i).printJSC(); }
0045   void printJSC() {
0046     for (int i = 0; i < 18; i++) {
0047       std::cout << "JSC for Crate " << i << std::endl;
0048       crates.at(i).printJSC();
0049     }
0050   }
0051   void printRC(int i, int j) { crates.at(i).printRC(j); }
0052   void printEIC(int i, int j) { crates.at(i).printEIC(j); }
0053   void printEICEdges(int i, int j) { crates.at(i).printEICEdges(j); }
0054 
0055   L1CaloEmCollection getIsolatedEGObjects(unsigned crate);
0056 
0057   L1CaloEmCollection getNonisolatedEGObjects(unsigned crate);
0058 
0059   std::vector<unsigned short> getJetRegions(unsigned crate) { return crates.at(crate).getJetRegions(); }
0060 
0061   std::vector<L1CaloRegion> getRegions(unsigned crate);
0062 
0063   unsigned short ecalCompressedET(int crate, int card, int tower) { return barrel.at(crate).at(card).at(tower) / 2; }
0064   unsigned short ecalFineGrainBit(int crate, int card, int tower) { return barrel.at(crate).at(card).at(tower) & 1; }
0065   unsigned short hcalCompressedET(int crate, int card, int tower) {
0066     return barrel.at(crate).at(card).at(tower + 32) / 2;
0067   }
0068   unsigned short hcalFineGrainBit(int crate, int card, int tower) {
0069     return barrel.at(crate).at(card).at(tower + 32) & 1;
0070   }
0071   unsigned short hfCompressedET(int crate, int tower) { return hf.at(crate).at(tower) / 2; }
0072   unsigned short hfFineGrainBit(int crate, int tower) { return hf.at(crate).at(tower) & 1; }
0073 
0074 private:
0075   L1RCT();  // Do not implement this
0076 
0077   const L1RCTLookupTables *rctLookupTables_;
0078 
0079   // Helper methods called by constructor
0080   // Set all the neighbors properly.
0081   // Will make use of the internal neighborMap
0082   void makeCrates();
0083   void configureCards();
0084   void shareNeighbors();
0085 
0086   L1RCTRegion empty;
0087 
0088   // Helper class containing information to set all the neighbors for
0089   // the receiver cards.  We will use the methods
0090   // north,south,west,east,se,sw,ne,nw,which each take in the
0091   // indices of the region in question and then return the indices
0092   // of the region that is the corresponding neighbor to be used.
0093   L1RCTNeighborMap neighborMap;
0094 
0095   // Vector of all 18 crates.
0096   // Will follow numbering convention listed
0097   // in the CaloTrigger Tower Mapping
0098   // So 0->8 are eta -5 -> 0
0099   // While 9-17 are eta 0 -> 5
0100   // Crate i and crate i+9 are next to each other
0101   std::vector<L1RCTCrate> crates;
0102 
0103   // Data for processing is organized into the crates and cards
0104   // in two multilayered vectors of vectors.
0105   // The first is of the actual barrel information.
0106   // 18 crates -> 7 RCs -> 64 unsigned shorts per RC
0107   // so it should be a std::vector<std::vector<std::vector<unsigned short> > >
0108   // The second is of the HF regions which is just of type
0109   // std::vector<std::vector<unsigned short> >
0110   std::vector<std::vector<std::vector<unsigned short>>> barrel;
0111   std::vector<std::vector<unsigned short>> hf;
0112 };
0113 
0114 #endif