CMS 3D CMS Logo

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