CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1RCT.h
Go to the documentation of this file.
1 #ifndef L1RCT_h
2 #define L1RCT_h
3 
4 #include <bitset>
5 #include <iomanip>
6 #include <iostream>
7 #include <string>
8 #include <vector>
9 
12 
17 
18 class L1RCTLookupTables;
19 
20 class L1RCT {
21 public:
22  L1RCT(const L1RCTLookupTables *rctLookupTables);
23 
24  // Organize input for consumption by the cards
25  void input();
26 
27  // For testing accept external input
28  void input(const std::vector<std::vector<std::vector<unsigned short>>> &barrelIn,
29  const std::vector<std::vector<unsigned short>> &hfIn);
30 
31  // Should send commands to all crates to send commands to all RCs to
32  // process the input data and then send it on to the EICs and then
33  // to the JSCs
34  void processEvent();
35 
36  void fileInput(const char *filename); // added "const" also in .cc
37 
38  void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection);
39 
40  void randomInput();
41 
42  void print();
43  void printCrate(int i) { crates.at(i).print(); }
44  void printJSC(int i) { crates.at(i).printJSC(); }
45  void printJSC() {
46  for (int i = 0; i < 18; i++) {
47  std::cout << "JSC for Crate " << i << std::endl;
48  crates.at(i).printJSC();
49  }
50  }
51  void printRC(int i, int j) { crates.at(i).printRC(j); }
52  void printEIC(int i, int j) { crates.at(i).printEIC(j); }
53  void printEICEdges(int i, int j) { crates.at(i).printEICEdges(j); }
54 
56 
58 
59  std::vector<unsigned short> getJetRegions(unsigned crate) { return crates.at(crate).getJetRegions(); }
60 
61  std::vector<L1CaloRegion> getRegions(unsigned crate);
62 
63  unsigned short ecalCompressedET(int crate, int card, int tower) { return barrel.at(crate).at(card).at(tower) / 2; }
64  unsigned short ecalFineGrainBit(int crate, int card, int tower) { return barrel.at(crate).at(card).at(tower) & 1; }
65  unsigned short hcalCompressedET(int crate, int card, int tower) {
66  return barrel.at(crate).at(card).at(tower + 32) / 2;
67  }
68  unsigned short hcalFineGrainBit(int crate, int card, int tower) {
69  return barrel.at(crate).at(card).at(tower + 32) & 1;
70  }
71  unsigned short hfCompressedET(int crate, int tower) { return hf.at(crate).at(tower) / 2; }
72  unsigned short hfFineGrainBit(int crate, int tower) { return hf.at(crate).at(tower) & 1; }
73 
74 private:
75  L1RCT(); // Do not implement this
76 
78 
79  // Helper methods called by constructor
80  // Set all the neighbors properly.
81  // Will make use of the internal neighborMap
82  void makeCrates();
83  void configureCards();
84  void shareNeighbors();
85 
87 
88  // Helper class containing information to set all the neighbors for
89  // the receiver cards. We will use the methods
90  // north,south,west,east,se,sw,ne,nw,which each take in the
91  // indices of the region in question and then return the indices
92  // of the region that is the corresponding neighbor to be used.
94 
95  // Vector of all 18 crates.
96  // Will follow numbering convention listed
97  // in the CaloTrigger Tower Mapping
98  // So 0->8 are eta -5 -> 0
99  // While 9-17 are eta 0 -> 5
100  // Crate i and crate i+9 are next to each other
101  std::vector<L1RCTCrate> crates;
102 
103  // Data for processing is organized into the crates and cards
104  // in two multilayered vectors of vectors.
105  // The first is of the actual barrel information.
106  // 18 crates -> 7 RCs -> 64 unsigned shorts per RC
107  // so it should be a std::vector<std::vector<std::vector<unsigned short> > >
108  // The second is of the HF regions which is just of type
109  // std::vector<std::vector<unsigned short> >
110  std::vector<std::vector<std::vector<unsigned short>>> barrel;
111  std::vector<std::vector<unsigned short>> hf;
112 };
113 
114 #endif
std::vector< std::vector< unsigned short > > hf
Definition: L1RCT.h:111
std::vector< L1CaloEmCand > L1CaloEmCollection
std::vector< unsigned short > getJetRegions(unsigned crate)
Definition: L1RCT.h:59
void printCrate(int i)
Definition: L1RCT.h:43
unsigned short hcalCompressedET(int crate, int card, int tower)
Definition: L1RCT.h:65
unsigned short hfCompressedET(int crate, int tower)
Definition: L1RCT.h:71
std::vector< L1CaloRegion > getRegions(unsigned crate)
Definition: L1RCT.cc:359
void printRC(int i, int j)
Definition: L1RCT.h:51
unsigned short hcalFineGrainBit(int crate, int card, int tower)
Definition: L1RCT.h:68
std::vector< L1RCTCrate > crates
Definition: L1RCT.h:101
L1CaloEmCollection getNonisolatedEGObjects(unsigned crate)
Definition: L1RCT.cc:344
void randomInput()
Definition: L1RCT.cc:212
void makeCrates()
Definition: L1RCT.cc:48
unsigned short ecalFineGrainBit(int crate, int card, int tower)
Definition: L1RCT.h:64
unsigned short ecalCompressedET(int crate, int card, int tower)
Definition: L1RCT.h:63
L1CaloEmCollection getIsolatedEGObjects(unsigned crate)
Definition: L1RCT.cc:327
unsigned short hfFineGrainBit(int crate, int tower)
Definition: L1RCT.h:72
void printJSC()
Definition: L1RCT.h:45
void print()
Definition: L1RCT.cc:318
void printEIC(int i, int j)
Definition: L1RCT.h:52
void configureCards()
void input()
Definition: L1RCT.cc:64
L1RCTNeighborMap neighborMap
Definition: L1RCT.h:93
void printJSC(int i)
Definition: L1RCT.h:44
void processEvent()
Definition: L1RCT.cc:36
void fileInput(const char *filename)
Definition: L1RCT.cc:81
void digiInput(const EcalTrigPrimDigiCollection &ecalCollection, const HcalTrigPrimDigiCollection &hcalCollection)
Definition: L1RCT.cc:109
L1RCTRegion empty
Definition: L1RCT.h:86
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
void shareNeighbors()
Definition: L1RCT.cc:233
Definition: L1RCT.h:20
const L1RCTLookupTables * rctLookupTables_
Definition: L1RCT.h:77
void printEICEdges(int i, int j)
Definition: L1RCT.h:53
std::vector< std::vector< std::vector< unsigned short > > > barrel
Definition: L1RCT.h:110