File indexing completed on 2024-04-06 12:21:42
0001 #include "L1Trigger/TextToDigi/interface/SourceCardRouting.h"
0002 #include <cstdlib>
0003 #include <iostream>
0004 #include <sstream>
0005 using namespace std;
0006
0007 int main(void) {
0008 unsigned short logicalCardID = 0;
0009 unsigned short eventNumber = 0;
0010 std::string tempString;
0011
0012 unsigned long VHDCI[2][2] = {{0}};
0013 SourceCardRouting temp;
0014
0015 unsigned short RC[18][7][2] = {{{0}}};
0016 unsigned short RCof[18][7][2] = {{{0}}};
0017 unsigned short RCtau[18][7][2] = {{{0}}};
0018 unsigned short HF[18][4][2] = {{{0}}};
0019 unsigned short HFQ[18][4][2] = {{{0}}};
0020
0021 unsigned short testRC[18][7][2] = {{{0}}};
0022 unsigned short testRCof[18][7][2] = {{{0}}};
0023 unsigned short testRCtau[18][7][2] = {{{0}}};
0024 unsigned short testHF[18][4][2] = {{{0}}};
0025 unsigned short testHFQ[18][4][2] = {{{0}}};
0026
0027 std::cout << "fill with junk..." << std::endl;
0028 for (int RCTcrate = 0; RCTcrate < 18; RCTcrate++) {
0029 for (int RCcard = 0; RCcard < 7; RCcard++) {
0030 for (int Region = 0; Region < 2; Region++) {
0031 RC[RCTcrate][RCcard][Region] = rand() & 0x3ff;
0032 RCof[RCTcrate][RCcard][Region] = rand() & 0x1;
0033 RCtau[RCTcrate][RCcard][Region] = rand() & 0x1;
0034 }
0035 }
0036 }
0037
0038 for (int RCTcrate = 0; RCTcrate < 18; RCTcrate++) {
0039 for (int HFeta = 0; HFeta < 4; HFeta++) {
0040 for (int HFRegion = 0; HFRegion < 2; HFRegion++) {
0041 HF[RCTcrate][HFeta][HFRegion] = rand() & 0xff;
0042 HFQ[RCTcrate][HFeta][HFRegion] = rand() & 0x1;
0043 }
0044 }
0045 }
0046
0047 std::cout << "now do the proper stuff..." << std::endl;
0048
0049 int RoutingMode = 1;
0050 for (int RCTcrate = 0; RCTcrate < 18; RCTcrate++) {
0051 temp.RoutingModetoLogicalCardID(logicalCardID, RoutingMode, RCTcrate);
0052 temp.RC56HFtoSTRING(logicalCardID,
0053 eventNumber,
0054 RC[RCTcrate],
0055 RCof[RCTcrate],
0056 RCtau[RCTcrate],
0057 HF[RCTcrate],
0058 HFQ[RCTcrate],
0059 tempString);
0060
0061
0062
0063 temp.STRINGtoVHDCI(logicalCardID, eventNumber, tempString, VHDCI);
0064 temp.VHDCItoRC56HF(
0065 testRC[RCTcrate], testRCof[RCTcrate], testRCtau[RCTcrate], testHF[RCTcrate], testHFQ[RCTcrate], VHDCI);
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 }
0086
0087 RoutingMode = 2;
0088 for (int RCTcrate = 0; RCTcrate < 18; RCTcrate++) {
0089 temp.RoutingModetoLogicalCardID(logicalCardID, RoutingMode, RCTcrate);
0090 temp.RC012toSTRING(logicalCardID, eventNumber, RC[RCTcrate], RCof[RCTcrate], RCtau[RCTcrate], tempString);
0091
0092
0093
0094 temp.STRINGtoVHDCI(logicalCardID, eventNumber, tempString, VHDCI);
0095 temp.VHDCItoRC012(testRC[RCTcrate], testRCof[RCTcrate], testRCtau[RCTcrate], VHDCI);
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107 }
0108
0109 RoutingMode = 3;
0110 for (int RCTcrate = 0; RCTcrate < 9; RCTcrate++) {
0111 temp.RoutingModetoLogicalCardID(logicalCardID, RoutingMode, RCTcrate);
0112 temp.RC234toSTRING(logicalCardID,
0113 eventNumber,
0114 RC[RCTcrate],
0115 RCof[RCTcrate],
0116 RCtau[RCTcrate],
0117 RC[RCTcrate + 9],
0118 RCof[RCTcrate + 9],
0119 RCtau[RCTcrate + 9],
0120 tempString);
0121
0122
0123
0124 temp.STRINGtoVHDCI(logicalCardID, eventNumber, tempString, VHDCI);
0125 temp.VHDCItoRC234(testRC[RCTcrate],
0126 testRCof[RCTcrate],
0127 testRCtau[RCTcrate],
0128 testRC[RCTcrate + 9],
0129 testRCof[RCTcrate + 9],
0130 testRCtau[RCTcrate + 9],
0131 VHDCI);
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149 }
0150
0151 std::cout << "and now to check..." << std::endl;
0152 for (int RCTcrate = 0; RCTcrate < 18; RCTcrate++) {
0153 std::cout << "------------------ " << RCTcrate << " ------------------" << std::endl;
0154 for (int RCcard = 0; RCcard < 7; RCcard++) {
0155 for (int Region = 0; Region < 2; Region++) {
0156 if ((RC[RCTcrate][RCcard][Region] != testRC[RCTcrate][RCcard][Region]) ||
0157 (RCof[RCTcrate][RCcard][Region] != testRCof[RCTcrate][RCcard][Region]) ||
0158 (RCtau[RCTcrate][RCcard][Region] != testRCtau[RCTcrate][RCcard][Region])) {
0159 std::cout << RC[RCTcrate][RCcard][Region] << '\t' << testRC[RCTcrate][RCcard][Region] << '\t';
0160 std::cout << RCof[RCTcrate][RCcard][Region] << '\t' << testRCof[RCTcrate][RCcard][Region] << '\t';
0161 std::cout << RCtau[RCTcrate][RCcard][Region] << '\t' << testRCtau[RCTcrate][RCcard][Region] << std::endl;
0162 }
0163 }
0164 }
0165 for (int HFeta = 0; HFeta < 4; HFeta++) {
0166 for (int HFRegion = 0; HFRegion < 2; HFRegion++) {
0167 if ((HF[RCTcrate][HFeta][HFRegion] != testHF[RCTcrate][HFeta][HFRegion]) ||
0168 (HFQ[RCTcrate][HFeta][HFRegion] != testHFQ[RCTcrate][HFeta][HFRegion])) {
0169 std::cout << HF[RCTcrate][HFeta][HFRegion] << '\t' << testHF[RCTcrate][HFeta][HFRegion] << '\t';
0170 std::cout << HFQ[RCTcrate][HFeta][HFRegion] << '\t' << testHFQ[RCTcrate][HFeta][HFRegion] << std::endl;
0171 }
0172 }
0173 }
0174 }
0175 }